cancel
Showing results for 
Search instead for 
Did you mean: 
Workflow Hero

copy.asmx and CopyIntoItemsLocal

Hello,
I'm trying to create web service cal to copy one item from Document Library to another Document Library on the same site.

Web service call looks like this:

I'm using CopyIntoItemsLocal method as destination is in the Document library folder. When running I get following error:

<CopyResult ErrorCode="Unknown" ErrorMessage="Object reference not set to an instance of an object." DestinationUrl="xxx/sites/sfvd/DraftLibrary/Folder/Filename.pdf" />

Any ideas how to copy this document?

Labels: (1)
0 Kudos
Reply
4 Replies
Workflow Hero

Re: copy.asmx and CopyIntoItemsLocal

Marek Skalinski‌, did you ever get this resolved?  If not, how are you setting your variables for the source and destination?  I just posted a working example here. See if that helps. 

0 Kudos
Accept as Solution Reply
Workflow Hero

Re: copy.asmx and CopyIntoItemsLocal

I was getting the same error.  I had to add the <m:Fields> node with no elements even though I wasn't passing any additional fields.  I also added the <mSmiley Frustratedtream>base64Binary</mSmiley Frustratedtream> element to my soap message and mine works fine now.  See below:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:m="http://schemas.microsoft.com/sharepoint/soap/">
<soap:Header></soap:Header>
<soap:Body>
<m:CopyIntoItems>
<mSmiley FrustratedourceUrl>{Common:ItemUrl}</mSmiley FrustratedourceUrl>
<mSmiley Very HappyestinationUrls>
<m:string>{WorkflowVariable:varDestinationUrl}</m:string>

</mSmiley Very HappyestinationUrls>
<m:Fields></m:Fields>
<mSmiley Frustratedtream>base64Binary</mSmiley Frustratedtream>
</m:CopyIntoItems>
</soap:Body>
</soap:Envelope>

0 Kudos
Accept as Solution Reply
Workflow Hero

Re: copy.asmx and CopyIntoItemsLocal

Hi Kevin,

Thanks, how the values of these looks like 

{Common:ItemUrl} :  https://siteurl/Lists/List1/DispForm.aspx?ID=1

{WorkflowVariable:varDestinationUrl} https://siteurl/Lists/List2/

is it correct?

0 Kudos
Accept as Solution Reply
Workflow Hero

Re: copy.asmx and CopyIntoItemsLocal

Hi Vijay,

In my case the {Common:ItemUrl} is a link to the actual document and looks like this:

http://sharepointsite/doclibname/document.ext

I also found that I needed to append {ItemProperty:FileLeafRef} to the <mSmiley Frustratedtring> element of the <mSmiley Very HappyestinationUrls> node like so:

<mSmiley Very HappyestinationUrls>
    <m:string>{WorkflowVariable:varDestinationUrl}{ItemProperty:FileLeafRef}</m:string>

</mSmiley Very HappyestinationUrls>

Hope this helps!

Accept as Solution Reply