簡體   English   中英

Skype for Business 2016聯機狀態的Lync.Model參考

[英]Lync.Model reference for Skype for Business 2016 Online Status

我在計算機上安裝了Skype for Business 2016。

我想通過Lync SDK 2013達到其在線狀態。

 static void Main(string[] args)
   {

        var theClient = LyncClient.GetClient();
        Console.WriteLine(theClient.State);

        Console.ReadLine();
   }

我在theClient有我的郵件地址,並且

theClient.State 

 SignedIn

如何使用Lync SDK達到在線/忙碌/忙碌狀態。

謝謝閱讀。

我找到了答案:

從此處下載SDK https://www.microsoft.com/en-gb/download/details.aspx?id=36824

安裝並外觀無法通過Skype for Business 2016安裝Lync 2013 SDK

一個簡單的解決方案是使用7-zip或其他程序解壓縮.exe安裝程序。 解壓縮后,只需運行相應的.msi安裝程序即可。

轉到文件夾:C:\\ Program Files(x86)\\ Microsoft Office 2013 \\ LyncSDK \\ Assemblies \\ Desktop

找到“ Microsoft.Lync.Model.dll”,將“ Microsoft.Lync.Model.dll”添加到項目中作為參考。

如果您想檢查自己的狀態: https : //blog.thoughtstuff.co.uk/2014/08/microsoft-lync-desktop-development-how-to-get-started/

var theClient = LyncClient.GetClient();
Contact self = theClient.Self.Contact;
object obj = self.GetContactInformation(ContactInformationType.Availability);
string stringval=self.GetContactInformation(ContactInformationType.Availability).ToString();

如果您想通過電子郵件檢查其他人的狀態

 Contact contact = theClient.ContactManager.GetContactByUri("xx@example.com");
 object zzz = contact.GetContactInformation(ContactInformationType.Availability);

這些是字符串值= https://rcosic.wordpress.com/2011/11/17/availability-presence-in-lync-client/

Invalid (-1),
None (0) – Do not use this enumerator. This flag indicates that the cotact state is unspecified.,
Free (3500) – A flag indicating that the contact is available,
FreeIdle (5000) – Contact is free but inactive,
Busy (6500) – A flag indicating that the contact is busy and inactive,
BusyIdle (7500) – Contact is busy but inactive,
DoNotDisturb (9500) – A flag indicating that the contact does not want to be disturbed,
TemporarilyAway (12500) – A flag indicating that the contact is temporarily away,
Away (15500) – A flag indicating that the contact is away,
Offline (18500) – A flag indicating that the contact is signed out.

完整代碼(我將其放入計時器中):

using Microsoft.Lync.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Timers;

namespace UserStatus
{
    public class DoThis
    {

        private readonly Timer _timer;
        public DoThis()
        {
            _timer = new Timer(1000 * 2) { AutoReset = true };
            _timer.Elapsed += TimerElapsed;
        }
        private void TimerElapsed(object sender, ElapsedEventArgs e)
        {
            DoThis2();
        }
        public void Start()
        {
            _timer.Start();
        }
        public void Stop()
        {
            _timer.Stop();
        }

        void DoThis2()
        {

            Stop();

            var theClient = LyncClient.GetClient();
            Contact self = theClient.Self.Contact;


            if ((self.GetContactInformation(ContactInformationType.Availability)).ToString() == "6500")
            {
                Console.WriteLine("busy");
            }
            if ((self.GetContactInformation(ContactInformationType.Availability)).ToString() == "3500")
            {
                Console.WriteLine("available");
            }
            if ((self.GetContactInformation(ContactInformationType.Availability)).ToString() == "15500")
            {
                Console.WriteLine("away");
            }

            Start();
        }
    }
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM