Question:
Can you upload a document with table field data using the .NET API?
Answer:
Uploading a document with table field data using .NET API would be possible. An example of how this can be done is as follows;
public static Document UploadDocumentWithTableField(FileCabinet fc)
{
var indexData = new Document
{
Fields = new List<DocumentIndexField>
{
//See separate method below
CreateTableField(),
DocumentIndexField.Create("COMPANY", "Flying Toms"),
DocumentIndexField.Create("CONTACT", "Brian Ford"),
DocumentIndexField.Create("DATE", new DateTime(2019, 4, 12)),
DocumentIndexField.Create("DOCUMENT_TYPE", "Invoice In")
}
};
//return uploaded document object
return fc.UploadDocument(indexData, new FileInfo("[FileName]"));
}
private static DocumentIndexField CreateTableField()
{
return new DocumentIndexField()
{
// Database of table field
FieldName = "CL_CODES",
ItemElementName = ItemChoiceType.Table,
Item = new DocumentIndexFieldTable
{
Row = new List<DocumentIndexFieldTableRow>
{
new DocumentIndexFieldTableRow()
{
ColumnValue = new List<DocumentIndexField>()
{
//Database name of table field column required
DocumentIndexField.Create("GLACCOUNT", "ABC 123"),
DocumentIndexField.Create("APPROVER", "Peggy Jenkins"),
}
},
}
}
};
}
For more on .NET API and code examples such as the one shown above, please visit Developer.docuware.com.
KBA is applicable for both Cloud and On-premise Organizations.