'Outlook API mail enabled vs mailbox user
A very nuanced question and maybe environment specific. I am trying to use Outlook 2010 API to discern mailbox users from mail-enabled users. We are using Dell Quest migration tooling during a Notes to Exchange migration and it is a fluid project. Still in the prototype stage, so using VB Macros for what will eventually be delivered in C#.
Last week, I was using the check “myRecipient.AddressEntry.AddressEntryUserType <> olExchangeUserAddressEntry”, where myRecipient was part of the myItem.Recpients list, where myItem was retrieved from the ActiveInspector.CurrentItem of an email item. Presumably, the Coexistence guys made some change to Active Directory replication and now everyone is showing up as an Exchange user, even non-migrated to Exchange users. Microsoft documentation seems to say olExchangeUserAddressEntry means "user is in GAL".
In Outlook 2010 GAL UI (when picking recipients after clicking the To button), I see visual indicators about mail-enabled vs. mailbox users. The mail-enabled users have a globe in the icon. The mailbox users don't. Any idea what property I need to access to distinguish mailbox users from mail enabled users in a migrating environment?
I'd like to keep inside the Outlook API, but want to know how that's possible for this query, or whether addition of the AD API is required.
Thanks, Jason
Solution 1:[1]
Use the PR_DISPLAY_TYPE
(DASL name http://schemas.microsoft.com/mapi/proptag/0x39000003
) property. Mailbox enabled users are DT_MAILUSER
(0) vs DT_REMOTE_MAILUSER
(6). The property can be accessed using AddressEntry.PropertyAccessor.GetProperty
.
Take a look at the GAL objects using OutlookSpy (I am its author - click IAddrBook, OpenRootContainer | GetHierarchyTable, etc.)
Solution 2:[2]
Hope I'm following protocol, but struggled to add comments to prior posts. Dmitry hit the nail on the head with his suggestion.
Current code:
For Each myRecipient In myItem.Recipients
'Simple "Exchange User" interrogation worked last Thursday
Dim test1 As Boolean
test1 = myRecipient.AddressEntry.AddressEntryUserType <> olExchangeUserAddressEntry
Dim test2 As Boolean
Dim myAccessor As PropertyAccessor
Set myAccessor = myRecipient.PropertyAccessor
If Not test1 Then
myDisplayType = myAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x39000003")
test2 = myDisplayType <> 0 'Not an Exchange user
Else
test2 = False
End If
Trying to find better constant to test myDisplayType, but good enough for now. Thanks, Dmitry. You showed great expertise.
Regards, Jason
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | |
Solution 2 | IowaJason |