I've found tons of questions where people are looking to get the URL of an attached file after the fact via CSOM or JSOM, or some other means.

I am looking to get the URL from Sharepoint Designer, and then insert that URL in an email from a Sharepoint Designer Workflow.

To clarify, I have a list where users are adding attachments (1 attachment) to their list item (within a Sharepoint 2010 environment). I have a workflow that sends an email after a new row is created, and basically prints all of the columns in the email.

Here is where I am hung up. I also want the attached item URL to be shown in the email.

I can see the structure of the URL will be:


And since I'll know the domain, site name, list name, and ID of the row created, I can build my URL a decent amount. But, I don't know the file name. If I could get the file name from Sharepoint designer, I could build the URL.

At the moment, the only thing I see within Sharepoint Designer is a boolean value if my list item has attachments or not.

To clarify, I do not want to attach the file to the email that gets sent as a part of the work flow. I'd like to link to the item that is already upload to my Sharepoint list and is attached to a specific row item.


FYI to others who might be looking for a solution to this, although I did this was a while ago, I believe this was how I solved the problem.

I ended up using a custom JS callback after the List Item was created. This callback would update the row I just created with the filename(s) as a concatenated string in a separate column.

So the logic was something like:

  1. User clicks "Create New", and a SP Modal window would open, with my form loaded in the modal window. (using a modal was integral, because I could attach JS listeners to its onSubmit function).
  2. I'd attach a listener to the modal window, so on Submit or Cancel, I'd run a function.
  3. If the user canceled, the function just exited.
  4. If the user submitted, I'd check to see if an attachment was added to the row item. If so, using JS I could get the file name(s), then concat those names together with a separator (I think I used a colon, :, since that can't be used in a file name) into a string and write that string to an empty column within the same row.
  5. I'd also mark a boolean on the row to true that I'd check in the SP Designer Workflow. When true, my Workflow would actually run.
  6. The workflow would have access to that col, could split the string, and I was able to build the URL string.

The problem with this is that, I couldn't add items to the row manually. I have to use this custom Modal interface so I'd have the ability to run updates to the row via JS.

That is to say, this solution was 100% client side. I'd rather have a server side solution, so adding to the row manually or through this custom Modal interface wouldn't matter. But alas, at the time I didn't have access to change things server-side, so this client-side solution was good enough for me.

  • 1
    @Nullldata, I liked your solution as I’m also using infopath designer but unfortunately the URL is inconsistent and I can not see the pattern why so. Have you ever encountered that issue and what solution did you have for it. Also if there are multiple attachment will this solution work?
    – rabbss
    Jun 9, 2019 at 18:41
  • @rabbss I didn't find a way to do multiple attachments with my solution. TBH, when I came up with that solution I didn't think about multiple attachments. I only realised that multiple attachments wouldn't work with it a while after. Sorry! I can't think of anything to do with inconstant list attachment links, however if you are using list folders I would imagine that the hard coded URL in the workflow might need altering.
    – user43832
    Jul 1, 2019 at 14:31

3 Answers 3


It seems it is not doable. See https://social.msdn.microsoft.com/Forums/en-US/22ddd28d-d074-49ac-9044-074ceb155ffb/how-to-get-attachment-url-in-sharepoint-designer.

You can write a custom sandboxed workflow action to item's Attachment URL.

  • Uggh, thanks. I kept finding people saying "why attach the list item attachment to your email when you can link to it? You get that OOB." Then they didn't say HOW to link to the attachment. Makes sense that the reason was that functionality actually isn't Out Of the Box. Thanks for the reply.
    – romellem
    Oct 9, 2015 at 17:15

I got round this issue by using Infopath Designer to inject the filename into a "single line of text" field that my workflow could target.

The steps were as follows.

  1. create a "single line of text" field in your list. I called mine "AttachmentURL"

Add a single line of text field

  1. Load infopath designer. and load your SharePoint list

  2. Right click on the "single line of text" field "AttachmentURL" and select "Text box properties"

Select text box properties

  1. In the "Default Value" section next to "Value", click the "Fx" button


  1. In the "Formula" dialog box, select the "Insert Field or Group" button

Insert field or group

  1. In "Advanced view", expand the "Attachments" folder, and select the ":attachmentURL" icon and click "OK" all the way back to your form

Select field or group

  1. After making any other alterations in your form, publish the form to the SharePoint list (I used rules to hide the AttachementsURL in the form)


  1. Open SharePoint Designer and go to your list workflow

  2. You will now be able to build the Attachment's URL by creating a hyperlink that follows this construction :


which will look like this in your workflow string builder :


Create hyperlink in designer

I had no issue posting the attachment URL in a designer workflow email with this method.

I must point out, that with this method, only the 1st attachment link will be shown in the output. Any subsequent attachment links will not be displayed.

enter image description here

  • 1
    Fantastic response. Although I no longer have a need for this workaround / solution, I'm sure others out there will appreciate it. Thanks!
    – romellem
    Apr 3, 2017 at 19:04
  • 1
    You're welcome mate. I had just been looking for the solution myself when I found this post. Decided to post my solution as this post didn't have a solution that worked for me.
    – user43832
    Apr 3, 2017 at 19:14
  • i am looking for a similar solution but i cant get it to work. the url changes to either true or false
    – Rinu
    Jul 25, 2017 at 7:59
  • Rinu, If you add "Attachments" to the workflow, you will get a boolean output (true / false). You need to follow the steps listed above exactly. It is all about creating a new field called "AttachmentsURL" and using that in a Hyperlink in your Workflow Email.
    – user43832
    Jul 25, 2017 at 9:52
  • 1
    @Nullldata Yes I have resolved in that way.Thank you.
    – mzonerz
    Jul 1, 2019 at 12:11

We used a client side JavaScript solution and a field for the file name.

  1. Create a new field (attachment name, for example)
  2. Add an html div webpart to the NewForm.aspx and EditForm.aspx in SharePoint Designer. These files can be found in All Files->Lists->[ListName].
  3. Add code similar to this. Please note, I've also added jQuery - you'll need to add it as well if you want to use this, or rewrite to not use jQuery. This overwrites SharePoint's builtin UploadAttachment function to add a handler whenever an attachment is added:

    UploadAttachment = (function() {

    var cached_function = UploadAttachment;
    return function() {
        var result = cached_function.apply(this, arguments); // use .apply() to call microsoft's builtin function.
        // extension code
        fileInput = $("input[type='file']", "#contentBox");
        $(fileInput).change(function () {
            var name = $(fileInput).val().split('\\').pop();
        return result;
  4. You may also want to override RemoveLocal in the same way, so if they remove an attachment it removes from your field. This is optional, because you can see if attachments is true in the workflow and overwrite your attachment name field to blank if there aren't attachments.

    RemoveLocal = (function() {

        var cached_function = RemoveLocal;
        return function() {
            var result = cached_function.apply(this, arguments); // use .apply() to call it
            // extension code
            return result;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.