[closed] How to check for existing or removed attachments using the Java Client API
Good morning everyone.
I'm asking for clarification on how to manage attachments in a workitem. I'll start by saying that I've already retrieved them through a few calls... but I have the problem of having to manage them, that is, check their presence or absence. I assumed that using getComment, I could get something, but that's not the case... Also because out of four comments, it only finds two, and more importantly, it doesn't tell me if they've been added or removed. I haven't found any other ways to manage them. Do you have any ideas?
In the meantime, here's what I've already tried, this one to find removed attachments:
List<IAttachmentHandle> attachmentDeletedList = wicn.getReferences().getDeletedAttachments();
for(IAttachmentHandle iDeletedAttHandle : attachmentDeletedList) {
IAttachment deletedAtt = iac.resolveAuditable(iDeletedAttHandle,IAttachment.FULL_PROFILE, null);
But it doesn't work, because even if there's a removal on the WorkItem, it doesn't find it, and the ticket I'm passing is the correct one.
This was to retrieve them all:
List<IReference> referenceList = wicn.getReferences().getReferences(WorkItemEndPoints.ATTACHMENT);
But here too, it only finds two of the four comments, the second and third in chronological order. All things considered, I'd like not to add attachments if I've already done so. Thanks everyone in advance.
The question has been closed for the following reason: "Duplicate Question" by rschoon Jul 30 '25, 9:09 a.m.