Hi,

my company has a "global addressbook" which contains pictures for users
I managed a script that can export contact pictures, but only works when these contacts have previously been added to "my contacts"

is there any way to "add to contacts" by code??
addToOutlook.png

or any other way to export contact picture from global addressbook maybe?

this is the code I use to export pictures ( I run it from excel )
'2015-01-08 / B.Agullo /
Sub SaveContactPhoto()
 
    'does not work with global addressbook configuration...
 
    Dim itemContact As ContactItem
    Dim fdrContacts As MAPIFolder
    Dim colAttachments As Outlook.Items
    Dim colItems As Outlook.Items
    Dim DATAr As Range
    Dim picPath As String
    
    Dim fname As String
     
    Set fdrContacts = Session.GetDefaultFolder(olFolderContacts)
     
    On Error Resume Next
     
    For itemCounter = 1 To fdrContacts.Items.Count
     
        Set itemContact = fdrContacts.Items(itemCounter)
        
        
        Set DATAr = getRow(DATA.Range("c_user"), itemContact.Account)
        
        If Not DATAr Is Nothing Then
           
            Set collAttachments = itemContact.Attachments
        
            For Each Attach In collAttachments
                If Attach.filename = "ContactPicture.jpg" Then
                fname = (itemContact.FirstName & itemContact.LastName & ".jpg")
               picPath = thisworkbook.path & "\Outlook Pictures\" & fname
               Attach.SaveAsFile (picPath)
               DATAr.Range("Picture") = picPath
             End If
           Next
        End If
    Next
 
End Sub