Public Folder Contacts in vb.net

  • Thread starter Thread starter Chris Thunell
  • Start date Start date
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)
 
-----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
 
Back
Top