Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

cdo , messagefilter and a user def. field

Status
Not open for further replies.

harmmeijer

Programmer
Mar 1, 2001
869
CN
I have a user difigned field called mytextfile in a contact.
Now I want to use the filter, lets say the mytextfile cannot be null.
Here is the code (it is vb because the asp will look almost the same) so far but I do not know how to do ot nor can I find a good example on the net:

Private Sub Form_Load()
Dim objSession As New MAPI.Session
Dim objFolder As MAPI.Folder
Dim objContacts As MAPI.Messages
Dim objContact As MAPI.Message
Dim objFilter As MAPI.MessageFilter

strProfileInfo = "server" & vbLf & "mailbox"

objSession.Logon "", "", False, True, 0, True, strProfileInfo
Set objFolder = objSession.GetDefaultFolder(CdoDefaultFolderContacts)
Set objContacts = objFolder.Messages
Set objFilter = objContacts.Filter

' both the statements below don't work
' objFilter.Fields.Add objContacts(1).Fields("mytextfile"), "hi"
' objFilter.Fields(45) = "hi"


End Sub
 
In this case it appears that your objFilter is probably a list of items rather than a single item. Try doing an objFilter.count to see if it gives you a numerical value.
-Tarwn ------------ My Little Dictionary ---------
Reverse Engineering - The expensive solution to not paying for proper documentation
 
objfilter.Fields.count gives me 0 because as you can see in the code above I am unable to add a field.
objfilter.count gives an error because objfilter does not support the count property or method.

this wil work but I am unable to search for user def fields.
objFilter.Fields.Add CdoPR_GIVEN_NAME, "hi"

The following site wil give you a good list of the field ID of outlook objects:

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top