Notices
Computer & Technology Related Post here for help and discussion of computing and related technology. Internet, TVs, phones, consoles, computers, tablets and any other gadgets.

VB > Exchange Public Folders - CDO?

Thread Tools
 
Search this Thread
 
Old 09 December 2003, 09:06 AM
  #1  
ChrisB
Moderator
Thread Starter
 
ChrisB's Avatar
 
Join Date: Dec 1998
Location: Staffs
Posts: 23,573
Likes: 0
Received 0 Likes on 0 Posts
Question

Looking to get access to a set of Public Folders with contacts, calendar etc from a VB app. Read contacts, edit (via the OL Contact form not natively in VB) etc.

Surfing around and CDO seems to be one way to do it.

Any book recommendations or other methods which work well?

TIA,

Chris.
Old 09 December 2003, 09:21 AM
  #2  
elgordano
Scooby Regular
 
elgordano's Avatar
 
Join Date: Jan 2002
Location: Herts
Posts: 1,125
Likes: 0
Received 0 Likes on 0 Posts
Post

I use CDO to look for certain emails in my inbox and it works very reliably. It runs on a schedule tasks and looks for emails with certain words in the title.

Gordo
Old 09 December 2003, 11:08 AM
  #3  
Fosters
Scooby Regular
 
Fosters's Avatar
 
Join Date: Jul 2000
Location: Islington
Posts: 2,145
Likes: 0
Received 0 Likes on 0 Posts
Post

Don't use CDO, it's not supported anymore. I've written a few apps to retrieve mass information using CDO and it's quick and efficient.

Use outlook object lib instead:
'top of form
Private objOutlook As New Outlook.Application
Private objNamespace As Outlook.NameSpace

Sub StartOutlook()
On Error Resume Next
Set objNamespace = objOutlook.GetNamespace("MAPI")
objNamespace.Logon , , True, True
On Error GoTo 0
End Sub
Sub StopOutlook()
objNamespace.Logoff
Set objNamespace = Nothing
Set objOutlook = Nothing
End Sub
.
.
.
Dim NoticeBoard As Outlook.MAPIFolder
Set NoticeBoard = objNamespace.Folders("Public Folders").Folders("All Public Folders").Folders("EUROPE")

useful methods
NoticeBoard.Items(i).Attachments(1).FileName
NoticeBoard.Items(i).Attachments(1).SaveAsFile strFilename

I'll post other code as I find it.

If you want CDO code, then (reference CDO 1.21):
code's been hacked to remove confidential stuff
Dim strProfileInfo As String
Dim MAPIMess As MAPI.Message
Dim y As Integer, z As Integer, m As Integer, f As Integer, g As Integer, x As Integer
Dim RC As Integer
Dim objSession As MAPI.Session
Dim objAddrEntries As AddressEntries
Dim objAddressEntry As AddressEntry
Dim objFilter As AddressEntryFilter
Dim Cmd As New ADODB.Command
Dim RSRead As New ADODB.Recordset
Const strServer = "Server"
Const strMailbox = "mailbox"


strProfileInfo = strServer & vbLf & strMailbox

Set objSession = CreateObject("MAPI.Session")
objSession.Logon , , False, False, , True, strProfileInfo
Set objAddrEntries = objSession.AddressLists _
("Global Address List").AddressEntries
Set objFilter = objAddrEntries.Filter
'objFilter.Fields.Add CdoPR_SURNAME, "Walker"
'objFilter.Fields.Add CdoPR_MHS_COMMON_NAME, "Adrian"
'objFilter.Fields.Add CdoPR_GIVEN_NAME, "Jim"
On Error Resume Next

