c# - 无法从 Lync 2013 sdk 获取可用的音频设备

标签 c# lync lync-client-sdk lync-2013

当我尝试像这样获取可用音频设备的列表时。

LyncClient client = LyncClient.GetClient();
foreach (Device dev in client.DeviceManager.AudioDevices)
{
      //Do something
}

我得到错误Exception has been throwed by the target of an invocation.

"Unable to cast COM object of type 'System.__ComObject' to interface type 
'Microsoft.Office.Uc.IAudioDevice2'. This operation failed because the QueryInterface 
call on the COM component for the interface with IID '{86B3E5FE-4635-4C1E-
A725-C80B71D04984}' failed due to the following error: No such interface supported 
(Exception from HRESULT: 0x80004002 (E_NOINTERFACE))."

这是堆栈跟踪

at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
at Microsoft.Lync.Model.Internal.UCWCache.CreateUCW(Object source, CCOMInfo ccomInfo)
at Microsoft.Lync.Model.Internal.UCWCache.GetITTargetNS(Object source)
at Microsoft.Lync.Model.Internal.UCEnumerator`2.get_Current()
at Microsoft.Lync.Model.Internal.UCEnumerator`2.System.Collections.Generic.IEnumerator<S>.get_Current()

以及内部异常堆栈跟踪

at Microsoft.Lync.Model.Device.AudioDevice.INTERNAL_Init(IAudioDevice initInterface)
at Microsoft.Lync.Model.Device.AudioDevice.INTERNAL_Init_Object(Object initInterface)

最佳答案

您是否检查过 Lync 和您的 SDK 是否具有相同的版本号?

Lync 2013好像有很多版本,而且不一定是同一个版本。

关于c# - 无法从 Lync 2013 sdk 获取可用的音频设备,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19389953/

相关文章:

c# - 检测从数组中单击了哪个按钮

c# - 将数据集对象保存到 XML

c# - 从应用程序打开 Lync 聊天

windows - 注销时更改 Lync 状态

msn - 如何从 Windows Live Messenger 向 MS Lync 用户发送消息?

c# - 在 C#.net 中调用 PrintQueue.Pause() 方法时拒绝访问

c# - 数组在 foreach 循环中未正确初始化

audio - Lync 2013 SDK-当 “Join meeting audio from”设置设置为 “Do not join audio”时,加入 session 并连接AVModality

.net - 通过 SDK 与 Lync 2010 和 2013 集成