我开发了一个小程序,向我们的客户发送报告,应该由每个员工使用。通常,电子邮件应该代表公司发送,但是某些专业人员没有被授予权限。
在这些情况下,电子邮件应显示为由他们发送。
如果我设置了Mailitem.SentOnBehalfOfNamem属性并且用户未被授予访问权限,则邮件会反弹。 但是,我需要在发送电子邮件之前验证用户是否具有权限。
顺便说一下,服务器正在使用Exchange Server 2008。
提前致谢!
答案 0 :(得分:0)
您需要访问给定用户可以发送的用户的PR_EMS_AB_PUBLIC_DELEGATES_BL_O
列表。
Outlook对象模型不会公开该信息。您可以使用扩展MAPI(仅限C ++或Delphi)访问PR_EMS_AB_PUBLIC_DELEGATES_BL_O
- 查看OutlookSpy中的列表:对于当前用户,单击IMAPISession,QueryIdentity,转到PR_EMS_AB_PUBLIC_DELEGATES_BL_O选项卡。
对于C ++或Delphi以外的语言,您可以使用Redemption及其RDOAddressList。IsDelegateFor
集合。 VBA中的一个例子:
set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set AddressEntry = Session.CurrentUser
'Debug.Print "-- Delegates (who can send of behalf of " & AddressEntry.Name & ")"
for each AE in AddressEntry.Delegates
MsgBox AE.Name
next
'Debug.Print "-- Is delegate for (can send on behalf of these users)"
for each AE in AddressEntry.IsDelegateFor
MsgBox AE.Name
next