locked
URLs with spaces not translating in workflow emails RRS feed

  • Question

  • Hello

    I am using SharePoint Designer 2007 to create some custom workflows for SharePoint 2003.  The problem I am running into is as follows:

    I am using the Send an email action to notify a user that a request has been submitted and assigned to them.  In this email I want to include a link to the submitted document.  This works unless the submitted document name has more than one word in the title.  What happens is that it is not properly translating the space to %20 when creating an HTML link to the doc and it is cutting out the last part of the link to the document.  I have tried all combinations of building the URL dynamically from looking up items using the "Add lookup to body" section, but none of them work.  Any idea on how I can create a clickable link in an email when there is a space in a file name on SharePoint?

    Thursday, March 31, 2011 12:57 AM

Answers

  • This is expected, so the real question is why do you have spaces in your filenames?  You posted this in the InfoPath forum, so the assumption is that you are talking about InfoPath forms and not just random documents, right?  If so, then there should be no spaces in your filenames (there should never be spaces in any filenames really), and you should enforce this by auto-generating your filenames within the form - don't let users type filenames and don't give them a filename with spaces: InfoPath – Auto-Generating Filenames.
    SharePoint Architect || Microsoft MVP || My Blog
    Planet Technologies || SharePoint Task Force
    • Marked as answer by David HM Friday, April 8, 2011 1:40 AM
    Thursday, March 31, 2011 2:00 AM

All replies

  • This is expected, so the real question is why do you have spaces in your filenames?  You posted this in the InfoPath forum, so the assumption is that you are talking about InfoPath forms and not just random documents, right?  If so, then there should be no spaces in your filenames (there should never be spaces in any filenames really), and you should enforce this by auto-generating your filenames within the form - don't let users type filenames and don't give them a filename with spaces: InfoPath – Auto-Generating Filenames.
    SharePoint Architect || Microsoft MVP || My Blog
    Planet Technologies || SharePoint Task Force
    • Marked as answer by David HM Friday, April 8, 2011 1:40 AM
    Thursday, March 31, 2011 2:00 AM
  • SharePoint is a Document Management system which is designed to be user-friendly. Naming all documents in your site farm with no spaces makes the document titles difficult to read for the end users. I agree that, programatically, no spaces is good, but unfortunately, systems are used by human beings. So even though your suggestion has been marked as an answer, it's not really a solution is it?

    The solution I came up with that solved my instance of this problem was to add a text column to the List I was working with, then put some JavaScript in the NewForm.aspx file that copies the file name into the text file and the applies an "encodeURI" to convert the word spaces into %20 ...

    So when I create a new item in my list, the JavaScript takes the file name, converts the spaces to %20, then copies the string into the text field in the list. When I build the WorkFlow Email, instead of concating the file name into a URL, I use the text field that pulls out (for example) "my%20file" and adds the pre-amble (http://myserver/path/) and the suffix (.pdf) and I have a working URL ...

    The full solution is posted at my blog ...

    Thursday, January 9, 2014 3:21 PM