[AccessD] Checking Outlook Contact Info from Access

Erwin Craps - IT Helps Erwin.Craps at ithelps.eu
Fri Aug 3 03:17:03 CDT 2007


There is a customerid property that I use.

Here a small extract from the code I use

"ITH" is a prefix I use to specify from which database the contact in
Outlook comes
CustomerID is the company id
ContactID is the contact from this company id

When creating:
objOItem.CustomerID = "ITH" & CustomerID & "/" & ContactID
              

When updating:
Set objContactItem = oFolderContact.Items.Find("[CustomerID] = " & "ITH"
& CustomerID & "/" &ContactID)
If TypeName(objContactItem) = "Nothing" Then
	'Create new contact because it does not exist
      Set objContactItem = oFolderContact.Items.Add(olContactItem)
	' do your add new contact thingy
  Else
	'Update using found contact.
	'put your update code here
End If
                
Greetz 
Erwin






-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of John Bartow
Sent: Friday, August 03, 2007 8:37 AM
To: 'Access Developers discussion and problem solving'
Subject: [AccessD] Checking Outlook Contact Info from Access

I've got routines to pull data into Access from Outlook as I need it
when adding new client's to a db. I also pull in the "EntryID" as its
the only unique property per item I can locate in Contacts.

I'm now attempting to verify and add/update Outlook Contact info from
Access when editing in Access by using EntryID to filter the Outlook
Items. Problem is - and this took me quite awhile to see in the help
file for some reason - "EntryID" can't be used with the Restrict method.

Set oApp = CreateObject("Outlook.Application")
Set oNspc = oApp.GetNamespace("MAPI")
Set oContacts = oNspc.GetDefaultFolder(olFolderContacts).Items
strContactToCheck = "[CustomerID] = """ & strEntryID & """"
Set oItems = oContacts.Restrict(strContactToCheck)

Someone recently asked what the problem with Outlook IDs was. Well here
it is, the one unique ID and it can't be used to filter the Items.

Any ideas on how to lookup a specific contact in Outlook so that it's
properties can be compared to the Access data?


--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com





More information about the AccessD mailing list