• Outlook User
  • New Outlook app
  • Outlook.com
  • Outlook Mac
  • Outlook & iCloud
  • Developer
  • Microsoft 365 Admin
    • Common Problems
    • Microsoft 365
    • Outlook BCM
    • Utilities & Addins

Export (Save) Outlook Contact Photos

Slipstick Systems

› Developer › Code Samples › Export (Save) Outlook Contact Photos

Last reviewed on November 8, 2022     15 Comments

Use this VBA to save contact photos to a folder on your hard drive.

This is an example of a contact photo:

Contact photo

To import photos into contacts, see Batch Import Photos into Outlook Contacts

Note: make sure you change the folder path in the VBA!

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
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")
        attach.SaveAsFile ("C:\Contact Photos\" & fname)
      End If
    Next

Next

End Sub

To save all attachments, not just contact photos, you need to remove or comment out the If statements that look for contact photos in the macro above. If you want to save all except contact photos, you would change the line to read "if the file name in not contactpicture.jpg":
If attach.Filename <> "ContactPicture.jpg" Then

Because some of the attachments might have the same file name, we'll add the contact's full name to filename.

Sub SaveContactAttachments()

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
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.FullName & "-" & attach.Filename
        attach.SaveAsFile ("D:\Documents\Contact attach\" & fname)
    '   End If
    Next
Next

End Sub

Export (Save) Outlook Contact Photos was last modified: November 8th, 2022 by Diane Poremsky

Related Posts:

  • Outlook.com Contact Photos
  • Print Contacts and Contact Photos
  • Batch Import Photos into Outlook Contacts
  • An administrator recently came to us with a problem: We would like the
    Add to Exchange Server Public Folder Contacts?

About Diane Poremsky

A Microsoft Outlook Most Valuable Professional (MVP) since 1999, Diane is the author of several books, including Outlook 2013 Absolute Beginners Book. She also created video training CDs and online training classes for Microsoft Outlook. You can find her helping people online in Outlook Forums as well as in the Microsoft Answers and TechNet forums.

Subscribe
Notify of
15 Comments
newest
oldest most voted
Inline Feedbacks
View all comments

itmonitor (@guest_204421)
February 7, 2017 5:33 pm
#204421

Hello. I could not find information about how Outlook 2013 manages the photos from the Contacts. I added the photos to my contacts in Outlook and still have the images in a folder. May I safely delete the images in the folder or this will also delete the Outlook Contacts pictures? Any advice is welcome! :-)

0
0
Reply
Diane Poremsky(@diane-poremsky)
Author
Reply to  itmonitor
May 10, 2017 12:55 am
#206473

Outlook stored the image in the content's meta data. You can safely delete the pictures on the hard drive once they were added to the contact.

0
0
Reply
kinglifer (@guest_186214)
September 22, 2014 11:30 am
#186214

Hi is there a way to simply automate an email that comes in on outlook? I have emails that come in all the time of new clients and I have the social connector. I would like it when I add them to my contacts the information from LinkedIn and Facebook is added to the contact. I assumed this would do it but unless I am mistaken it does not.

0
0
Reply
Diane Poremsky (@guest_186216)
Reply to  kinglifer
September 22, 2014 12:05 pm
#186216

That is not how it works. If you are signed in to LinkedIn and they have their photo public, you'll see their picture on the message - you can click their name to open their profile in a browser. Contacts who are linked to you will be added to the LinkedIn contacts folder in Outlook. Facebook works the same way, but does not create a contacts folder in Outlook.

If they are your linkedin friends, you can copy the contact from the linkedin folder to outlook contacts.

0
0
Reply
Fiona (@guest_184923)
July 31, 2014 12:40 pm
#184923

Hello,

I'm running this code but am getting some unexpected behaviour.

The set that is returned from the call 'Session.GetDefaultFolder(olFolderContacts)' seems to be only of strings in the format "lastname, firstname" with no attachments or anything else.

Am I missing something?

I am using Outlook 2012 if this helps troubleshooting :)

0
0
Reply
Diane Poremsky (@guest_185017)
Reply to  Fiona
August 6, 2014 1:35 am
#185017

