Skip to main content
1-Visitor
April 10, 2014
Question

Download Document Primary Content using API

  • April 10, 2014
  • 2 replies
  • 3446 views

I would like to download primary contents and attatchemtns for WTDocument and place it some pre defined folder on server , on releasing document.


I would like to know what is the API to use to download attachments and primary content of document.



Thanks in Advance.

2 replies

1-Visitor
April 10, 2014

ContentHolder content = ContentHelper.service.getContents((ContentHolder)documentObject);
Vector vcontent = ContentHelper.getApplicationData(content); // this will return all contents
if(vcontent.size() > 0){
for(int i=0; i<vcontent.size(); i++)=" {=" <br="/> wt.content.ApplicationData appData = (ApplicationData)vcontent.get(i);
String currfileName = appData.getFileName();
File saveAsFile= new java.io.File("D:/",currfileName); // input your location and file name
ContentServerHelper.service.writeContentStream((ApplicationData)appData, saveAsFile.getCanonicalPath());
}
}

16-Pearl
March 6, 2015

Hi Giri,


Attached API will help you to download secondary attachments to all WTDocoument to "D:\downloads" direcoty


You can modify it as per you requirment. Kindly share if you find it useful.


Thanks,


Shirish