Question

List contacts in "Shared Public Folder":

# First create Outlook object and get the Mapi namespace. 
$Outlook       = New-Object -com Outlook.Application 
$Namespace     = $outlook.GetNamespace("MAPI") 
$PublicFolder  = $Namespace.Folders.Item("Public Folders - me@company.com")
$PublicFolders = $PublicFolder.Folders.Item("All Public Folders")
$AddressBook   = $PublicFolders.Folders.Item("Company Address Book")
$Contacts      = $AddressBook.Items        
foreach ($Contact in $Contacts){
    $Contact.FullName
}

Each contact has a few custom attributes. Such as EmpID, "Contact Type", "IsManager"... I can't seem to figure out how to load the User-Defined property created in Outlook via Powershell.

I've found this post that deals with: Define Custom property, then use that definition to load the custom property... but I'm not sure if that's the right place to be looking, since everything dealing with it that I try gives me errors.

Was it helpful?

Solution

foreach ($Contact in $Contacts){
    $EmpID = $Contact.UserProperties.Find('EmpID').Value
    $Contact.FullName
    $EmpID
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top