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

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

extracting attachments(shared attachments, text attachments, attachments) by Java API

mhyang
9-Granite

extracting attachments(shared attachments, text attachments, attachments) by Java API

Hello, I want to extract attachments by Java API.

 

I want to get all attachments(attachment, shared, text) of 1 item by single command.

 

The problem is that "cwd" option does not works for Java API, so only 1 selected attachment can be downloaded and I need to iterated over files (= iterating command).

 

In addition, I can not download "Shared Attachments", "Text Attachments" by Java API. I can only download "Attachments" of a single item.

 

Command cmd = new Command(Command.IM, "extractattachments");
cmd.addOption(new Option("issue", "312"));
cmd.addOption(new FileOption("outputFile", downloadDirPath + "/attach.txt"));
//cmd.addOption(new Option("cwd", "/working/directory")); // this does not work
cmd.addSelection("attach.txt");

My question is that,

 

1. Is there a way to download all attachments of an selected item by Java API?

 

2. same as "Attachments" type is working, how can I download "Shared Attachments" and "Text Attachments" by Java API?

1 ACCEPTED SOLUTION

Accepted Solutions
awalsh
17-Peridot
(To:mhyang)

1. If you run the command im extractattachments without the --outputFile option and with no files at the end, then it will extract all attachments. I have not tried this in the API, so I'm not sure where the API will put these files. It will depend on the type of integration point. 

2. To extract attachments from a different file, use the --field option. 

View solution in original post

1 REPLY 1
awalsh
17-Peridot
(To:mhyang)

1. If you run the command im extractattachments without the --outputFile option and with no files at the end, then it will extract all attachments. I have not tried this in the API, so I'm not sure where the API will put these files. It will depend on the type of integration point. 

2. To extract attachments from a different file, use the --field option. 

Top Tags