Copying Document Set content with special characters

  • 1 October 2014
  • 1 reply
  • 3 views

Badge +1

Hello All – We have a BlackPearl solution where we clone a document set, including its contents. The document set can have 0 to many documents contained within, that need to be copied to the clone. We achieve this (as suggested by a K2 professional services engineer) with a “SharePoint Search” event run on the originating document set, that stores the XML output of the search results in a content field of type ‘documents’. We then pass that content field in as the input parameter to a “SharePoint Documents” event configured for ‘Copy Documents’ --> ‘From Content Field’. This works great about 99.98% of the time.

 

The problem: SharePoint allows apostrophes in the naming of items and folders. The XML output of the document set search event will encode the apostrophe in the name of a document as “'”, and the copy action will fail with a “Server was unable to process request … invalid token” error.

 

In the example error below a document set named “Crazy !@$^()_`-=[];’, Characters2” contains two documents “image.jpg” and “Link to crazy !@$^()_`-=[];’, characters1.aspx”. The Search event completes, but the copy event fails with:

 

Server was unable to process request. ---> './Group/Document[ translate(TargetSiteUrl, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' , 'abcdefghijklmnopqrstuvwxyz')='http://webapp.domain.com/managedpath/site' and translate(TargetDocLibName, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' , 'abcdefghijklmnopqrstuvwxyz')='library name' and translate(TargetDocLibFolder, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' , 'abcdefghijklmnopqrstuvwxyz')='crazy !@$^()_`-=[];', characters2' and translate(DocumentName, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' , 'abcdefghijklmnopqrstuvwxyz')='image.jpg' ]' has an invalid token.

 

Has anyone figured out a way around this limitation? Is there another approach altogether that I can use to clone document sets with variable contents?

 

Thank you for any help you can provide!


1 reply

Badge +1

I have narrowed this a little further, and it seems that it’s only happening in this very specific case:

  • The content type of the sub-document is “Link to a Document”
  • The “Name” of the sub-document contains an apostrophe (the URL and Title of the hyperlink can have an apostrophe, but the name cannot)

Reply