Get outlook contacts from a Public folder instead of DefaultFolder

W

Wim VR

Hello,

I wish that excel gets the contact info from a public folder
"A-contactpersonen" instead of the DefaultFolder.

How could I change this?

Set OLF = GetObject("",
"Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(10)
If OLF Is Nothing Then
Set OLF =
CreateObject("Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(10)

Greetz,

Wim
 
J

Joel

The code will work from any network drive that you have priledges. I just
used c: as an example.
 
J

Joel

Is the drive mapped? The best think to do is to map the drive on your
computer. Open a Windows Explorer - Tools Menu - Map Netwrok Drive. Choose
a leeter and type the networkpath like the example shown. Make sure you
check the box to recopnnect a login. if any boxes ask for you to remember
password also check these boxes.

You should be able to get to the file using your windows explorer. Get this
working before trying the code.
 
W

Wim VR

Hello Joel,

What if the server is asking for a user and password. Is there also a code
for?

Greetz,

Wim
 
W

Wim VR

The Public folder is not on the C drive but is a part of outlook structure.
Its a shared public folder in outlook but maybe I could retreive it from the
server with your code?
 
J

Joel

Const MyPath = "c:\temp"

CreateObject("Outlook.Application").GetNamespace("MAPI").Folder(MyPath)
 
W

Wim VR

Hello Joel,

I can't create a shortcut or a path to the Public Folder. I now use this
code but offcourse it doesn't work:

Set OLF = GetObject("",
"Outlook.Application").GetNamespace("MAPI").GetFolder("Public Folders\All
Public Folders\A-contactpersonen")
If OLF Is Nothing Then
Set OLF =
CreateObject("Outlook.Application").GetNamespace("MAPI").GetFolder("Public
Folders\All Public Folders\A-contactpersonen")
End If
 
J

Joel

Don't remember how to do this. Did it once earlier in the year but can't
find my documentation.. Repost your request askingf specifically aout the
password problem.
 

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