If I use the default Confluence GUI to add an updated version of an existing page attachment, the attachment is updated, and Confluence keeps a version history of the attachment. If our users use the ConfluenceSoapService to add an updated version of an existing page attachment, the attachment is updated, and Confluence keeps a version history of the attachment.
However ... if I attempt to add an updated version of an existing page attachment with the AttachmentManager, the attachment does not get updated; Confluence creates a brand new attachment entry on the page.
What gives? Can I not update an attachment using the Java API? Can I only do this if I call the ConfluenceSoapService locally? This should not be this difficult, and it is driving me crazy.
Please Help
Community moderators have prevented the ability to post new answers.
Hi Brian & Laura,
I was having the same issue but recently found a solution. My solution is based on the fact that I already have an Attachment object to work with. It's possible to re-write if you only have a file/inputstream as well.
It depends on InputStreamAttachmentResource.java and FileUploadManager.java along with the attachmentManager.
import com.atlassian.confluence.pages.FileUploadManager; Attachment a = ...; // Get your attachmentObject or File/Inputstream Page spaceHomePage = ...; // ContentEntityObject where we save the attachment. AttachmentResource attachmentResource = new InputStreamAttachmentResource(attachmentManager.getAttachmentData(a), a.getFileName(), a.getContentType(), a.getFileSize()); fileUploadManager.storeResource(attachmentResource, spaceHomePage);
I'm sorry, but I was never able to figure this out. In fact, I disliked working with Confluence so much that I found a different job (Android developer now). Good luck, I hope you find your answer.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I know this was a year ago, but did you find a solution to this? I am also in the same position and it is driving me mad.
Thanks in advance,
Laura
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Community moderators have prevented the ability to post new answers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.