I'm currently trying to make a copy from a specific folder with its sub items.
This is the method that is being used to copy a folder.
public async Task<DriveItem> CopyItem(DriveItem item)
{
var requestBody = new CopyPostRequestBody
{
//ParentReference = new ItemReference
//{
// DriveId = "6F7D00BF-FC4D-4E62-9769-6AEA81F3A21B",
// Id = "DCD0D3AD-8989-4F23-A5A2-2C086050513F",
//},
Name = item.Name + "Copy"
};
var result = await graphClient.Drives[driveID].Items[item.Id].Copy.PostAsync(requestBody);
if (result != null)
{
return result;
}
return null;
}
The original folder and its sub items have assigned roles and permissions. How can i copy the folder and sub items with permissions?
I also tried the copy function of the SharePoint from the web version and issue stands. permissions are not copied to the copied version.
I also wanted to copy the files and folders one by one and read their permissions and apply it accordingly to the copied item. but this would not be the good idea because the files and its folders could be a large amount of items and it would be too many api calls which is not an option for me.
Is this something that should be configured by the company that manages the Sharepoint and its configuration or is it something that i can do in code?
Copy SharePoint (OneDrive) folder including permissions is not supported in either Graph API or SharePoint API.
It requires extra step after copying the folder. I would be aware because a new folder can inherit permissions from a new parent folder.
Just a proposal how to copy permissions (not tested)