| | |
Retrieve Contacts from Exchange Public Folder
Please support our VB.NET advertiser: $4.95 a Month - ASP.NET Web Hosting – Click Here!
![]() |
I just struggled for 2 days to solve this same problem for my company--except I'm using PHP. Your job should be a bit easier since all the official examples are in VBScript, VB, VB.NET, C#, or C++.
I would direct you to the Microsoft WebDAV Reference wth code examples. Click "Exchange Store WebDAV Protocol", then explore the Methods from there.
http://msdn.microsoft.com/library/de...ces_webdav.asp
In dealing with Contacts, you'll also find this reference helpful--it lists all the Exchange "person" properties and their schema type.
http://msdn.microsoft.com/library/de...ses_person.asp
I have documented my PHP solution. It's brand new and works, but no doubt I'll be improving and expanding it as time goes by. Notice my last code example is "Search for contacts that match a certain criteria". This example is close to what you want to do. Although my code is PHP, the actual WebDAV XML query is the same as you need--and that's the trickiest part of WebDAV.
http://www.troywolf.com/articles/php...v_examples.php
I would direct you to the Microsoft WebDAV Reference wth code examples. Click "Exchange Store WebDAV Protocol", then explore the Methods from there.
http://msdn.microsoft.com/library/de...ces_webdav.asp
In dealing with Contacts, you'll also find this reference helpful--it lists all the Exchange "person" properties and their schema type.
http://msdn.microsoft.com/library/de...ses_person.asp
I have documented my PHP solution. It's brand new and works, but no doubt I'll be improving and expanding it as time goes by. Notice my last code example is "Search for contacts that match a certain criteria". This example is close to what you want to do. Although my code is PHP, the actual WebDAV XML query is the same as you need--and that's the trickiest part of WebDAV.
http://www.troywolf.com/articles/php...v_examples.php
•
•
Join Date: May 2009
Posts: 1
Reputation:
Solved Threads: 0
'Article from MSDN
'http://msdn.microsoft.com/en-us/library/aa168022(office.11).aspx
' Create Outlook application.
Dim oApp As Outlook.Application = New Outlook.Application
' Get namespace and Contacts folder reference.
Dim oNS As Outlook.NameSpace = oApp.GetNamespace("MAPI")
'Set MAPI folder to a location
Dim cContacts As Outlook.MAPIFolder = oNS.Folders("Public Folders").Folders("All Public Folders").Folders("Contacts")
' Dim collection
Dim oItems As Outlook.Items = cContacts.Items
Console.Write(oItems.Count)
Dim i As Int16 = 0
For Each item In oItems
Try
Dim oCt As Outlook.ContactItem
oCt = item
Console.WriteLine(i.ToString + " - " + oCt.FullName)
i = i + 1
'Need to release Oct because it craps out at 247 records with the following error
'Your server administrator has limited the number of items you can open simultaneously.
'Try closing messages you have opened or removing attachments and images from unsent
'messages you are composing
System.Runtime.InteropServices.Marshal.ReleaseComObject(oCt)
Catch ex As ExecutionEngineException
MsgBox(ex.Message)
End Try
Next
End Sub
'http://msdn.microsoft.com/en-us/library/aa168022(office.11).aspx
' Create Outlook application.
Dim oApp As Outlook.Application = New Outlook.Application
' Get namespace and Contacts folder reference.
Dim oNS As Outlook.NameSpace = oApp.GetNamespace("MAPI")
'Set MAPI folder to a location
Dim cContacts As Outlook.MAPIFolder = oNS.Folders("Public Folders").Folders("All Public Folders").Folders("Contacts")
' Dim collection
Dim oItems As Outlook.Items = cContacts.Items
Console.Write(oItems.Count)
Dim i As Int16 = 0
For Each item In oItems
Try
Dim oCt As Outlook.ContactItem
oCt = item
Console.WriteLine(i.ToString + " - " + oCt.FullName)
i = i + 1
'Need to release Oct because it craps out at 247 records with the following error
'Your server administrator has limited the number of items you can open simultaneously.
'Try closing messages you have opened or removing attachments and images from unsent
'messages you are composing
System.Runtime.InteropServices.Marshal.ReleaseComObject(oCt)
Catch ex As ExecutionEngineException
MsgBox(ex.Message)
End Try
Next
End Sub
![]() |
Similar Threads
- Accessing MS exchange public calendar using PHP (PHP)
- Outlook 2003 and Exchange Server (Visual Basic 4 / 5 / 6)
- Public folder too large (Windows Vista and Windows 7)
- Auto-reply for a public mailbox in Exchange (Windows NT / 2000 / XP)
- Rules wizard in Outlook 2k, how to add to a sript (Windows NT / 2000 / XP)
- public folder items not opening in outlook 2000 (Windows NT / 2000 / XP)
- moving public folders stumped (Windows NT / 2000 / XP)
Other Threads in the VB.NET Forum
- Previous Thread: DataGrid to Excel Export as a ZIP file
- Next Thread: dispaly date only in vb.net
| Thread Tools | Search this Thread |
"crystal .net .net2005 30minutes 2005 2008 access account add arithmetic array assignment basic box button buttons center check code component connectionstring convert cpu crystalreport data database databasesearch datagrid datagridview design dissertation dissertations dissertationthesis dosconsolevb.net dropdownlist editvb.net excel file-dialog firewall folder ftp generatetags hardcopy image images insert intel isnumericfuntioncall math monitor mssqlbackend mysql navigate net networking opacity output passingparameters peertopeervideostreaming picturebox1 port printpreview problem problemwithinstallation project record reports" reuse savedialog searchvb.net select serial storedprocedure string tcp temp text textbox timer toolbox trim updown user useraccounts usercontrol vb vb.net vb.netcode vb.netformclosing()eventpictureboxmessagebox vb.nettoolboxvisualbasic2008sidebar vb2008 vbnet view visual visualbasic visualbasic.net visualstudio visualstudio2008 web wpf





