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

We are working to address an issue with subscription email notifications. In the meantime, be sure to check your favorite boards for new topics.

Short URL for direct download of attachments?

DougWegscheid
1-Newbie

Short URL for direct download of attachments?

If I know the id of an attachment, what is the correct URL I can use to programmatically download the attachment from another machine?

Example: I have a document: wt.doc.WTDocument:167663137 and the primary content is OR:wt.content.ApplicationData:167724372

How do I download the data?

http://xxx/Windchill/servlet/AttachmentsDownloadDirectionServlet/primary?oid=OR:wt.doc.WTDocument:167663137

gives me a page of javascript that will redirect a java-script capable browser to the content at


http://xxx/Windchill/servlet/WindchillGW/wt.fv.master.StandardMasterService/doDirectDownload/Enhancements.xlsm?folderId=150909375&userid=16500377&adId=167724372&fileName=00000000290426&refsize=300369&mime=application/vnd.ms-excel.sheet.macroEnabled.12&mk=wt.fv.master.StandardMasterService&originalFi...

I need to URL to the content (no javascript available). Is there a simpler URL that will give me that?

2 REPLIES 2

Found my own answer. The ListContent Webject returns a "urlLocation" property, which is what I need.

Also, one of the example TaskDelegates has te code for determining download URL (I'm guessing it's similar to the code that ListContent uses).

tasks/com/ptc/windchill/ws/GetDownloadHandles.xml has the magic bits.

use below pseudo code may get the URL:

if (doc.isHasContents()) {
Vector<ApplicationData> contents = (Vector<ApplicationData>) doc.getContentVector();
for (ApplicationData appData : contents) {
java.net.URL url = null;
//some check here
try {
url = ContentHelper.service.getDownloadURL(doc, appData);
}
}
}
Top Tags