Show/Hide Toolbars

Therefore Web API Programming Interface 1.0

Archiving is the process of adding new documents to the Thereforeā„¢ system. The Step-by-Step guide below explains how to create a new document, add streams, edit index data values and store the document on the server.

 

 

 // 1. Create a channel factory to the web service endpoint

 ...

 ChannelFactory<IThereforeServicechannelFactory = new ChannelFactory<IThereforeService>(bindingendpoint);

 

 // 2. Create a channel to the web service endpoint

 IThereforeService service = channelFactory.CreateChannel();

 

 // 3. Create requested parameters

 CreateDocumentParams parameters = new CreateDocumentParams();

 

 string strFile = "d:\\data\\Order.doc";

 string strFileName = Path.GetFileName(strFile);

 string strExt = Path.GetExtension(strFile).Remove(0, 1);//remove dot

 string strFromFolder = Path.GetDirectoryName(strFile);

 

 // 4. Set the category you want to add the document to

 parameters.CategoryNo = CategoryIds.FilesCategory;

               

 // 5. Add a file stream to the document

 parameters.Streams = new List<WSStreamInfoWithData>();

 parameters.Streams.Add(new WSStreamInfoWithData { FileData = File.ReadAllBytes(strFile), FileName = strFileNameStreamNo = null });

 

 // 6. Add the index data to the document

 parameters.IndexDataItems = new List<WSIndexDataItem>();

 parameters.IndexDataItems.Add(new WSIndexDataItem(new WSIndexDataString(CategoryIds.Files_FilenamestrFileName)));

 parameters.IndexDataItems.Add(new WSIndexDataItem(new WSIndexDataString(CategoryIds.Files_From_FolderstrFromFolder)));

 parameters.IndexDataItems.Add(new WSIndexDataItem(new WSIndexDataString(CategoryIds.Files_ExtensionstrExt)));

 parameters.IndexDataItems.Add(new WSIndexDataItem(new WSIndexDataDate(CategoryIds.Files_Creation_DateDateTime.SpecifyKind(File.GetCreationTime(strFile), DateTimeKind.Unspecified))));

                

 // 7. Execute a create operation to store a document on the server

 CreateDocumentResponse response = service.CreateDocument(parameters);

 

 // 8. Close the channel and channel factory.

 ((IClientChannel)service).Close();

 channelFactory.Close();

 

 // 9. Process response.

 txt_result.Text += "Created document. No: " + response.DocNo + ". File added: " + strFileName + Environment.NewLine;

 

 

 

Ā© 2023 Therefore Corporation, all rights reserved.