尝试将活动的Lync音频设备设置为可用的音频设备之一。 Lync_Client.DeviceManager.AudioDevices.Count返回大于0的数字,但是从i = 0到i 有什么建议吗?这可能是特权问题吗? 下面是StackTrace: 从这里开始的堆栈指向我的代码,该代码尝试访问Lync AudioDevices元素枚举...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 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()
答案 0 :(得分:0)
问题是Microsoft停止发布Lync 2013 Client的Lync Client SDK。尽管SDK仍可以使用,但最新版本的Skype for Business客户端仍然有效,但由于当前的Skype for Business客户端和较早的Lync Client SDK之间不兼容,它实际上正在缓慢中断。
SDK的AudioDevice区域是客户端SDK中断的SDK的已知区域之一。有一种解决方法,您可以下拉到Lync Client SDK使用的实际原始COM接口,然后使用这些COM对象直接访问API。
您可以通过访问Lync Client SDK对象的“ InnerObject”字段将Lync Client SDK逃避到原始COM对象中。
例如:
static bool SetClientAudioDevice(LyncClient client, string name)
{
var innerClient = (ILyncClient)client.InnerObject;
var deviceManager = innerClient.DeviceManager;
Console.WriteLine("Current audio device: [{0}]", client.DeviceManager.ActiveAudioDevice.Name);
Console.WriteLine("Lync Client Audio Devices List:");
var ok = false;
foreach (var device in deviceManager.AudioDevices.OfType<Microsoft.Office.Uc.AudioDevice>())
{
Console.WriteLine(" AudioDevice: [{0}], Active[{1}], ID[{2}], IsCertified[{3}], Priority[{4}], Type[{5}]", device.Name, device.IsActive, device.Id, device.IsCertified, device.Priority, device.Type);
if (device.Name.IndexOf(name, StringComparison.InvariantCultureIgnoreCase) >= 0)
{
Console.WriteLine(" Setting active device!");
deviceManager.ActiveAudioDevice = device;
ok = true;
}
}
return ok;
}
如评论中所指出,您还必须添加对“ Microsoft.Office.Uc”的引用,并将Embed InteropType设置为False。