microsoftgraph / microsoftgraph/msgraph-sdk-dotnet
CreateLinkPostRequestBody in 6.2.0 defaults RetainInheritedPermissions = false
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 789
- Forks
- 264
- Avg merge
- 15h 17m
- Merged PRs (30d)
- 3
Description
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_
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
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.
Assessment
- Tech stack
- csharp
- Domain
- api
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 72/100