Document Management Software Blog by FileHold Systems

Learn more about document management software and records management, scanning and imaging, paperless office ideas, work flow, and other related topics.

Sunday, May 11, 2008

Document Management API Code Snippet - Add Documents with Metadata

Sometimes customers will integrate the FileHold document management software system with other systems, databases and applications in their network or enterprise. While the majority of our wide ranging customer base use FileHold Document Management Software out of the box, there are customer examples who require an API for integration into other systems. For example, we have customers that have integrated with SAP, GlobalShop ERP, Java based systems via SOAP, Oracle E-Business Suite Financials, MS SharePoint, and custom intranet applications as well as various types of corporate enterprise information portals.

FileHold is a .NET 2.0 / 3.0 C# based system designed around a scalable, highly configurable web services oriented architecture.

This blog post features a useful code snippet that shows how you can add a document to the FileHold document management software system via the FileHold web services based API.

For those who do not understand what a code snippet is - this is an example of how to use code - not an entirely self contained piece of software.
============================
The Document Manager class has a method AddDocument and one of the
parameters is a array of FieldWithValues structure.



// ----------- code snippet


// get the fields definition for the schema

FieldDefinition[] fielddefinitions =
DocumentSchemaManager.GetDocumentSchemaFields( SchemaId );


//create the new schema values for the document

List fieldsWithValues = new List();


//for each schema field

foreach ( FieldDefinition field in fielddefinitions )

{

// only do for NON system fields

if ( !field.IsSystem )

{

FieldWithValue newFieldValue = = new
FieldWithValue();



//global field id

newFieldValue.FieldId = field.MetadataFieldId;



// define variable ob type object

object value = null;

// and now based on the field type assign the value

// if you want to assign default value

// value = field.InitialValue;



// if it is string

// value = "text of the metadata"



// if it is date

// DateTime dt = new DateTime( 2008, 4, 12 );

// value = dt;



// in case of dropdown menu

// get the menu items into array

// DropdownFieldChoice[] menuchoices =
DocumentSchemaManager.GetDropDownMenuItems(field.MetadataFieldId);

// // set the default null value

// value = new int[] { };

// foreach (DocumentSchemaManagerService.DropdownFieldChoice menu in
menuchoices )

// {

// if (menu.Value == YOU_MENU_FIELD_VALUE )

// {

// value = new int[] { menu.Id };

// break;

// }

// }



// set the value

newFieldValue.FieldValue = value;

// add the field value to the list

fieldsWithValues.Add( newFieldValue );

}

}



// now you can use the fieldsWithValues variable in the AddDocument method



// ----------- end of code snippet

Labels: , , , , ,

0 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home