有人使用 C# 在线连接 Exchange 吗?我遇到了一个似乎无法取得进展的问题。
我有以下代码片段尝试连接到在线交换:
public Runspace getSpace() {
String schema = "http://schemas.microsoft.com/powershell/Microsoft.Exchange";
Uri server = new Uri("https://outlook.office365.com/PowerShell");
string certificateThumbprint = "thumbprint";
WSManConnectionInfo connectionInfo = new WSManConnectionInfo(server, schema, certificateThumbprint);
Runspace rsp = RunspaceFactory.CreateRunspace(connectionInfo );
rsp.Open();
return rsp;
}
结果是:
System.Management.Automation.Remoting.PSRemotingTransportException:
连接到远程服务器 Outlook.office365.com 失败,并显示以下错误消息:有关详细信息,请参阅 about_Remote_Troubleshooting 帮助主题。
在 System.Management.Automation.Runspaces.AsyncResult.EndInvoke()
我知道证书正在工作,因为当我执行以下操作时,我可以连接:
Connect-ExchangeOnline -AppId "application guid" -Organization "tenent.onmicrosoft.com" -CertificateThumbprint "thumbprint"
关于我下一步可以尝试什么有什么想法吗?谢谢!
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)