On 27 juin 08, at 20:38, bd(a)bc-bd.org wrote:
So question is, how do I actually add an attachment to a page?
Hi,
as you quoted in the previous post, the contentId (which is not a
pageId) is actually ignored and is there because of the Confluence API
compatibility.
In order to specify the page to attach data to, you must use the
pageId field of the Attachment class.
Here is a snippet from the unit tests:
String attachmentName = String.format("test.png", random.nextInt());
byte[] data = ...
Attachment attachment = new Attachment();
attachment.setPageId("Foo.Bar");
attachment.setFileName(attachmentName);
attachment = rpc.addAttachment(0, attachment, data);
This will attach to page Foo.Bar a file called test.png with the
content set to data.
I hope this answers your question.
-Fabio