Unable to create TrustFrameworkPolicy
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 25/100
- Issue type
- Bug
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- azure, csharp
- Domain
- api, authentication
Research direction
Start by reproducing the TrustFramework.Policies create flow using TrustFrameworkPolicyRequestBuilder and the PostAsync example, then inspect the request content type and body against the linked Microsoft Graph API documentation. Confirm whether the SDK can create a policy without XML content and define the expected behavior for the create and $value upload calls.
Written by the indexing model from the issue text.
Description
I'm trying to manage my Azure B2C policies with the graph API using the beta sdk but i'm unable to create a TrustFrameworkPolicy from scratch. Using SDK v4 4.74.0-preview
var policyResult = await graphClient.TrustFramework.Policies.Request().AddAsync(policy);
The above line errors with "The policy being uploaded is not XML or is not correctly formatted: Data at the root level is invalid. Line 1, position 1."
This is weird because there is no XML involved. There's no way to specifiy the TrustFrameworkPolicyContent at this stage.
According to the docs the Content-Type should be set to "application/xml" for a "create" request.
I tried the following :
var policiesRequestBuilder = graphClient.TrustFramework.Policies;
var policiesUrl = policiesRequestBuilder.RequestUrl;
var policiesBuilder = new TrustFrameworkPolicyRequestBuilder(policiesUrl, graphClient);
var policyRequest = policiesBuilder.Request();
policyRequest.ContentType = "application/xml";
var policyResult = await policyRequest.CreateAsync(policy);
var policyContentRequestBuilder = graphClient.TrustFramework.Policies[policyResult.Id];
var policyUrl = policyContentRequestBuilder.AppendSegmentToRequestUrl("$value");
var policyContentBuilder = new TrustFrameworkPolicyContentRequestBuilder(policyUrl, graphClient);
var policyContentResult = await policyContentBuilder.Request().PutAsync(stream);
Still the same error occurs.
Is this a bug or am I using the functionality the wrong way...
UPDATE:
I upgraded to 5.49.0 and i still get the same error.
TrustFrameworkPolicy policy = new()
{
Id ="TEST"
};
var policyResult = await graphClient.TrustFramework.Policies.PostAsync(policy, requestConfiguration =>
{
requestConfiguration.Headers.Add("content-type", "application/xml");
});
- 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 ·