[英]Unable to get available audio device from Lync 2013 sdk
當我嘗試獲取這樣的可用音頻設備列表時。
LyncClient client = LyncClient.GetClient();
foreach (Device dev in client.DeviceManager.AudioDevices)
{
//Do something
}
我得到錯誤Exception has been thrown 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版本,它們可能沒有相同的版本。
問題似乎出現在代碼的“// Do something”部分。
我跟他跑了很好。
var Client = LyncClient.GetClient();
foreach (var dev in Client.DeviceManager.AudioDevices)
{
Console.WriteLine(dev.Name);
}
如果這不起作用,任何堆棧跟蹤的可能性?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.