从 C# 向 Lync 发送消息 Asp.net
Sending a message to Lync from C# Asp.net
我的 Asp.net 应用程序有一个使用 sql-server 的通知系统。目前,当某些表有更新时,会发送电子邮件警报。我想知道,是否有一种方法可以使用 Lync 而不是电子邮件,以便在更新表时用户将收到 Lync 消息?
您可以使用 .Net 的 Lync 客户端。这是 link- https://code.msdn.microsoft.com/lync/Lync-2013-Use-the-Lync-47ded7b4
下面是示例代码。
using Microsoft.Lync.Model;
using Microsoft.Lync.Model.Conversation;
private static void SendMessage()
{
try
{
string[] arrRecepients = { "sip:receiver1@domain.com", "sip:receiver2@domain.com" }; //add your recepients here
LyncClient lyncClient = LyncClient.GetClient();
Conversation conversation = lyncClient.ConversationManager.AddConversation();
foreach (string recepient in arrRecepients)
{
conversation.AddParticipant(lyncClient.ContactManager.GetContactByUri(recepient));
}
InstantMessageModality imModality = conversation.Modalities[ModalityTypes.InstantMessage] as InstantMessageModality;
string message = GetNotification(); //use your existing notification logic here
imModality.BeginSendMessage(message, null, null);
}
catch (Exception ex)
{
}
}
我的 Asp.net 应用程序有一个使用 sql-server 的通知系统。目前,当某些表有更新时,会发送电子邮件警报。我想知道,是否有一种方法可以使用 Lync 而不是电子邮件,以便在更新表时用户将收到 Lync 消息?
您可以使用 .Net 的 Lync 客户端。这是 link- https://code.msdn.microsoft.com/lync/Lync-2013-Use-the-Lync-47ded7b4
下面是示例代码。
using Microsoft.Lync.Model;
using Microsoft.Lync.Model.Conversation;
private static void SendMessage()
{
try
{
string[] arrRecepients = { "sip:receiver1@domain.com", "sip:receiver2@domain.com" }; //add your recepients here
LyncClient lyncClient = LyncClient.GetClient();
Conversation conversation = lyncClient.ConversationManager.AddConversation();
foreach (string recepient in arrRecepients)
{
conversation.AddParticipant(lyncClient.ContactManager.GetContactByUri(recepient));
}
InstantMessageModality imModality = conversation.Modalities[ModalityTypes.InstantMessage] as InstantMessageModality;
string message = GetNotification(); //use your existing notification logic here
imModality.BeginSendMessage(message, null, null);
}
catch (Exception ex)
{
}
}