Solved

Alternaitves to '&' and Spaces when file mapping?

  • 20 December 2016
  • 3 replies
  • 5 views

Badge +1

Hi all,

I'm attempting to use the 'Copy to file share' action.

 

I keep getting 'Error Code: (3) The system cannot find the path specified.'


This is due to either of these 2 reasons (Possibly both) and I don't know this fix

 

The file location I am wanting to save to includes a '&' and also a space which is why I believe I am getting this error. I know this as I have used a different file in the same location with no symbols or spaces and everything works fine. I'v also tried %20 and %26

 

Example file location: //example/example2/example&example example

 

Any help would be much appreciated.

icon

Best answer by Chris_Ben 21 December 2016, 06:48

View original

3 replies

Badge +1

I know that files shouldn't have a & symbol in but I cannot change this file name.

 But if anyone has a work around?

Userlevel 7
Badge +17

One question - do you insert the path directly to the "Destination" field or do you declare it using a variable? If directly - try to declare it as a variable and then use the variable rather than a raw string.

If you do it already... Then what I only can think of is escaping of the problematic chars.

You can try not to "url escape" the special characters, but "regex escape", so in your case it would be:

//example/example2/example&example example

Maybe even double-escape would be needed, so:

//example/example2/example\&example\ example

However from what I already faced and suffered in O365 environment, I highly recommend to declare the path as a variable (escaped or unescaped, see what will work) and then using the variable, not the raw string.

I hope it helps

Regards,

Tomasz

Userlevel 6
Badge +12

Hi Luke,

I'm guessing that you are using SharePoint on-prem? (Your question has been posted to the o365 forum where the action doesn't exist).

What you're trying to do should work though without any escaping.  I tried and it successfully completed.  Try changing your slashes as I've used \uncpathetcetc instead of //uncpath/etc/etc.

Here's what I have got running - if your situation is the same, it should work.

  1. SharePoint on-prem (I'm using 2013 but it should make no difference)
  2. Access to write to the UNC path using whatever credentials you're supplying
  3. The UNC path contains an ampersand and spaces.  e.g. \MyServerMySharemy path with an & in it
  4. I have a doucment in a doc library and run the workflow on that
  5. I set a variable to \MyServerMySharemy path with an & in it
  6. I call copy to file share and supply the variable as the destination (but you shouldn't need to use a variable if you don't want to)
  7. Run the workflow and it copies successfully.

Cheers,

Chris

Reply