Jump to content
Sign in to follow this  

Outlook contact collection

Recommended Posts


Had to write a VBS for Tafe to show my understanding of Outlook objects..

Converted it to AutoIt, thought it may come in usefull.


#include <array.au3>

$t = _CollectContacts()

Func _CollectContacts()
    Local Const $olFolderContacts = 10
    Local $rContacts[1]
    Local $rCount = 1

    $oOutlook = ObjCreate("Outlook.Application")
    $objNamespace = $oOutlook.GetNamespace("MAPI")

    $colContacts = $objNamespace.GetDefaultFolder($olFolderContacts).Items
    For $objContact In $colContacts
        If $objContact.Email1Address <> "" Then
            ConsoleWrite($objContact.Email1Address & @CRLF)
            ReDim $rContacts[$rCount + 1]
            $rContacts[$rCount] = $objContact.Email1Address
            $rCount += 1
    Return $rContacts
EndFunc  ;==>_CollectContacts

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.