Update Index Fields |
In order to update the values of the index fields of a document you only need to modify the changed fields. As a result of the update you get all fields returned.
using System; using System.Collections.Generic; using System.Linq; using System.Text; using DocuWare.Platform.ServerClient; namespace DocuWare.PlatformClientExamples { static partial class Examples { public static DocumentIndexFields Update(Document document) { var fields = new DocumentIndexFields() { Field = new List<DocumentIndexField>() { DocumentIndexField.Create("COMPANY", "Café Alt Wien"), DocumentIndexField.Create("ORDER", "Some bags of Scarlatti Blend"), DocumentIndexField.Create("AMOUNT", 37.98M), // Decimal value DocumentIndexField.CreateDate("TOBEPAYED", DateTime.Now + TimeSpan.FromDays(14)), // Just the day DocumentIndexField.Create("INVOICERECEIVEDON", DateTime.Now ), // Exact timestamp! DocumentIndexField.Create("TAGS", new DocumentIndexFieldKeywords() { Keyword = new List<string>() { "Café", "Expensive", "Tasty" } }), DocumentIndexField.Create("NUMBEROFBAGS", 15) // integer value } }; return document.PutToFieldsRelationForDocumentIndexFields(fields); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using DocuWare.Platform.ServerClient; namespace DocuWare.PlatformClientExamples { static partial class ExamplesAsync { public static async Task<DocumentIndexFields> UpdateAsync(Document document) { var fields = new DocumentIndexFields() { Field = new List<DocumentIndexField>() { DocumentIndexField.Create("COMPANY", "Café Alt Wien"), DocumentIndexField.Create("ORDER", "Some bags of Scarlatti Blend"), DocumentIndexField.Create("AMOUNT", 37.98M), // Decimal value DocumentIndexField.CreateDate("TOBEPAYED", DateTime.Now + TimeSpan.FromDays(14)), // Just the day DocumentIndexField.Create("INVOICERECEIVEDON", DateTime.Now ), // Exact timestamp! DocumentIndexField.Create("TAGS", new DocumentIndexFieldKeywords() { Keyword = new List<string>() { "Café", "Expensive", "Tasty" } }), DocumentIndexField.Create("NUMBEROFBAGS", 15) // integer value } }; return await document.PutToFieldsRelationForDocumentIndexFieldsAsync(fields).ConfigureAwait(false); } } }