我开发了一个管理 Skype For Business 用户配置的应用程序。
我需要运行的操作之一应该使用以下命令设置 Skype 用户的注册池:
Move-CsUser -Identity [UserName] -Target [RegistrarPool] -Confirm:$false
现在,当我从命令行运行命令时——效果很好。
但是,与我在应用程序中使用的其他 Skype shell 命令不同,当我使用我的 c# 代码运行该命令时,我得到了这个可怕的错误:
Move-CsUser : Unable to cast COM object of type 'System.__ComObject' to interface type \r\n
'Microsoft.Rtc.Interop.User.ICsUserManagement'. This operation failed because the QueryInterface call on the COM \r\n
component for the interface with IID '{D5ADD966-BDC3-4A8F-BFE8-6A59A9F74CB2}' failed due to the following error: Class \r\n
not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).\r\nAt line:1 char:1\r\n+
Move-CsUser -Identity 'testuser' -Target 'XXX' -Confirm: ...\r\n+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
\r\n +
CategoryInfo : InvalidOperation: (CN=Agent Develo...DC=il,DC=tleumi:OCSADUser) [Move-CsUser], InvalidCa \r\n stException\r\n
+ FullyQualifiedErrorId : MoveError,Microsoft.Rtc.Management.AD.Cmdlets.MoveOcsUserCmdlet\r\n \r\n"
尽管我尽了最大努力来解决它,但我在克服 COM 对象的错误方面显然很糟糕。
谁能帮我一把?
我怎样才能让它工作?