0

I am trying to move/copy a folder from one location to another location it is giving me an error

Object reference not set to an instance of an object

but it is working fine with File.

I am using SOAP API copyIntoItems() function

copyService.copyIntoItems(sourceUrl, destinationUrl, fieldInformationCollection, fileContent, hld,result);

but in this API we compulsory need to pass file content(data blob) but I have an empty folder that I have to copy/move

1
  • Your title says SharePoint 2013 - but the question is tagged as sharepoint-online! Which is it? Commented Nov 26, 2019 at 9:42

1 Answer 1

1

You cannot copy folders from one location to another using Copy.CopyIntoItems - this method copies a document represented by a Byte array to one or more locations on a server. For more information, refer Copy.CopyIntoItems method.

A new utility class Microsoft.SharePoint.Client.MoveCopyUtil is available on the latest version of the O365 Microsoft.SharePoint.Client.dll

Microsoft.SharePoint.Client.MoveCopyUtil has the following functions:

public static void MoveFile(ClientRuntimeContext context, string srcUrl, string destUrl)
public static void CopyFile(ClientRuntimeContext context, string srcUrl, string destUrl)
public static void MoveFolder(ClientRuntimeContext context, string srcUrl, string destUrl)
public static void CopyFolder(ClientRuntimeContext context, string srcUrl, string destUrl)

for more information refer MoveCopyUtil.CopyFolderByPath method

4
  • thank you I'll check for the same Commented Nov 26, 2019 at 4:34
  • where I will get the MoveCopyUtil? because I have to generate Stub from WSDL Commented Nov 26, 2019 at 5:11
  • Microsoft.SharePoint.Client.dll check in this dll Commented Nov 26, 2019 at 7:30
  • I have tried but I didn't find any WDSL Commented Nov 27, 2019 at 10:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.