microsoftgraph / microsoftgraph/msgraph-sdk-dotnet

CustomDriveItemItemRequestBuilder doesn't delete Permissions

Open
#2,258 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug P2 Question: SDK
Dominant language
C#
Stars
789
Forks
264
Avg merge
15h 17m
Merged PRs (30d)
3

Description

The CustomDriveItemItemRequestBuilder doesn't do what DriveItemItemRequestBuilder can do.

Ex:

        var site = $"{options.Host}:/sites/{options.SiteName}";
        _site ??= await graphServiceClient.Sites[site].GetAsync();
        var drive = await graphServiceClient.Sites[_site?.Id].Drive.GetAsync();
        var item = await graphServiceClient.Drives[drive?.Id].Root.ItemWithPath(root + path).GetAsync();

        DriveItemItemRequestBuilder folder = await graphServiceClient.Drives[drive?.Id].Items[item?.Id];

        await folder.Permissions[permission.Id].DeleteAsync();

With permission.Id being gotten from Graph API already (with value of like YzowdC5jfHRlbmFubHwtPYFxNWQwNi04NjDzLTRkNzctOWY4OS2mM1JmDMNMIWEzM2P works fine, but

        var site = $"{options.Host}:/sites/{options.SiteName}";
        _site ??= await graphServiceClient.Sites[site].GetAsync();
        var drive = await graphServiceClient.Sites[_site?.Id].Drive.GetAsync();

        CustomDriveItemItemRequestBuilder folder = graphServiceClient.Drives[drive?.Id].Root.ItemWithPath(root + path);

        await folder.Permissions[permission.Id].DeleteAsync();

doesn't work (ODataError : Item not found).

I expect DriveItemItemRequestBuilder to work the same as CustomDriveItemItemRequestBuilder as the only difference in being able to get one of these types is whether when getting a drive item, ItemWithPath() or Items[item.Id] is used and Permissions.DeleteAsync() exists on both.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing CustomDriveItemItemRequestBuilder created through Root.ItemWithPath with DriveItemItemRequestBuilder created through Items[item.Id], focusing on the Permissions[permission.Id].DeleteAsync() request. Reproduce the ODataError: Item not found case and determine why the two builders address permissions differently; done means the path-based builder deletes the existing permission consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.