Error in SP.MoveCopyUtil.MoveFileByPath api where the source path has special character '

New Contributor

This is regarding an issue with SharePoint api - SP.MoveCopyUtil.MoveFileByPath() .We are making an ajax call with this api to move/copy files using a SPFX extension . Ajax call and also file recycle is failing when the source path has apostrophe- source has folders with names containing aphostrophe.


The user is trying to move documents from one document library folder to another. Folders in source and destination have names containing apostrophe.


When user tries to move the file, the file gets copied to destination. But, metadata is not getting updated and the file in the source is not getting recycled.


We have tried moving the document from folder structure having same names but no apostrophe (as  source) to the same destination(i.e folder structure in destination is same as above where the folder names have apostrophe) – it works as expected i.e. the file is copied to destination along with metadata and is recycled in the source.


We have tried encodeuri , encodeuricomponent, replacing apostrophe with %27 , replacing apostrophe with double apostrophe, escape(). But still the issue persists.


Below the value that is assigned to the DATA header in Ajax call.


{"srcPath":{"__metadata":{"type":"SP.ResourcePath"},"DecodedUrl":https://hostname/sites/site/Subsite/Doclibname/test'df/Location - Lorem Ipsum.docx},"destPath":{"__metadata":{"type":"SP.ResourcePath"},"DecodedUrl":https://hostname/sites/site/Subsite/Doclibname/test''s/test'1/Location - Lorem Ipsum.docx},"options":{"__metadata":{"type":"SP.MoveCopyOptions"},"RetainEditorAndModifiedOnMove":true,"ShouldBypassSharedLocks":true}}




0 Replies