kmccool
Scholar

Recycle Item Web request failing on file names with commas and apostrophes

Jump to solution

Hey everyone,

This post is loosely related to this one: Old post

 

My web call was working great throughout our cleanup project, however, we've just started cleaning the engineering collection and there are multiple items with file name that contain commas and apostrophes. These seem to be messing with the recycle web request.

 

here's and example of the call with the culprit underlined:

http://it/_api/web/getfilebyserverrelativeurl('cust/TechnicalAdvisor/Tom'sFiles/FacilitiesChargeandDamageClaimsProcessInteraction.docx')

I've tried a build string action that puts the URL in quotes so the call doesn't mistake the apostrophe as part of the command but it still isn't working. Call works for all files except those with commas and apostrophes in the file or doc name. ugh.

 

Thanks in advance for the help!

Kassie 

 

 

0 Kudos
Reply
3 Replies
emha
Collaborator

Re: Recycle Item Web request failing on file names with commas and apostrophes

Jump to solution

you need to double single apostrophee character, like

...Tom''sFiles...

 

good practice is as well to encode 'sensitive' characters, like

...Tom%27%27sFiles...

 

0 Kudos
Reply
kmccool
Scholar

Re: Recycle Item Web request failing on file names with commas and apostrophes

Jump to solution

I tried a replace function to add %27 but yea the request was unencoding it back to a apostrophy. I'll try this double approach and get back to you!

 

Thanks

Kassie

0 Kudos
Reply
kmccool
Scholar

Re: Recycle Item Web request failing on file names with commas and apostrophes

Jump to solution

Okay, so apostrophes I had to double encode, and commas I only had to single encode.

I used two RegEx actions, one to replace a comma with %2C and the other to replace an apostrophe with %27%27. My web call now works. YAY!

 

Thanks for the assistance @emha!

View solution in original post

0 Kudos
Reply