How to detect Custom form?

M

Matt Williamson

I'm having a little trouble detecting a custom form using CDO. I'm trying to
walk the Public folder structure looking for contact folders, but we use a
custom contact folder with an Id of "IPM.Contact.Contact Manager". I'd like
to be able to detect if I've found this folder before going deeper into the
individual messages it contains. Can someone point me in the right
direction? Here is the code I have written so far. I'm doing this in vb6 if
that matters at all.

Const PR_IPM_PUBLIC_FOLDERS_ENTRYID = &H66310102
Const CdoPR_CONTAINER_CLASS = &H3613001E

Dim objFolder As MAPI.Folder
Dim objSubFolder As MAPI.Folder
Dim objTopFolder As MAPI.Folder
Dim objMessage As MAPI.Message
Dim objInfoStores As MAPI.InfoStores
Dim objInfoStore As MAPI.InfoStore
Dim objFields As MAPI.Fields
Dim strRootID As String, strFolderType As String

'Routine to get "ALL Public Folders" and returns as objTopFolder (works
great)

For Each objFolder In objTopFolder.Folders
Debug.Print objFolder.Name
For Each objSubFolder In objFolder.Folders
Debug.Print "--" & objSubFolder.Name
For Each objMessage In objSubFolder.Messages
If Not objMessage Is Nothing Then

Set objFields = objMessage.Fields
strFolderType = objFields.Item(CdoPR_CONTAINER_CLASS) ' this
line is erroring out
If strFolderType = "IPF.Contact.Contact Manager" Then
Debug.Print objFields.Class
End If

End If
Debug.Print "----" & objMessage.Class
Next
Next
Next

The error I'm getting is a runtime CDO error MAPI_E_NOT_FOUND(8004010F).
I've found quite a few references to it in the archive, but nothing that
tells me what's going on here.

Any help would be appreciated.

Matt
 
M

Matt Williamson

Nevermind..

I figured it out.

if objMessage.type = "IPF.Contact.Contact Manager" did it..
 

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