microsoft-graph-devx-api
microsoft-graph-devx-api copied to clipboard
Complex open type non-existent property should show up in AdditionalData
Source: https://docs.microsoft.com/en-us/graph/api/channel-post-messages?view=graph-rest-beta&tabs=csharp#request-1
Input:
POST https://graph.microsoft.com/beta/teams/57fb72d0-d811-46f4-8947-305e6072eaa5/channels/19:[email protected]/messages
Content-type: application/json
{
"createdDateTime":"2019-02-04T19:58:15.511Z",
"from":{
"user":{
"id":"id-value",
"displayName":"Joh Doe",
"userIdentityType":"aadUser"
}
},
"body":{
"contentType":"html",
"content":"Hello World"
}
}
Erroneous output:
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var chatMessage = new ChatMessage
{
CreatedDateTime = DateTimeOffset.Parse("2019-02-04T19:58:15.511Z"),
From = new ChatMessageFromIdentitySet
{
User = new Identity
{
Id = "id-value",
DisplayName = "Joh Doe",
UserIdentityType = TeamworkUserIdentityType.AadUser
}
},
Body = new ItemBody
{
ContentType = BodyType.Html,
Content = "Hello World"
}
};
await graphClient.Teams["{team-id}"].Channels["{channel-id}"].Messages
.Request()
.AddAsync(chatMessage);
Expected output:
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var chatMessage = new ChatMessage
{
CreatedDateTime = DateTimeOffset.Parse("2019-02-04T19:58:15.511Z"),
From = new ChatMessageFromIdentitySet
{
User = new Identity
{
Id = "id-value",
DisplayName = "Joh Doe",
AdditionalData = new Dictionary<string, object>()
{
{"userIdentityType", "aadUser"}
}
}
},
Body = new ItemBody
{
ContentType = BodyType.Html,
Content = "Hello World"
}
};
await graphClient.Teams["{team-id}"].Channels["{channel-id}"].Messages
.Request()
.AddAsync(chatMessage);
Related references: https://docs.microsoft.com/en-us/graph/api/channel-post-messages?view=graph-rest-beta&tabs=http#request-2
- https://docs.microsoft.com/en-us/graph/api/chatmessage-post-replies?view=graph-rest-beta&tabs=http#request-1
Similar reference where identityset doesnt nest additional data: https://docs.microsoft.com/en-us/graph/api/shift-put?view=graph-rest-1.0&tabs=http#request
Fixed for C# in SDK v5. Still an issue for Java.