Copy File from a Different Site Collection or Farm

  • 10 June 2020
  • 1 reply
  • 11 views

Badge +2

I have a list in the destination site collection. when I change am item, I have to copy a file from a different farm into a document library which is on the same site collection where the list is, so In my web service action, COPY.asmx is from the source site but workflow in running on the destination site collection.

 

I am getting <CopyResult ErrorCode="Unknown" ErrorMessage="Object reference not set to an instance of an object." DestinationUrl="http://destination_site_col/Shared%20Documents/myfile.pdf" />
</Results>
</CopyIntoItemsLocalResponse>

 

If I change the authentication and use my own login, I get

 

<CopyResult ErrorCode="DestinationInvalid" ErrorMessage="Cannot create an item at the requested destination. Verify that the folder exists and that you have permission to edit in it." DestinationUrl="http://destination_site_col/Shared%20Documents/myfile.pdf" />
</Results>
</CopyIntoItemsLocalResponse>

 

8106iB38DDB8D01DF8B4C.png


1 reply

Badge +2

I have fixed it, I used GetItem method of Copy.asmx web service, got the stream in a variable and then used CopyIntoItemsLocal method of the Copy.asmx web service and passed stream in SOAP request.

 

So, It does not matter what your source and destination is, it could be a different web application or a totally different farm.

Reply