Mail form VB code.

T

T-rev

Have you a VB snippet I could use please.
Problem is I have a published form to a folder. I can add to the
messageBody, or display buttons based on messageProperties. But I need to
get access to mapi custom properties which I have placed on the message.

The don't seem to be in userProperties or itemProperties, I know they are on
the mapi object as I placed them there and can see them on using outlookSpy.

In the form designed is there any way of using
If Item.MapiObject ("ExampleProperty") = TRUE Then
strBody = strBody & "Property Present"
End If

Item.Body = strBody

Thanks for your help.
 
S

Sue Mosher [MVP-Outlook]

Look on your form's All Fields page. Do your custom properties appear in the User-defined Fields in This Item list? If so, then you should be able to access them through the UserProperties syntax. If that is not working for you, show a code snippet.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
T

T-rev

No the properties do not exist in this list, these are userProperties added
to a form. If I add a property to this list it appears on the form
description and userProperties fields which we do not store in our
messageStore. Basically I am writing a form which is to look at properties
most of which are fine ie.

Sub StampDate()

strBody = Item.Body

strBody = Now() & vbCrLf & vbCrLf & strBody

strBody = Item.MessageClass & strBody

If Item.UserProperties.Count > 0 Then

For intCount = 1 To Item.UserProperties.Count

strBody = vbCrLf & Item.UserProperties.Item(intCount).Name & strBody

strBody = vbCrLf & Item.UserProperties.Item(intCount).Value & strBody

Next

End If

Item.Body = strBody

End Sub

Properties which are normally on the mailItem are fine eg. messageClass, but
if there are custom named Properties on the mapiObject - eg. property 0x8001
propertyName 'Cached'

If I search through all the userProperties or itemProperties it is not
present there. Now if I add a property called Cached to the form, I can
then see it in the formDescription and in the UserProperties field on the
mapiObject. Which means I would have to know the structure of the
UserProperties in order to fill this property field in ahead of time. have
you any code snippets of how to get access to properties within the
mapiObject.

Eg. if you browse(MailItem.MapiObject) I can see the properties on the item
that I am concerned with - some custom ones placed on each item by the
messageStore. A general example would be PR_RTF_IN_SYNC on the mapiObject -
how would I obtain this property value from the mapiObject within the form.

Thanks for your help.


Look on your form's All Fields page. Do your custom properties appear in the
User-defined Fields in This Item list? If so, then you should be able to
access them through the UserProperties syntax. If that is not working for
you, show a code snippet.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
T

T-rev

thanks - userProperties now contain items which I have added from the folder
list, - the values of which seem to be got correctly from the mapiObject.

thanks for your help.

For some reason I was having problems with numbers referencing ULONGs
instead of integers but this has now resolved itself.

Look on your form's All Fields page. Do your custom properties appear in the
User-defined Fields in This Item list? If so, then you should be able to
access them through the UserProperties syntax. If that is not working for
you, show a code snippet.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 

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