简体   繁体   中英

Microsoft Graph ChatMessage Namespace Missing in C#

I'm following the Microsoft Graph tutorial to create and send a chat message to a Microsoft Teams channel from C#.

However, I'm getting an error when following the first example when trying to create a ChatMessage object. ( var chatMessage = new ChatMessage... ) The error is:

The type or namespace name 'ChatMessage' could not be found (are you missing a using directive or assembly reference?)

I've added the following references to my project already but none of them seem to contain the ChatMessage class definition:

  • Microsoft.Graph
  • Microsoft.Graph.Core
  • Microsoft.Graph.Auth

The ChatMessage documentation gives me a little more information on the ChatMessage resource type but doesn't tell me where I should get it from.

The only other thing I've found is Windows.ApplicationModel.Chat.ChatMessage , but I can't find windows.applicationmodel.chat in Nuget, and I'm not sure if this is actually correct as there's no mention of it on the Graph tutorial page.

What am I doing wrong to be able to use the ChatMessage object in the tutorial?

In order to call into the Beta version of Microsoft Graph (ie /beta/... ), you need to use the Microsoft.Graph.Beta NuGet package, not the Microsoft.Graph package. The later only contains APIs that have been released (ie /v1.0/... ).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM