Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X
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.
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