发送聊天消息

Send chat message

我有这个代码:

var msg = new ChatMessage();
msg.Body = "Test";
msg.Recipients.Add("number");

var cms = await ChatMessageManager.RequestStoreAsync();
await cms.SendMessageAsync(msg);

我对上面代码的 await 部分有疑问。我得到异常:

Access is denied.

appxmanifest 的能力方面,我 select 编辑了:

Chat Message Access

(我都试了 select,但没用)。 我找不到任何必须满足的样品和要求。

感谢您的帮助。

如果你看一下 at MSDN 你会发现:

This API is not available to all Windows/Windows Phone apps. Unless your developer account is specially provisioned by Microsoft, calls to these APIs will fail at runtime.