Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

Removing Attached Files via API

Good morning everyone.
I ask you how to remove a file attached to a WI via api.
I'll start by saying that I saw the remove method, to which you pass an iRef, but this iRef needs a path to exist that I don't have or rather, I wouldn't have, to attach it I will have the path and I have already "solved" while for the removal I might no longer have that file in the path, since it was previously removed, so how can I delete the attachment, knowing only its name?
I hope I don't have to download it and then remove it, because I also thought about this but it's not a very clean thing, at least I think.
Thank you very much everyone.

0 votes



One answer

Permanent link
Good evening, this time I'll answer myself.
Basically by retrieving all the attachments via:
List<IReference> referenceList = workingCopy.getReferences().getReferences(WorkItemEndPoints.ATTACHMENT);
You get the list of all the attachments, for these you just need to use the get.Comment() and it contains, also the name and the extension of the same. So then you just need to do the remove if the comment contains the name.
Thank you very much everyone.

0 votes

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 11,016
× 415
× 6

Question asked: May 15, 6:35 a.m.

Question was seen: 276 times

Last updated: May 15, 9:36 a.m.

Confirmation Cancel Confirm