问题描述
我正在关注 Microsoft Graph教程,用于创建聊天消息并从C#发送聊天消息到Microsoft Teams频道.
I'm following the Microsoft Graph tutorial to create and send a chat message to a Microsoft Teams channel from C#.
但是,尝试创建ChatMessage
对象时,遵循第一个示例时出现错误. (var chatMessage = new ChatMessage...
)错误是:
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:
我已经在我的项目中添加了以下引用,但是它们似乎都不包含ChatMessage
类定义:
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
Microsoft.Graph
Microsoft.Graph.Core
Microsoft.Graph.Auth
ChatMessage文档为我提供了有关ChatMessage
资源类型的更多信息,但没有告诉我应该从哪里获得.
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.
我发现的唯一其他内容是 Windows.ApplicationModel.Chat.ChatMessage
,但是我在Nuget中找不到windows.applicationmodel.chat
,我不确定这是否正确,因为在Graph教程页面上没有提及它.
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.
能够在本教程中使用ChatMessage
对象是什么意思?
What am I doing wrong to be able to use the ChatMessage
object in the tutorial?
推荐答案
为了调用Microsoft Graph的Beta版本(即/beta/...
),您需要使用 Microsoft.Graph.Beta NuGet包, not Microsoft.Graph 软件包.后者仅包含已发布的API(即/v1.0/...
).
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/...
).
这篇关于C#中缺少Microsoft Graph ChatMessage命名空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!