For Each objAddressEntry In objAddrEntries
sData(0, 0) = "Display (name)": sData(0, 1) = objAddressEntry.Fields(&H3001001E).Value
sData(1, 0) = "Alias": sData(1, 1) = objAddressEntry.Fields(&H3A00001E).Value
sData(2, 0) = "Exchange server alias": sData(2, 1) = objAddressEntry.Fields(&H3A0F001E).Value
sData(3, 0) = "First (name)": sData(3, 1) = objAddressEntry.Fields(&H3A06001E).Value
sData(4, 0) = "Initials": sData(4, 1) = objAddressEntry.Fields(&H3A0A001E).Value
sData(5, 0) = "Last (name)": sData(5, 1) = objAddressEntry.Fields(&H3A11001E).Value
sData(6, 0) = "Address": sData(6, 1) = objAddressEntry.Fields(&H3A29001E).Value
sData(7, 0) = "Title": sData(7, 1) = objAddressEntry.Fields(&H3A17001E).Value
sData(8, 0) = "Company": sData(8, 1) = objAddressEntry.Fields(&H3A16001E).Value
sData(9, 0) = "City": sData(9, 1) = objAddressEntry.Fields(&H3A27001E).Value
sData(10, 0) = "Department": sData(10, 1) = objAddressEntry.Fields(&H3A18001E).Value
sData(11, 0) = "State": sData(11, 1) = objAddressEntry.Fields(&H3A28001E).Value
sData(12, 0) = "Office": sData(12, 1) = objAddressEntry.Fields(&H3A19001E).Value
sData(13, 0) = "Zip code": sData(13, 1) = objAddressEntry.Fields(&H3A2A001E).Value
sData(14, 0) = "Assistant": sData(14, 1) = objAddressEntry.Fields(&H3A30001E).Value
sData(15, 0) = "Country": sData(15, 1) = objAddressEntry.Fields(&H3A26001E).Value
sData(16, 0) = "Phone": sData(16, 1) = objAddressEntry.Fields(&H3A08001E).Value
sData(17, 0) = "Business 2": sData(17, 1) = objAddressEntry.Fields(&H3A1B001E).Value
sData(18, 0) = "Fax": sData(18, 1) = objAddressEntry.Fields(&H3A23001E).Value
sData(19, 0) = "Assistant": sData(19, 1) = objAddressEntry.Fields(&H3A2E001E).Value
sData(20, 0) = "Home": sData(20, 1) = objAddressEntry.Fields(&H3A09001E).Value
sData(21, 0) = "Home 2": sData(21, 1) = objAddressEntry.Fields(&H3A2F001E).Value
sData(22, 0) = "Mobile": sData(22, 1) = objAddressEntry.Fields(&H3A1C001E).Value
sData(23, 0) = "Pager": sData(23, 1) = objAddressEntry.Fields(&H3A21001E).Value
sData(24, 0) = "Notes": sData(24, 1) = objAddressEntry.Fields(&H3004001E).Value
sData(25, 0) = "SMTP e-mail address": sData(25, 1) = objAddressEntry.Fields(&H39FE001E).Value
sData(26, 0) = "Display from Exchange address book": sData(26, 1) = objAddressEntry.Fields(&H80B9000B).Value
sData(27, 0) = "Contains the folder path if the address entry is a public folder": sData(27, 1) = objAddressEntry.Fields(&H8004001E).Value
sData(28, 0) = "Rich text is enabled": sData(28, 1) = objAddressEntry.Fields(&H3A40000B).Value
Next

Old 09 December 2003, 11:11 AM
  #4  
Fosters
Scooby Regular
 
Fosters's Avatar
 
Join Date: Jul 2000
Location: Islington
Posts: 2,145
Likes: 0
Received 0 Likes on 0 Posts
Post

I used to frequent www.cdolive.com to get info.
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
IanG1983
Wanted
7
03 October 2015 06:47 PM
Danny0608
Subaru
6
27 September 2015 02:16 PM
Littleted
Computer & Technology Related
4
25 September 2015 09:55 PM
alcazar
Non Scooby Related
5
18 September 2015 11:49 PM
Danny0608
Subaru Parts
0
12 September 2015 02:59 PM



Quick Reply: VB > Exchange Public Folders - CDO?



All times are GMT +1. The time now is 03:38 AM.