繁体   English   中英

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

[英]Sending a message to Lync from C# Asp.net

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

您可以将 Lync 客户端用于 .Net。 这是链接 - 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)
    {

    }
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM