microsoftgraph / msgraph-sdk-serviceissues

Tracks service issues for follow up.
5 stars 0 forks source link

Mention a team or channel in teams conversation #64

Closed KeyserDSoze closed 2 years ago

KeyserDSoze commented 3 years ago

Describe the bug It's not possible to add a mention to a team or channel because the identityset model misses the object Identity Conversation. In the graph api we need to send the conversation parameter in json to mention a team or channel. Probably the problem is in the metadata file https://graph.microsoft.com/v1.0/$metadata

To Reproduce Steps to reproduce the behavior:

  1. Use the method AddAsync to send a message
  2. For instance Client.Teams[Teams.Id.ToString()].Channels[Teams.Principal.Id].Messages.Request().AddAsync
  3. and it's clear that it's not possible to find in Mentions the needed parameter Conversation, furthermore in Identity object I don't have the ConversationIdentityType that it's another needed parameter to allow the tagging of a team or channel on teams
  4. new ChatMessage { Body = new ItemBody { Content = $"{body}
    <at id=\"0\">{Teams.Name}
    ", ContentType = BodyType.Html }, Subject = subject, Importance = ChatMessageImportance.High, Mentions = new List { new ChatMessageMention { Id = 0, MentionText = Teams.Name, Mentioned = new IdentitySet { Conversation = new Identity { Id = Teams.Id.ToString(), DisplayName = Teams.Name, ConversationIdentityType = "team" } } } }

Expected behavior Adding the needed parameters. My actual solution has been a sort of "decoration" private class ConversationIdentitySet : IdentitySet { ///

/// Gets or sets user. /// Optional. The user associated with this action. /// [JsonProperty(NullValueHandling = NullValueHandling.Ignore, PropertyName = "conversation", Required = Required.Default)] public Identity Conversation { get; set; } } private class TeamsIdentity : Identity { public TeamsIdentity() : base() { } /// /// Gets or sets @odata.type. /// [JsonProperty(NullValueHandling = NullValueHandling.Ignore, PropertyName = "conversationIdentityType", Required = Newtonsoft.Json.Required.Default)] public string ConversationIdentityType { get; set; } }

Screenshots image image image

Desktop (please complete the following information):

Additional context No additional context AB#8652

MIchaelMainer commented 3 years ago

This looks like we need to update the v1.0 documentation and metadata. @nkramer can you take a look at this and confirm that we need to update the v1.0 documentation and metadata to contain a description of ConversationIdentitySet? It is defined in beta.

https://docs.microsoft.com/en-us/graph/api/resources/identityset?view=graph-rest-beta

AkJo commented 2 years ago

This issue seems to be really old. I am not sure if this is applicable any more. The schema for chatMessageMention type and associated types is:

<ComplexType Name="chatMessageMention">
<Property Name="id" Type="Edm.Int32"/>
<Property Name="mentioned" Type="graph.chatMessageMentionedIdentitySet"/>
<Property Name="mentionText" Type="Edm.String"/>
</ComplexType>

<ComplexType Name="chatMessageMentionedIdentitySet" BaseType="graph.identitySet" OpenType="true">
<Property Name="conversation" Type="graph.teamworkConversationIdentity"/>
</ComplexType>

<ComplexType Name="teamworkConversationIdentity" BaseType="graph.identity" OpenType="true">
<Property Name="conversationIdentityType" Type="graph.teamworkConversationIdentityType"/>
</ComplexType>

All of these are documented in both beta and v1.

andrueastman commented 2 years ago

Thanks @AkJo!

Closing this for now as the types are already available in the latest v1.0 SDK versions

ChatMessageMention ChatMessageMentionedIdentitySet TeamworkConversationIdentity