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?
Solved! Go to Solution.
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.
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.