Import attachments using FileLoad API
Can we use the IAttaachmentFile Interface to import URL and file attachments to an Document?
What is the best way to do it using APIs?
Currently we are able to achieve using an iterator on the TABLE_ATTACHMENTS for the Item.but we are seeing duplicate Atatchments in teh Item. How can we achieve versioning of attachment? below is the snippet we are using
ITable table = null;
ITable aiTable = eco.getTable(ChangeConstants.TABLE_AFFECTEDITEMS);
Iterator it = aiTable.iterator();
IRow row;
while (it.hasNext()) {
row = (IRow)it.next();
IItem item = (IItem) row.getReferent();
if (item.getName().toUpperCase().trim().compareTo(itemNumber.toUpperCase().trim()) == 0 )
{
table = item.getTable(ItemConstants.TABLE_ATTACHMENTS);
if(url!=null)
{
// Add files to Attachments table
//IRow attach1 =
table.createRow(doc);
// Add URL to Attachments table
//IRow attach2 =
table.createRow(url);
}
else{
//IRow attach1 =
table.createRow(doc);
}
log.info(“Successfully attached the files and URLS to item: ” + item.getName());
}
}
File Folders are versioned when you perform a check-in.
You could try building your versions like
for version 1-n do
checkout
upload File vesrion n
checkin/out