枚举您可以使用 EWS Managed API 访问的共享邮箱名称
Enumerating shared mailbox names you are able to access using EWS Managed API
我设置了共享邮箱并可以访问它及其子文件夹:
var folderId = new FolderId(WellKnownFolderName.MsgFolderRoot, "shared.mailbox@domain.local");
var folders = client.FindFolders(folderId, new FolderView(Int32.MaxValue));
为此,我需要知道共享邮箱的名称 - 在本例中,共享邮箱的名称是 shared.mailbox@domain.local.有没有办法枚举我可以访问的所有共享邮箱名称?我试过在线搜索,但找不到解决方案。
运行 EMS 中的这个命令查找所有用户邮箱名称并导出到 csv:
Get-Mailbox -ResultSize Unlimited | Select 姓名、别名、收件人类型详细信息 |导出 Csv c:\Users.csv
然后形成你的代码,从文件中读取并循环遍历它们我建议将 folderid 存储在字典中,以便你以后可以访问它们
目前
无法直接从api的服务器中找到邮箱
when you for example connect to an Office 365 account from Exchange and join a group, you see the shared mailbox of that group. When you then browse to your Office 365 mailbox online and not in Exchange, you see that group there as well,
如果您谈论的是 Office365 群组,您可以通过来自 git 中心 https://github.com/OfficeDev/ews-managed-api eg
的最新版托管 API 中的 GetUserUnifiedGroups 访问这些群组
RequestedUnifiedGroupsSet Group = new RequestedUnifiedGroupsSet();
Group.FilterType = UnifiedGroupsFilterType.All;
Group.SortDirection = SortDirection.Ascending;
Group.SortType = UnifiedGroupsSortType.DisplayName;
List<RequestedUnifiedGroupsSet> reqG = new List<RequestedUnifiedGroupsSet>();
reqG.Add(Group);
Collection<UnifiedGroupsSet> ugGroupSet = service.GetUserUnifiedGroups(reqG,"jcool@domain.com");
foreach (UnifiedGroupsSet ugset in ugGroupSet)
{
foreach (UnifiedGroup ugGroup in ugset.Groups)
{
Console.WriteLine(ugGroup.SMTPAddress);
}
}
授权访问启用自动映射的邮箱(这些是 Outlook 将自动映射到配置文件中的邮箱)例如 Add-MailboxPermission -AutoMapping 可以使用自动发现发现例如
AutodiscoverService adAutoDiscoverService = new AutodiscoverService(ExchangeVersion.Exchange2013_SP1);
adAutoDiscoverService.Credentials = new NetworkCredential("user@domain.com", "pass");
adAutoDiscoverService.EnableScpLookup = false;
adAutoDiscoverService.RedirectionUrlValidationCallback = adAutoDiscoCallBack;
adAutoDiscoverService.PreAuthenticate = true;
adAutoDiscoverService.KeepAlive = false;
GetUserSettingsResponse gsp = adAutoDiscoverService.GetUserSettings("user@domain.com", UserSettingName.AlternateMailboxes);
Object Mailboxes = null;
if (gsp.Settings.TryGetValue(UserSettingName.AlternateMailboxes, out Mailboxes))
{
foreach (AlternateMailbox Mailbox in ((AlternateMailboxCollection)Mailboxes).Entries)
{
Console.WriteLine(Mailbox.SmtpAddress);
}
}
但是,您刚刚将权限添加到邮箱或文件夹的邮箱没有办法知道这一点,然后枚举每个邮箱 DACL 并进行检查。
我设置了共享邮箱并可以访问它及其子文件夹:
var folderId = new FolderId(WellKnownFolderName.MsgFolderRoot, "shared.mailbox@domain.local");
var folders = client.FindFolders(folderId, new FolderView(Int32.MaxValue));
为此,我需要知道共享邮箱的名称 - 在本例中,共享邮箱的名称是 shared.mailbox@domain.local.有没有办法枚举我可以访问的所有共享邮箱名称?我试过在线搜索,但找不到解决方案。
运行 EMS 中的这个命令查找所有用户邮箱名称并导出到 csv:
Get-Mailbox -ResultSize Unlimited | Select 姓名、别名、收件人类型详细信息 |导出 Csv c:\Users.csv
然后形成你的代码,从文件中读取并循环遍历它们我建议将 folderid 存储在字典中,以便你以后可以访问它们
目前
无法直接从api的服务器中找到邮箱when you for example connect to an Office 365 account from Exchange and join a group, you see the shared mailbox of that group. When you then browse to your Office 365 mailbox online and not in Exchange, you see that group there as well,
如果您谈论的是 Office365 群组,您可以通过来自 git 中心 https://github.com/OfficeDev/ews-managed-api eg
的最新版托管 API 中的 GetUserUnifiedGroups 访问这些群组 RequestedUnifiedGroupsSet Group = new RequestedUnifiedGroupsSet();
Group.FilterType = UnifiedGroupsFilterType.All;
Group.SortDirection = SortDirection.Ascending;
Group.SortType = UnifiedGroupsSortType.DisplayName;
List<RequestedUnifiedGroupsSet> reqG = new List<RequestedUnifiedGroupsSet>();
reqG.Add(Group);
Collection<UnifiedGroupsSet> ugGroupSet = service.GetUserUnifiedGroups(reqG,"jcool@domain.com");
foreach (UnifiedGroupsSet ugset in ugGroupSet)
{
foreach (UnifiedGroup ugGroup in ugset.Groups)
{
Console.WriteLine(ugGroup.SMTPAddress);
}
}
授权访问启用自动映射的邮箱(这些是 Outlook 将自动映射到配置文件中的邮箱)例如 Add-MailboxPermission -AutoMapping 可以使用自动发现发现例如
AutodiscoverService adAutoDiscoverService = new AutodiscoverService(ExchangeVersion.Exchange2013_SP1);
adAutoDiscoverService.Credentials = new NetworkCredential("user@domain.com", "pass");
adAutoDiscoverService.EnableScpLookup = false;
adAutoDiscoverService.RedirectionUrlValidationCallback = adAutoDiscoCallBack;
adAutoDiscoverService.PreAuthenticate = true;
adAutoDiscoverService.KeepAlive = false;
GetUserSettingsResponse gsp = adAutoDiscoverService.GetUserSettings("user@domain.com", UserSettingName.AlternateMailboxes);
Object Mailboxes = null;
if (gsp.Settings.TryGetValue(UserSettingName.AlternateMailboxes, out Mailboxes))
{
foreach (AlternateMailbox Mailbox in ((AlternateMailboxCollection)Mailboxes).Entries)
{
Console.WriteLine(Mailbox.SmtpAddress);
}
}
但是,您刚刚将权限添加到邮箱或文件夹的邮箱没有办法知道这一点,然后枚举每个邮箱 DACL 并进行检查。