Adding new entries to AddressList.AddressEntries...

  • Thread starter Thread starter Heinz-Josef Bomanns
  • Start date Start date
H

Heinz-Josef Bomanns

Hi again,

i have a form with a list displaying addresses that i read via OOM,
"NameSpace.AddressLists(x)". Works well so far. I now want to add a
new address entry to one of the AddressLists. I've learned that it's
not possible via "AdressList.AddressEntries.Add", so i've tried to get
a pointer to the underlying contacts folder via

NameSpace.GetFolderFromID(AddressList.ID)

or

NameSpace.GetItemFromID(AddressEntry.ID).Parent

This will fail 'cause the "ID" is no "EntryID" or "StoreID".
"AddressList.Parent" points to "AddressLists" instead to the folder
from which the entries are selected and thus also isn't of much help.

Question is now: How do i get a pointer to the appropiated contacts
folder to add a new entry directly? Or do i have to dig deeper into
CDO for a solution? Thanks for any hint...
 
Get AddressList.ID, compare it with Contacts.EntryID. You will see an
interesting pattern where the contacts folder ID is embedded within the ID
for the AddressList.

Dim strID As String
Dim oAL As Outlook.AddressList
Dim oFolder As Outlook.MAPIFolder

Set oAL = Application.Session.AddressLists("Contacts")
Set oFolder = Application.Session.GetDefaultFolder(olFolderContacts)
Debug.Print oFolder.EntryID
strID = oAL.ID
Debug.Print Mid(strID, 89, Len(strID) - 89)
 
Hi Ken,
Get AddressList.ID, compare it with Contacts.EntryID. You will see an
interesting pattern where the contacts folder ID is embedded within the ID
for the AddressList.

Thanks for the hint, will have a further look at this tomorrow -
Outlook is full of surprises ;)
 
Back
Top