获取约会项的日历所有者电子邮件地址 [英] Getting calendar's owner email address of an AppointmentItem
问题描述
我正在开发 Outlook 插件以将所有约会发送到网络应用程序,但我在始终获取约会项目的所有者"(而非组织者)时遇到了一些问题.
I'm developing an Outlook Add-In to send all the appointments to a web app and I'm having some trouble consistently getting the "owner" (not the organizer) of an AppointmentItem.
例如,X 向 Y 和 Z 发送约会.插件会从中获取三个约会项目,我正在尝试获取 X、Y 和 Z 的电子邮件地址.
For example, X sends an appointment to Y and Z. The Add-In will get three appointment items out of it, I'm trying to get the email address of X, Y and Z.
我尝试查看 SendUsingAccount(有时设置为 null)或 Parent 属性,但似乎找不到我要查找的内容.
I tried to look into the SendUsingAccount (sometimes set to null) or the Parent property but I can't seem to find what I'm looking for.
感谢您的帮助!
推荐答案
如果是默认帐号,并且假设 Outlook 中只配置了一个主 Exchange 帐号,则可以简单地使用 Application.Session.CurrentUser
代码>.
If it is the default account and assuming there is only one primary Exchange account configured in Outlook, you can simply use Application.Session.CurrentUser
.
更新:
如果您从非默认 Exchange 帐户访问约会,则可以检索父 Store
- 您可以通过 AppointmentItem.Parent
(它将是 MAPIFolder
),然后使用 MAPIFolder.Store
或 StoreID
属性.然后,您可以使用 Account.DeliveryStore
将商店与 Namespace.Accounts
集合中的 Account
对象匹配.使用 Namespace.CompareEntryIDs
比较两个商店条目 id,不要直接比较字符串.
一旦您可以使用 Account 对象,您就可以使用 Account.CurrentUser 属性.
UPDATE:
If you are accessing an appointment from a non-default Exchange account, you can retrieve the parent Store
- you can do that through AppointmentItem.Parent
(it will be MAPIFolder
), then use MAPIFolder.Store
or StoreID
property. You can then match the store to an Account
object from the Namespace.Accounts
collection using Account.DeliveryStore
. Compare the two store entry ids using Namespace.CompareEntryIDs
, don't compare the strings directly.
Once you can the Account object, you can use Account.CurrentUser property.
如果使用 Redemption 是一种选择(我是它的作者),它会暴露 RDOExchangeMailboxStore.Owner
属性,这样您就不必去通过帐户:只需创建 RDOSession 对象,设置其 MAPIOBJECT
属性从 Outlook 设置为 Application.Session.MAPIOBJECT
,使用 RDOSession.GetMessageFromID
或 GetRDOObjectFromOutlookObject
重新打开约会,并使用 RDOappointmentItem.Parent.Store.Owner
.
If using Redemption is an option (I am its author), it exposes RDOExchangeMailboxStore.Owner
property so that you don't have to go through the accounts: just create RDOSession object, set its MAPIOBJECT
property to Application.Session.MAPIOBJECT
from Outlook, reopen the appointment appointment using RDOSession.GetMessageFromID
or GetRDOObjectFromOutlookObject
, and use RDOAppointmentItem.Parent.Store.Owner
.
这篇关于获取约会项的日历所有者电子邮件地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!