So I rooted around in my toolkit and I found a few things that I wrote to 
manipulate my own Lookout contacts, folders and categories. This one was a 
template I used for doing some cleanup and updates existing contacts.

*!*     UpdateContacts.prg
* Read Outlook contact information various objects
#DEFINE olContacts 10
#DEFINE olNone 0
#DEFINE olHome 1
#DEFINE olBusiness 2
#DEFINE olOther 3

*!*     DECLARE object variables
LOCAL oNameSpace as Object, oContacts as Object, ;
oContact as Object, oItems as Object

*!*     DECLARE memvars to hold outlook property values
LOCAL cFirst as String, cLast as String, cAddr as String, cPhone as String, ;
cCompany as String, cEmail1Address as String

IF VARTYPE(oOutlook) = [O]
* Remove any existing object reference to Outlook
        oOutlook=null 
        RELEASE oOutlook
ENDIF
oOutlook = CREATEOBJECT("Outlook.Application")
oNameSpace = oOutlook.GetNameSpace("MAPI")
* Get Contacts folder
oContacts = oNameSpace.GetDefaultFolder( olContacts )
* Go through contacts
*!*     CREATE filter string to ignore distribution lists
LOCAL cFilter as String, lSaveIt as Boolean 
cFilter = "[Message Class] <> 'IPM.DistList'"
oItems=oContacts.Items.Restrict( cFilter )
*!*     cFilter = "[Categories] = 'your category to filter on'"
FOR EACH oContact IN oItems
        lSaveIt=.f.
        WITH oContact
*!*     SET the filter, if any,  for updating here
                IF ['your category to filter on]$LOWER(.Categories)
                        IF VARTYPE(.FirstName)=[C]
                                cFirst = .FirstName
                        ELSE
                                cFirst = []
                        ENDIF 
                        IF VARTYPE(.LastName)=[C]
                                cLast = .LastName
                        ELSE
                                cLast = []
                        ENDIF 
                        IF VARTYPE(.PrimaryTelephoneNumber)=[C]
                                cPhone = .PrimaryTelephoneNumber
                        ELSE
                                cPhone = []
                        ENDIF 
                        IF VARTYPE(.CompanyName)=[C]
                                cCompany = .CompanyName
                        ELSE
                                cCompany = []
                        ENDIF 
                        IF VARTYPE(.Email1Address)=[C]
                                cEmail1Address = .Email1Address
                        ELSE
                                cEmail1Address = []
                        ENDIF 
                        categories = .Categories
                        IF VARTYPE(.BusinessAddress)=[C]
                                cAddr = .BusinessAddress
                        ELSE
                                cAddr = []
                        ENDIF 
*!*     ADD variables for different outlook properties here.
                        IF EMPTY(cCompany)
                                .CompanyName=[the company name to add to all 
these contacts]
                                lSaveIt=.t.
                        ENDIF 
                        IF EMPTY(cPhone)
                                .PrimaryTelephoneNumber=[the phone number to 
add to all these contacts]
                                IF NOT lSaveIt
                                        lSaveIt=.t.
                                ENDIF 
                        ENDIF 
                        IF NOT [@]$cEmail1Address
                                
.Email1Address=ALLTRIM(.Email1Address)+[@company.com]
                                IF NOT lSaveIt
                                        lSaveIt=.t.
                                ENDIF 
                        ENDIF 
                        IF EMPTY(cAddr)
                                .BusinessAddress=[One Company 
Address]+CHR(13)+[New York City, NY  10001]
                                IF NOT lSaveIt
                                        lSaveIt=.t.
                                ENDIF 
                        ENDIF 
                ENDIF 
                IF lSaveIt      && updated at least one thing
                        .Save
                ENDIF 
        ENDWITH
ENDFOR
RETURN

--

rk

-----Original Message-----
From: ProfoxTech <[email protected]> On Behalf Of Richard Kaye
Sent: Wednesday, May 27, 2020 4:10 PM
To: [email protected]
Subject: RE: Populating Microsoft Outlook address book using a list of emails 
from a CSV file

I've done stuff with good old COM automation and the Lookout contact object. 
And it was probably based on stuff I read in the Hentzenwerke COM automation 
book. But I'm happy to go look for it and let you know more details.

--

rk

-----Original Message-----
From: ProfoxTech <[email protected]> On Behalf Of MB Software 
Solutions, LLC
Sent: Wednesday, May 27, 2020 4:03 PM
To: [email protected]
Subject: Populating Microsoft Outlook address book using a list of emails from 
a CSV file

Customer wants to pre-seed his Outlook contacts with a CSV list to save him 
time later when actually emailing these people for the first time.

Haven't dove into this yet but wanted to throw it out to the group in case 
someone has already "been there, done that, here's the plan."

tia!
--Mike



[excessive quoting removed by server]

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: https://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: https://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: https://leafe.com/archives
This message: 
https://leafe.com/archives/byMID/mwhpr1001mb214496c134c896d8aa3f5186d2...@mwhpr1001mb2144.namprd10.prod.outlook.com
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to