microsoftgraph / microsoftgraph/msgraph-beta-sdk-dotnet
Create new ApprovalItem - error response : malformed or incorrect
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 112
- Forks
- 37
- Avg merge
- 14h 57m
- Merged PRs (30d)
- 3
Description
Describe the bug
I submit a new approvalitem. The api response that the message are malformed or incorrect.
The body of the request looks like following json. The problem is that there is an additional odata type information.
{
"allowEmailNotification": true,
"approvalType": "basic",
"approvers": [
{
"@odata.type": "#microsoft.graph.approvalIdentitySet",
"user": {
"displayName": "Alex Wilber",
"id": "9a033c37-4b75-4a89-87f6-8cd7f5b66026"
}
}
],
"description": "Details",
"displayName": "Title of approval 22"
}
Expected behavior
Ignore the odata type by converting the object to a json string
"@odata.type": "#microsoft.graph.approvalIdentitySet",
How to reproduce
var requestBody = new ApprovalItem
{
DisplayName = "Title of approval 22",
Description = "Details",
ApprovalType = ApprovalItemType.Basic,
AllowEmailNotification = true,
AllowCancel = true,
Approvers = new List<ApprovalIdentitySet>
{
new ()
{
User = new Identity
{
Id = "9a033c37-4b75-4a89-87f6-8cd7f5b66026",
DisplayName= "Alex Wilber"
},
}
}
};
var result = await graphBetaClient.Solutions.Approval.ApprovalItems.PostAsync(requestBody)
SDK Version
5.86.0
Latest version known to work for scenario above?
No response
Known Workarounds
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 with the ApprovalItem request construction and the Solutions.Approval.ApprovalItems.PostAsync entry point, then trace how Approvers is serialized into the request body. Reproduce the issue with the supplied example and verify that the generated JSON no longer includes the unwanted @odata.type field.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100