Downloading Outlook contact photos / profile pictures

Sample Outlook Profile imageI wanted to grab the photos (“ContactPicture”) that people put in their Outlook Contact Details.

Not sure if I grabbed this code from somewhere, or wrote it myself.  Just leaving it here for the next time I need it.

Note to self:
* you need a local copy of the address book to run this code against.

Sub SaveContactPhoto()
Dim itemContact As ContactItem
Dim fdrContacts As MAPIFolder
Dim colAttachments As Outlook.Items
Dim colItems As Outlook.Items
Dim fname As String
'Default Contacts folder
'Set fdrContacts = Session.GetDefaultFolder(olFolderContacts)
' Selected folder
' Ensure you select the GAL folder ....
Set fdrContacts = Application.ActiveExplorer.CurrentFolder
On Error Resume Next
For itemCounter = 1 To fdrContacts.Items.Count
    Set itemContact = fdrContacts.Items(itemCounter)
    Set collAttachments = itemContact.Attachments
    For Each attach In collAttachments
      If attach.FileName = "ContactPicture.jpg" Then
         fname = (itemContact.FirstName & " " & itemContact.LastName & ".jpg")
        If fname <> "" Then
            attach.SaveAsFile ("C:\data\Contact Photos\" & fname)
        End If
      End If
End Sub

Bonus fact: Microsoft call the Outlook Contact Details “Profile Cards”

The case of the broken Microsoft Word VBA application

It was a Microsoft Word (VBA) application written back in 2001.

Essentially what it does is:

  1. user selects a letter type.
  2. the user then enters some customer reference numbers.
  3. the VBA application does an Oracle database lookup to convert those customer reference numbers into names and postal addresses.
  4. which the VBA then uses to “mail merge” into whatever number of letters need to be sent out.

And it was broken.

I had a feeling that writing about patch management policy would come back to bite me (and it did).

Continue reading

“Developing For Office – Options and Trade-Offs”

microsoft-office-logo According to Bruno Terkaly, you have three main choices:

  1. Traditional Visual Basic for Applications (VBA)
    Dates back to all the way to the early nineties.
  2. Visual Studio Tools for Office.
    Really hit its stride and office 2007. It probably represents the best option moving forward today. It tries to be all things to all people.
  3. The COM Add-In is probably the most powerful, yet the most difficult option of the three.

I’ve borrowed the above words from Bruno.  You can read all about those options in his blog post.

Bookmark and Share