Public Folder Contacts in vb.net

C

Chris Thunell

I need to loop through a public folder on our exchange server and get some
information out of each record... I have the following code, but I can't
seem to figure out how to reference the public folder:
Dim objFolder As Outlook.MAPIFolder

Dim objItem As Object

Dim colItems As Items

Dim objItem2 As ContactItem

'some where i need: ("\\Public Folders\All Public Folders\My Contacts")

objFolder = objItem

colItems = objFolder.Items

'now use the colItems in

For Each objItem2 In colItems

MessageBox.Show(objItem2.CompanyName.ToString)

Next

Thanks for your help!
Chris Thunell
(e-mail address removed)
 
J

Jonathan Parminter

-----Original Message-----
I need to loop through a public folder on our exchange server and get some
information out of each record... I have the following code, but I can't
seem to figure out how to reference the public folder:
Dim objFolder As Outlook.MAPIFolder

Dim objItem As Object

Dim colItems As Items

Dim objItem2 As ContactItem

'some where i need: ("\\Public Folders\All Public Folders\My Contacts")

objFolder = objItem

colItems = objFolder.Items

'now use the colItems in

For Each objItem2 In colItems

MessageBox.Show(objItem2.CompanyName.ToString)

Next

Thanks for your help!
Chris Thunell
(e-mail address removed)
Hi Chris,

I hope the following code snippet helps

****** code starts *********

Dim olApp As Outlook.Application
Dim olNameSpace As Outlook.NameSpace
Dim olPublicFolder As Outlook.MAPIFolder
Dim olCallCentre As Outlook.MAPIFolder
Dim olMailItem As Outlook.MailItem

Set olApp = CreateObject("Outlook.Application")
Set olNameSpace = olApp.GetNamespace("MAPI")
Set olPublicFolder = olNameSpace.Folders("Public
Folders")
Set olPublicFolder = olPublicFolder.Folders("All
Public Folders")
Set olCallCentre = olPublicFolder.Folders("Call
Centre")

Set olMailItem = olCallCentre.Items.Add("IPM.Note.Call
Centre Response to Web Email Queries")
olMailItem.Display

********code ends *********

Luck
Jonathan
 

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