cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Download Document Primary Content using API

Newbie

Download Document Primary Content using API

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 2

RE: Download Document Primary Content using API

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());
}
}

RE: Download Document Primary Content using API

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