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

  • Your title says SharePoint 2013 - but the question is tagged as sharepoint-online! Which is it? – Lars Fastrup Nov 26 '19 at 9:42
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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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