c# - Skype for Business 2016 Online 状态的 Lync.Model 参考
问题描述
我的电脑上安装了 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);
这些是 stringval 值= 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();
}
}
}
推荐阅读
- angular - 通过 GitHub 页面托管 Angular 应用程序时出错
- ios - iOS UIWebView - caching assets in native apap
- python - My dataframe returns 0 rows, yet when I use filters on excel spreadsheet the rows are displayed
- ios - 在图表的 PieChartView 中格式化自定义图例条目?
- akka.net - Why is the Akka.Serialization.Hyperion serialization package still in beta?
- algolia - Algolia - Places autocomplete using php api client
- php - 如何在php中进行记录的内部循环
- python - Is there a way to set variables at runtime in python
- mysql - sql多表查询
- android - 生成签名的 apk 后,Android 应用程序崩溃