How to access over VBA in Outlook 2003 contacts in other Datafiles?

O

Oliver Burkhardt

Hi!

I know how to access via VBA the contacts in the 'Personal Folder'.

But if I open a new Datafile, I don't know to access the contacts there?

Who could help me?
Thx a lot.

Greets, Oli
 
O

Oliver Burkhardt

Thank you very much Michael!

So I wrote this code:
It works, but how do I select the contact folder in the dasistes Folder?

Thanks a lot.

Public Sub test()
Dim toplevelfolder As Object
Dim dasistes As Object
Dim myNamespace As Outlook.NameSpace

For Each toplevelfolder In Application.Session.Folders
'MsgBox toplevelfolder.Name
If InStr(1, toplevelfolder.Name, "form", vbTextCompare) Then

Set dasistes = toplevelfolder
MsgBox "JETZT"
End If


Next toplevelfolder

MsgBox dasistes.Name

'MsgBox dasistes.Name
End Sub
 
M

Michael Bauer [MVP - Outlook]

You need to know the folder's name and its path. For instance:

Path="Persönliche Ordner\Kontakte"
set dasistes=toplevelfolder("Kontakte")

Path="Persönliche Ordner\Kontakte\Familie"
set dasistes=toplevelfolder("Kontakte").Folders("Familie")

Depending on the case, maybe the user can/should select the folder. That's
possible with the Pickfolder function.

Once, you have the folder, and if it's always the same, you could store its
EntryID and StoreID and from then on get the reference via GetFolderFromID
function.

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
Keep your Outlook categories organized!
http://www.shareit.com/product.html?productid=300120654&languageid=1
(German: http://www.VBOffice.net/product.html?pub=6)

Am Wed, 21 Feb 2007 01:12:42 +0100 schrieb Oliver Burkhardt:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top