Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sharepoint: move folder with subfolders (new feature) #281

Open
Pedrolo opened this issue May 10, 2022 · 0 comments
Open

Sharepoint: move folder with subfolders (new feature) #281

Pedrolo opened this issue May 10, 2022 · 0 comments

Comments

@Pedrolo
Copy link

Pedrolo commented May 10, 2022

After trying to make it work for hours, I have finally been able to move an entire folder (with subfolders and files).

It is a method that shall be added to src/Sharepoint/MoveCopyUtil.php:

function moveFolder($context, $srcUrl, $destUrl, $options){
        $util = new MoveCopyUtil($context);
        $qry = new InvokePostMethodQuery($util, "MoveFolderByPath", null, null,
            array("srcPath" => new ResourcePath($srcUrl), "destPath" => new ResourcePath($destUrl), "options" => $options));
        $qry->IsStatic = true;
        $context->addQuery($qry);
        return $util;
    }

It needs a new class extending SPResourcePath to make it work, as using SPResuorcePath sends a metadata SP.SPResourcePath instead of SP.ResourcePath:

use Office365\SharePoint\SPResourcePath;

class ResourcePath extends SPResourcePath{}

Please consider including it.

@Pedrolo Pedrolo changed the title move Folder Sharepoint: move folder with subfolders (new feature) May 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants