Edit and Save Index Data |
Scroll |
To update the index data of an existing document a few Web API operations can be used: SaveDocumentIndexData and UpdateDocument.
The Step-by-Step guide and the examples below illustrate how to modify index data values and how to save the changes made by the SaveDocumentIndexData operation. Please see Retrieve Documents to learn how to read, process and iterate index data.
1 |
Create a channel factory to the web service endpoint. |
2 |
Create a channel to the web service endpoint. |
3 |
Create a request to modify the index data values. |
4 |
Save the changes to the server. |
5 |
Close the channel and channel factory. |
6 |
Display a confirmation message. |
// 1. Create a channel factory to the web service endpoint
...
ChannelFactory<IThereforeService> channelFactory = new ChannelFactory<IThereforeService>(binding, endpoint);
// 2. Create a channel to the web service endpoint
IThereforeService service = channelFactory.CreateChannel();
// 3. Create a request to modify the index data values
SaveIndexDataParams parameters = new SaveIndexDataParams();
parameters.DocNo = Int32.Parse(tbDocNo.Text);
WSIndexDataItem indexData1 = new WSIndexDataItem { Value = new WSIndexDataString(CategoryIds.Files_Extension, "JPG") };
parameters.IndexDataItemsToSave.Add(indexData1);
WSIndexDataItem indexData2 = new WSIndexDataItem { Value = new WSIndexDataString(CategoryIds.Files_From_Folder, ".\\") };
parameters.IndexDataItemsToSave.Add(indexData2);
// 4. Save the changes to the server
service.SaveIndexData(parameters);
// 5. Close the channel and channel factory.
((IClientChannel)service).Close();
channelFactory.Close();
// 6. Display a confirmation message
MessageBox.Show("Index Data changed.");