How to identify what documents are part of a document set in the batch processing script?

Question

We need to get the information which documents in the batch belong to a particular document set. How to achieve this?

Answer

Below is a sample batch processing script:

for (int i = 0; i < Documents.Count; i++)
{

    IBatchItem documentSet = Documents[i].AsBatchItem;

    if (documentSet.ChildItems.Count > 0)
    Processing.ReportMessage("Items count: " + documentSet.ChildItems.Count.ToString());
    {
        for(int j = 0; j < documentSet.ChildItems.Count; j++)
        {
            IBatchItem child = documentSet.ChildItems[j];
            if(child.Type == TBatchItemType.BIT_Document)
            {
                IDocument document = child.AsDocument;
                Processing.ReportMessage("Child ID: " + document.Id.ToString());

            }
        }
    }
}

For example, if there is one set with 4 documents in the batch:

It will return the following:

IDs are the same that can be seen in the document properties:

 

 

Was this article helpful?

0 out of 0 found this helpful

Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.