-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to patch TrustFrameworkPolicy #883
Comments
Thanks for raising this @greiggs Does this work if you do this instead when creating the request information object? According to the docs the right way to update is using a RequestInformation requestInformation = graphServiceClient.TrustFramework.Policies["policyId"].Content.ToPutRequestInformation(data.ToStream());
requestInformation.Headers.Add("Content-Type", "application/xml"); // metadata sets the content type as octet-stream |
@andrueastman Yes this worked thank you. Can I ask if the approach (below) I am using to add is the correct way to do this or is there a simpler way as this seems overly complex? Also is there any documentation in how to use the SDK as I have had trouble trying to convert what the API requires into how the SDK works? RequestInformation requestInformation = graphServiceClient.TrustFramework.Policies.ToPostRequestInformation(new() { Id = policyId, });
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); |
No description provided. |
Thanks for confirming this @greiggs The Graph documentation typically should have examples on how to make calls using the SDK. See example at However, this API seems to be an edge case as the API metadata that is provided by the API team that is used to generate the SDK is incorrect. Specifically, it does not describe that the endpoint expects var result = await graphServiceClient.TrustFramework.Policies["policyId"].Content.PutAsync(data.ToStream()); To fully resolve this we probably need to
Hope this helps make things clearer. |
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:
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
```The text was updated successfully, but these errors were encountered: