Ho to get attachment URL to access attachment using browser link.

Manmath Kulkarni asked on March 7, 2017 11:16

Hi,

I have created attachment for rootPage. I want to access this attachment by using url in browser.

I tried using http://mydomain.com/getattachment/

Correct Answer

Roman Hutnyk answered on March 7, 2017 12:04

Navigate root page under Pages application, open properties -> attachments. There you'll see attachment. Insert attachment name into the following url template:

/getattachment/[filename_with_extension].aspx

Example:

/getattachment/js.png.aspx

Also consider storing the document into Media Library, so you'll have permanent link to it as well as 'file name' path.

1 votesVote for this answer Unmark Correct answer

Recent Answers


Chetan Sharma answered on March 7, 2017 11:20

In order to display attachments in a transformation from the Document attachments field of a document, you can take advantage of the Text/XML transformation type and the following macro:

{% foreach (attachment in Documents[NodeALiasPath].AllAttachments) {
"<a href='/getattachment/" + attachment.AttachmentGUID + "/attachment.aspx'>" + attachment.AttachmentName + "</a><hr />";
} %}
0 votesVote for this answer Mark as a Correct answer

Manmath Kulkarni answered on March 7, 2017 11:28

H Chetan,

Thanks for your answer. I already have referred to another question but I am not using any transformation.

I just want to access this attachment file using URL. I am trying to achieve following:

  1. Create text file, add some info and attach it to root page
  2. This file can be accessed using URL by Python script.
  3. It would be helpful if I can access file by filename instead of GUID.

Best regards,
Manmath

0 votesVote for this answer Mark as a Correct answer

Manmath Kulkarni answered on March 7, 2017 12:07

Thanks Roman and Chetan for quick reply.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.