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?
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.
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 <m:Stream>base64Binary</m:Stream> 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>
<m:SourceUrl>{Common:ItemUrl}</m:SourceUrl>
<m:DestinationUrls>
<m:string>{WorkflowVariable:varDestinationUrl}</m:string>
</m:DestinationUrls>
<m:Fields></m:Fields>
<m:Stream>base64Binary</m:Stream>
</m:CopyIntoItems>
</soap:Body>
</soap:Envelope>
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?
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 <m:String> element of the <m:DestinationUrls> node like so:
<m:DestinationUrls>
<m:string>{WorkflowVariable:varDestinationUrl}{ItemProperty:FileLeafRef}</m:string>
</m:DestinationUrls>
Hope this helps!