Office365通过EWS获取ArchiveGuid

时间:2013-11-27 19:44:46

标签: c# exchangewebservices ews-managed-api office365-apps

我正在使用此PowerShell命令从Office获取ArchiveGuid属性:

PS > $O365Cred = (Get-Credential)
PS > New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri "https://ps.outlook.com/powershell/" -Credential $O365Cred -Authentication Basic -AllowRedirection
PS > Import-PSSession $session
PS > Get-Mailbox -Archive
PS > Get-Mailbox me@example.com |fl arch*

...我和ArchiveGuid属性一起获得了一些有用的数据,其值是一个漂亮的GUID:

ArchiveDatabase     : NAMPR08DG002-db090
ArchiveGuid         : d9c4eced-a410-41a7-bbfe-ebfd7a1a3b2e
ArchiveName         : {In-Place Archive - my name}
ArchiveQuota        : 100 GB (107,374,182,400 bytes)
ArchiveWarningQuota : 90 GB (96,636,764,160 bytes)
ArchiveDomain       :
ArchiveStatus       : Active
ArchiveState        : Local
ArchiveRelease      :

但在我的.NET应用程序中,我希望使用EWS Managed API获取此GUID。

我尝试翻译上面的命令,如下所示:

ExchangeService svc = new ExchangeService();
svc.Credentials = new WebCredentials("me@example.com", "password", "example.com");
svc.AutodiscoverUrl("me@example.com", MyAutodiscoverRedirectionUrlValidationCallback);
GetSearchableMailboxesResponse resp = svc.GetSearchableMailboxes("arch*", false);

但我收到此错误消息:

The caller has not assigned any of the RBAC roles requested in the management role header

如何传递此错误? PowerShell命令有效,我在EWS调用中缺少什么?

0 个答案:

没有答案