CreateLinkPostRequestBody in 6.2.0 defaults RetainInheritedPermissions = false

Open Beginner friendly
#3,165 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

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

Research direction

Start at CreateLinkPostRequestBody and trace how an omitted RetainInheritedPermissions value is represented and serialized for the CreateLink.PostAsync entry point. Reproduce the request without that property, then verify that the resulting behavior retains existing permissions while explicitly setting true or false still works.

Written by the indexing model from the issue text.

Description

status:waiting-for-triage type:bug
Describe the bug

When calling CreateLinkPostRequestBody to create a sharing link and RetainInheritedPermissions is not defined, it defaults to false.

This is the opposite of the behavior listed in the learn article.

Defining RetainInheritiedPermissions true or false operates as expected.

This bug doesn't appear in this repo but it does appear in the Python SDK #1536

Expected behavior

The default behavior should be to retain the items current permissions, ala RetainInheritedPermissions = true.

How to reproduce

var requestBody = new CreateLinkPostRequestBody
{
Type = "view",
Scope = "users",
ExpirationDateTime = DateTime.UtcNow.AddMinutes(10),
Recipients =
[
new() {
Email = "user@domain.com"
}
]
};

await _graph!.Drives[DriveID].Items[DriveItemID].CreateLink.PostAsync(requestBody, cancellationToken: cancellationToken).ConfigureAwait(false) ?? throw new FileNotFoundException();

//Will result in user@domain.com getting access for ten minutes but all other access will be wiped. Adding 'RetainInheritedPermissions = true,' corrects the behavior.

SDK Version

6.2.0

Latest version known to work for scenario above?

No response

Known Workarounds

Define RetainInheritedPermissions when creating a new CreateLinkPostRequestBody

Debug output
Click to expand log ```
</details>


### Configuration

_No response_

### Other information

_No response_
Dominant language
C#
Stars
789
Forks
264
Avg merge
15h 17m
Merged PRs (30d)
3

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.

More from microsoftgraph/msgraph-sdk-dotnet

All issues in microsoftgraph/msgraph-sdk-dotnet

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.