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

Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X

Download Document Primary Content using API

giridhar82
1-Visitor

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

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

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

Announcements


Top Tags