Unable to patch TrustFrameworkPolicy
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
Start by reproducing the request through graphServiceClient.TrustFramework.Policies[policyId] and inspect ToPatchRequestInformation alongside the TrustFramework Policies API operation. Verify whether the SDK should issue PUT or PATCH and confirm the resulting URI and method against the reported cpim.windows.net error. Done means the SDK request reaches the policy endpoint successfully and the reproduction completes without the controller or resource error.
Written by the indexing model from the issue text.
Description
Describe the bug
I am trying to write an automated system for adding and patching TrustFramework Policies using Microsoft.Identity.Web.GraphServiceClientBeta version 3.0.1 which is using Microsoft.Graph.Beta 5.78.0-preview.
I have successfully added a policy from the code provided by: Github msgraph-beta-sdk-dotnet issue 734 but I am unable to patch as it throws the following error:
No HTTP resource was found that matches the request URI 'https://cpim.windows.net/graph/trustFramework/policies('B2C_1A_TEST_01')'.","messageDetail":"No action was found on the controller 'trustframework' that matches the request.
Expected behavior
To patch a B2C Policy using the SDK. From looking at the api it indicates it should be a Put and not a Patch but there is no appropriate RequestInformation method on the graphServiceClient.TrustFramework.Policies[policyId] object.
How to reproduce
Run the following code:
Where:
- data: is a BinaryData object of the xml policy file.
- graphServiceClient: is a Beta.GraphServiceClient.
- policyId: is 'B2C_1A_TEST_01'
TrustFrameworkPolicyCollectionResponse? response = await graphServiceClient.TrustFramework.Policies.GetAsync();
TrustFrameworkPolicy? existingPolicy = response?.Value?.Where(x => x.Id == policyId).FirstOrDefault();
if (existingPolicy != null) {
RequestInformation requestInformation = graphServiceClient.TrustFramework.Policies[policyId].ToPatchRequestInformation(existingPolicy);
requestInformation.SetStreamContent(data.ToStream(), "application/xml");
requestInformation.Headers.Add("Content-Type", "application/xml");
Dictionary<string, ParsableFactory<IParsable>> errorMapping = new()
{
{"4XX", ODataError.CreateFromDiscriminatorValue},
{"5XX", ODataError.CreateFromDiscriminatorValue},
};
}
await graphServiceClient.RequestAdapter.SendNoContentAsync(requestInformation, errorMapping, cancellationToken);
SDK Version
5.78.0-preview
Latest version known to work for scenario above?
No response
Known Workarounds
No response
Debug output
Click to expand log
```</details>
### Configuration
_No response_
### Other information
_No response_
- Dominant language
- C#
- Stars
- 112
- Forks
- 37
- Avg merge
- 14h 57m
- Merged PRs (30d)
- 3
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.
More from microsoftgraph/msgraph-beta-sdk-dotnet
-
status:waiting-for-triage type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
status:waiting-for-triage type:bug
Difficulty 4/5 3-5 days Newbie friendliness 42/100
-
status:waiting-for-triage type:bug
Difficulty 4/5 3-5 days Newbie friendliness 35/100
microsoftgraph/msgraph-beta-sdk-dotnet#1155 · 1 comment ·
-
status:waiting-for-triage type:feature
Difficulty 4/5 3-5 days Newbie friendliness 45/100
microsoftgraph/msgraph-beta-sdk-dotnet#1129 · 1 reaction ·
-
.NET
Difficulty 3/5 1-2 days Newbie friendliness 25/100
All issues in microsoftgraph/msgraph-beta-sdk-dotnet
Similar issues
-
type/automation type/tech-debt
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
t/bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
ci-failure-cause test-failure
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
area:auth FE mvp P3
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
klasolsson81/jobbliggaren#1788 ·