この 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*
...そして、値が見栄えの良い GUID である ArchiveGuid プロパティと一緒に、いくつかの有用なデータを取得します。
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 マネージ 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 呼び出しに欠けているものは何ですか?