This article is the second in a series that offers a reference point between AD Attributes and their associated values displayed in Outlook. In this post, we explore the Phone/Notes Tab within Outlook and discuss the associated Outlook LDAP Attributes. On a semi-related note, we have included a comparison between a fairly typical VB and Powershell scripting example that demonstrates how to enumerate mandatory and optional attributes within the user class.
Outlook Address Book General Tab – Ldap Attributes Mapping (Part 1)
Outlook LDAP Attributes: Mappings – “Phone/Notes” Fields
Here’s a mapping for Outlook LDAP Attributes within the Phone/Notes Tab:
|Name in Outlook||LDAP Attribute||Format||Attribute-ID|
How many phone numbers can be listed against each phone type attribute?
The primary phone number fields are only able to store a single value, whilst the otherXXXXX attributes are able to store multiple values. That is, a user may have multiple “otherTelephone” numbers stored as an array but only one primary “telephoneNumber”. In addition to the fields listed above, there are a number of less visible fields, such as otherMobile and so on.
I thought telephoneNumber was already mapped out in the General Tab?
The telephoneNumber attribute is mapped in two places: The Phone number field under the general tab, and under the Phone/Notes tab it is mapped to the Business field within the “Phone numbers” section.
I thought assistant was already mapped in the General Tab?
You’d think so wouldn’t you? No – this is not the case. I guess it may seem intuitive for some, but the assistant field under the Phone/Notes field actually maps to a phone number – the telephoneAssistant attribute. This would be where the Assistant’s phone number would be stored (seems logical, I guess).
How do I retrieve a complete list of all User Attributes?
If you’d like to establish exactly which attributes are exposed through the user class, you can iteratively enumerate the information using a fairly simple VBScript. Below is a sample that should do the trick:
Option explicit Dim u, o Dim uClass, sClass Dim Attrib, oAttrib Set UClass = GetObject("LDAP://schema/user") Set SClass = GetObject(uClass.Parent) u = 0 WScript.Echo "Mandatory attributes:" For Each Attrib in uClass.MandatoryProperties u = u + 1 WScript.Echo u & ": " & Attrib Set oAttrib = sClass.GetObject("Property", attrib) WScript.Echo " (Syntax: " & oAttrib.Syntax & ") - " & AttrType(oAttrib) Next WScript.Echo vbcrlf Wscript.Echo "Optional attributes:" o = 0 For Each Attrib in uClass.OptionalProperties o = o + 1 WScript.Echo o & ": " & Attrib Set oAttrib = sClass.GetObject("Property", Attrib) WScript.Echo " (Syntax: " & oAttrib.Syntax & ") - " & AttrType(oAttrib) Next Function AttrType(atype) AttrType = "Single-Valued" If atype.Multivalued then AttrType = "Multi-Valued" End Function
In our example above, we are simply attaching to the schema of the local domain and binding to the User Class. We then attach to it’s parent class and first enumerate the Mandatory Properties, followed by the Optional Properties. I never said this was anything new, and there are probably a dozen blogs and articles on this out there already. If you want some more information on this, check out this really old post that’s so old the Scripting Guy was still using VBScript!
Anyway, take a look at the Powershell version of the same kind of thing (brace yourself – it’s really long and tedious):
$Schm = [DirectoryServices.ActiveDirectory.ActiveDirectorySchema]::GetCurrentSchema(); ($Schm.FindClass("user")).MandatoryProperties|select name,syntax ($Schm.FindClass("user")).OptionalProperties|select name,syntax
Well – OK; it really wasn’t that long and tedious. Yes, I’m afraid – that’s it – 3 lines….. Starting to see a reason why you should be using Powershell and leaving VB for dust…?
Stay tuned for Part three – I promise, we’ll stop talking about Outlook LDAP attributes and properties – more about User Attributes in general.