作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我们有一个外部 ASP.NET 4.7 应用程序(在 Azure 应用程序服务中),它应该将消息/卡片发送给团队中的一个特定用户(没有机器人)。
我设法通过连接器/WebHook 将卡片发送到 channel ,但无法针对特定用户。
我该怎么做/需要哪些服务?
请尽可能简单 :-)
谢谢
==========================
更新:示例代码:
Private Shared Sub SendToTeams(ChannelPath As AppSettingsKey, Card As TeamsCard)
If String.IsNullOrWhiteSpace(ChannelPath) Then Return
Dim Channel = AppSettings.GetAppSetting(ChannelPath)
If String.IsNullOrWhiteSpace(Channel) Then Return
Dim ChannelWebHook = "https://outlook.office.com"
Dim Client = New RestClient(ChannelWebHook)
Dim Req = New RestRequest(Method.POST) With {
.Resource = Channel,
.RequestFormat = DataFormat.Json
}
Dim JSON = Card.SaveJSON(False)
Req.AddParameter("application/json; charset=utf-8", JSON, ParameterType.RequestBody)
Dim Erg = Client.Execute(Req)
Logger.Info("Teams:", Erg.StatusCode)
End Sub
还有一些助手:
Friend Class TeamsCard
<JsonProperty(PropertyName:="@context")> Public Property context As String = "https://schema.org/extensions"
<JsonProperty(PropertyName:="@type")> Public Property type As String = "MessageCard"
Public Property themeColor As String = "ff6100"
Public Property title As String = "Title"
Public Property summary As String = "Summary"
Public Property text As String = "Text"
Public Property potentialAction As New List(Of TeamsCardAction)
End Class
Friend Class TeamsCardAction
<JsonProperty(PropertyName:="@type")> Public Property type As String = "OpenUri"
Public Property name As String = "ButtonText"
Public Property targets As New List(Of TeamsCardButtonTarget)
Public Sub New(Text As String, URI As String)
name = Text
targets.Add(New TeamsCardButtonTarget With {.uri = URI})
End Sub
End Class
Friend Class TeamsCardButtonTarget
Public Property os As String = "default"
Public Property uri As String = "https://google.com"
End Class
最佳答案
关于asp.net - 微软团队 : How to send a Message/Card to a User from an external App without an Bot,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54252789/
我是一名优秀的程序员,十分优秀!