Microsoft Graph ChatMessage Namespace Missing in C#

帅比萌擦擦* 提交于 2020-07-09 06:09:10

问题


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?


回答1:


In order to call into the Beta version of Microsoft Graph (i.e. /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 (i.e. /v1.0/...).



来源:https://stackoverflow.com/questions/58913955/microsoft-graph-chatmessage-namespace-missing-in-c-sharp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!