从C#Asp.net向Lync发送消息

从C#Asp.net向Lync发送消息,c#,asp.net,asp.net-mvc-4,razor,lync,C#,Asp.net,Asp.net Mvc 4,Razor,Lync,我有一个使用sql server的Asp.net应用程序通知系统。当前,当某些表有更新时,会发送电子邮件警报。我想知道,是否有一种方法可以使用Lync而不是电子邮件,这样当表更新时,用户将获得Lync消息?您可以使用Lync client for.Net。以下是链接- 下面是一个示例代码 using Microsoft.Lync.Model; using Microsoft.Lync.Model.Conversation; private static void SendMessage() {

我有一个使用sql server的Asp.net应用程序通知系统。当前,当某些表有更新时,会发送电子邮件警报。我想知道,是否有一种方法可以使用Lync而不是电子邮件,这样当表更新时,用户将获得Lync消息?

您可以使用Lync client for.Net。以下是链接-

下面是一个示例代码

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)
    {

    }
}

您可能希望在此处查看SDK文档: