在 Powershell 中获取 Skype for Business 用户状态/可用性问题 [英] Get Skype for Business User Status/Availability issue in Powershell

查看:95
本文介绍了在 Powershell 中获取 Skype for Business 用户状态/可用性问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 powershell 通过以下代码获取某些用户的状态/可用性:

I'm using powershell to get the Status/Availability of certain users by using the following code:

Import-Module "C:\...\Microsoft.Lync.Model.dll"

$Client = [Microsoft.Lync.Model.LyncClient]::GetClient()

$Contact = $Client.ContactManager.GetContactByUri( $args[0] )
Write-Host $Contact.GetContactInformation("Activity")

假设我将 testuser@testcompany.com 作为脚本参数传入.

Let's say I'm passing in testuser@testcompany.com as the script argument.

如果我运行这个脚本,它会返回Presence unknown".但是,如果我手动打开 Skype 客户端并搜索用户,那么我可以看到他们的可用性(假设此用户设置为可用).

If I run this script, it will return "Presence unknown". However, if I open up the Skype client manually and search for the user, I can see their availability then (let's say this user is set to Available).

现在,如果我在 Skype 中搜索脚本后再次运行脚本,脚本将通过将Available"打印到控制台来返回正确的结果.该脚本将不断返回正确的结果,直到我重新启动 Skype.此时,它将再次返回状态未知",直到我在 Skype 中搜索用户.

Now, if I run my script again now after I've searched for them in Skype, the script will return the proper result by printing "Available" to the console. The script will continuously return the proper result until I restart Skype. At the point, it will return "Presence unknown" again until I search for the user in Skype.

如果用户在我的 Skype 最近对话中,而我只是查看我的最近对话"选项卡而不是搜索它们,这就足以让脚本开始返回正确的结果.

If the user is in my Recent Conversations in Skype and I simply view my Recent Conversations tab rather than searching for them, that is enough to have the script start returning the proper result.

在从我的客户端手动加载到缓存(?)之前,它似乎无法查询它们的可用性.知道为什么会发生这种情况,或者我如何在不先手动搜索用户的情况下让它返回正确的结果?

It would appear as though it is unable to query their availability until it is manually loaded into cache(?) from my client. Any idea why this would possibly happen or how I can have it return the proper results without manually searching for the user first?

推荐答案

看来您必须订阅用户状态信息.Lync SDK MSDN 文档在 https://msdn.microsoft 上概述了解决方案.com/en-us/library/office/jj937284.aspx.

Looks like you have to subscribe to user presence information. Lync SDK MSDN documentation has outlined the solution at https://msdn.microsoft.com/en-us/library/office/jj937284.aspx.

https://social.msdn.microsoft.com/Forums/en-US/12357db7-769f-4808-bc99-9b2fb2ed8ce2/presence-unknown?forum=communicatorsdk

这篇关于在 Powershell 中获取 Skype for Business 用户状态/可用性问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