1

I need to create SharePoint 2019 functionality similar to what the Move and Copy Options in the old Site Manager ("Site Contents and Structure) did, i.e. move or copy pages or documents to another page/document library, while retaining the history of the files, updating the backward links, etc.

In SharePoint Online there are the Move To and Copy To buttons available, which use the CSOM/REST CreateCopyJobs API to accomplish that (at least the copy and move part...) and I was able to programmatically move files using that API.

This API is also available on-premise, but I can't get it to work. Not with SSOM, CSOM or REST.

Is it supposed to work on-premise?

And if yes, is there anything that I need to look out for to get it to work?

1 Answer 1

0

OK...after decompiling the 2019 version of the Microsoft.SharePoint.dll and checking the code for SPSite.CreateCopyJobs I now know why it doesn't work:

    private SPCopyMigrationInfo CreateCopyJobInternal(Uri[] exportObjectUris, Uri destinationUri, SPCopyMigrationOptions options, Guid correlationId, bool? runOnFE, long totalBytes = 0L)
    {
        throw new InvalidOperationException();
    }

    [Obsolete("Use CreateCopyJobs instead")]
    [ClientCallableMethod]
    public SPCopyMigrationInfo CreateCopyJob(Uri[] exportObjectUris, Uri destinationUri, SPCopyMigrationOptions options)
    {
        throw new InvalidOperationException();
    }

    [ClientCallableMethod]
    public List<SPCopyMigrationInfo> CreateCopyJobs(Uri[] exportObjectUris, Uri destinationUri, SPCopyMigrationOptions options)
    {
        throw new InvalidOperationException();
    }

No further comment...

Your Answer

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

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