These lines look for attachments, and then checks the attachment name. If it matches the attachment name outlook uses for contact photos, it saves it to a file and uses the contact's first and last name as the file name.
For Each attach In collAttachments
If attach.FileName = "ContactPicture.jpg" Then
fname = (itemContact.FirstName & itemContact.LastName & ".jpg")
attach.SaveAsFile ("C:\Contact Photos\" & fname) <== make sure you use a path that is valid.

0
0
Reply
Fiona (@guest_185022)
Reply to  Diane Poremsky
August 6, 2014 4:33 am
#185022

I understand that, what I am seeing though that there aren't any attachments, or any other of the attributes I would expect from the OutlookItem object.

I added an extra line to check the hasPicture property, and this is coming back false for each Contact, even those who have a picture

I suppose this is something to do with my setup (Lync connectivity).

Thanks for the reply

0
0
Reply
Diane Poremsky (@guest_185027)
Reply to  Fiona
August 6, 2014 9:43 am
#185027

Ah... it's Lync contacts - the image is synced from elsewhere when the contact loads. If you open the contact from the Lync Contacts folder, is the photo on the contact? (or use business card view) If you can see the photo on the contact, it should get it - that is how it works with linkedin in Outlook 2010. (I checked lync in Outlook, no photos, just like in 2013).

0
0
Reply
Jim Dell (@guest_182815)
April 1, 2014 9:37 am
#182815

Success! Thanks.
Here's the code in case anybody else needs to do this
Sub SaveContactPhoto()

Dim itemContact As ContactItem
Dim fdrContacts As MAPIFolder

Dim colAttachments As Outlook.Items
Dim colItems As Outlook.Items

Dim fname As String

Set fdrContacts = GetFolderPath("iCloud\Contacts")

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")
attach.SaveAsFile ("H:\Contact Photos\" & fname)
End If
Next

Next

End Sub

0
0
Reply
Jim Dell (@guest_182805)
March 31, 2014 10:13 pm
#182805

I must be doing something wrong in line 7 of the following code
Sub SaveContactPhoto()

Dim itemContact As ContactItem
Dim fdrContacts As MAPIFolder
Set fdrContacts = GetFolderPath("iCloud - Yahoo Mail")
Dim colAttachments As Outlook.Items
Dim colItems As Outlook.Items

Dim fname As String

GetFolderPath fdrContacts

Set fdrContacts = Session.GetDefaultFolder(olFolderContacts)

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")
attach.SaveAsFile ("H:\Contact Photos\" & fname)
End If
Next

Next

End Sub

0
0
Reply
Diane Poremsky (@guest_182807)
Reply to  Jim Dell
April 1, 2014 1:02 am
#182807

This :
GetFolderPath fdrContacts
Set fdrContacts = Session.GetDefaultFolder(olFolderContacts)

Should be
Set fdrContacts = GetFolderPath(iCloud\contacts)

0
0
Reply
Jim Dell (@guest_182800)
March 31, 2014 9:09 pm
#182800

So where do I find the getfolderpath function or is it builtin?
Would the path be "icloud\contacts"

I am using Outlook 2013

0
0
Reply
Diane Poremsky (@guest_182801)
Reply to  Jim Dell
March 31, 2014 10:00 pm
#182801

oh, sorry, i copied the url then forgot to paste it in. Get the function from here -
https://www.slipstick.com/developer/working-vba-nondefault-outlook-folders/

The path you use will be iCloud\contacts if that is what the folder is named.

0
0
Reply
Jim Dell (@guest_182796)
March 31, 2014 8:24 pm
#182796

What if the contacts are not in the default folder but in the iCloud folder?

0
0
Reply
Diane Poremsky (@guest_182798)
Reply to  Jim Dell
March 31, 2014 8:56 pm
#182798

You need to use getfolderpath function and Set fdrContacts = GetFolderPath("icloud\folder-name").

0
-1
Reply

Visit Slipstick Forums.
What's New at Slipstick.com

Latest EMO: Vol. 30 Issue 19

Subscribe to Exchange Messaging Outlook






Support Services

Do you need help setting up Outlook, moving your email to a new computer, migrating or configuring Office 365, or just need some one-on-one assistance?

Our Sponsors

CompanionLink
ReliefJet
  • Popular
  • Latest
  • Week Month All
  • Jetpack plugin with Stats module needs to be enabled.
  • Open Outlook Templates using PowerShell
  • Count and List Folders in Classic Outlook
  • Google Workspace and Outlook with POP Mail
  • Import EML Files into New Outlook
  • Opening PST files in New Outlook
  • New Outlook: Show To, CC, BCC in Replies
  • Insert Word Document into Email using VBA
  • Delete Empty Folders using PowerShell
  • Warn Before Deleting a Contact
  • Classic Outlook is NOT Going Away in 2026
Ajax spinner

Recent Bugs List

Microsoft keeps a running list of issues affecting recently released updates at Fixes or workarounds for recent issues in classic Outlook (Windows).

For new Outlook for Windows: Fixes or workarounds for recent issues in new Outlook for Windows .

Outlook for Mac Recent issues: Fixes or workarounds for recent issues in Outlook for Mac

Outlook.com Recent issues: Fixes or workarounds for recent issues on Outlook.com

Office Update History

Update history for supported Office versions is at Update history for Office

Outlook Suggestions and Feedback

Outlook Feedback covers Outlook as an email client, including Outlook Android, iOS, Mac, and Windows clients, as well as the browser extension (PWA) and Outlook on the web.

Outlook (new) Feedback. Use this for feedback and suggestions for Outlook (new).

Use Outlook.com Feedback for suggestions or feedback about Outlook.com accounts.

Other Microsoft 365 applications and services




New Outlook Articles

Open Outlook Templates using PowerShell

Count and List Folders in Classic Outlook

Google Workspace and Outlook with POP Mail

Import EML Files into New Outlook

Opening PST files in New Outlook

New Outlook: Show To, CC, BCC in Replies

Insert Word Document into Email using VBA

Delete Empty Folders using PowerShell

Warn Before Deleting a Contact

Classic Outlook is NOT Going Away in 2026

Newest Code Samples

Open Outlook Templates using PowerShell

Count and List Folders in Classic Outlook

Insert Word Document into Email using VBA

Warn Before Deleting a Contact

Use PowerShell to Delete Attachments

Remove RE:, FWD:, and Other Prefixes from Subject Line

Change the Mailing Address Using PowerShell

Categorize @Mentioned Messages

Send an Email When You Open Outlook

Delete Old Calendar Events using VBA

VBA Basics

How to use the VBA Editor

Work with open item or selected item

Working with All Items in a Folder or Selected Items

VBA and non-default Outlook Folders

Backup and save your Outlook VBA macros

Get text using Left, Right, Mid, Len, InStr

Using Arrays in Outlook macros

Use RegEx to extract message text

Paste clipboard contents

Windows Folder Picker

Custom Forms

Designing Microsoft Outlook Forms

Set a custom form as default

Developer Resources

Developer Resources

Developer Tools

VBOffice.net samples

SlovakTech.com

Outlook MVP David Lee

Repair PST

Convert an OST to PST

Repair damaged PST file

Repair large PST File

Remove password from PST

Merge Two Data Files

Sync & Share Outlook Data

  • Share Calendar & Contacts
  • Synchronize two computers
  • Sync Calendar and Contacts Using Outlook.com
  • Sync Outlook & Android Devices
  • Sync Google Calendar with Outlook
  • Access Folders in Other Users Mailboxes

Diane Poremsky [Outlook MVP]

Make a donation

Mail Tools

Sending and Retrieval Tools

Mass Mail Tools

Compose Tools

Duplicate Remover Tools

Mail Tools for Outlook

Online Services

Calendar Tools

Schedule Management

Calendar Printing Tools

Calendar Reminder Tools

Calendar Dates & Data

Time and Billing Tools

Meeting Productivity Tools

Duplicate Remover Tools

Productivity

Productivity Tools

Automatic Message Processing Tools

Special Function Automatic Processing Tools

Housekeeping and Message Management

Task Tools

Project and Business Management Tools

Choosing the Folder to Save a Sent Message In

Run Rules on messages after reading

Help & Suggestions

Submit Outlook Feature Requests

Slipstick Support Services

Buy Microsoft 365 Office Software and Services

Visit Slipstick Forums.

What's New at Slipstick.com

Home | Outlook User | Exchange Administrator | Office 365 | Outlook.com | Outlook Developer
Outlook for Mac | Common Problems | Utilities & Addins | Tutorials
Outlook & iCloud Issues | Outlook Apps
EMO Archives | About Slipstick | Slipstick Forums
Submit New or Updated Outlook and Exchange Server Utilities

Send comments using our Feedback page
Copyright © 2025 Slipstick Systems. All rights reserved.
Slipstick Systems is not affiliated with Microsoft Corporation.

wpDiscuz

Sign up for Exchange Messaging Outlook

Our weekly Outlook & Exchange newsletter (bi-weekly during the summer)






Please note: If you subscribed to Exchange Messaging Outlook before August 2019, please re-subscribe.

Never see this message again.

You are going to send email to

Move Comment