How to add a user defined field to Redemption RDOContactItem object?

C

CataGeek

Hi there. I've changed my code that talks to Outlook to use the
Redemption RDO objects instead. When I create a new contact I need to
define some user defined fields for each contact. Using the Outlook
objects I could do this:

Dim oUP As Outlook.UserProperty
Dim oContact As Outlook.ContactItem

With oContact
' set values for standard properties
' Now add my user defined fields
oUP = .UserProperties.Add("Area",
Outlook.OlUserPropertyType.olText)
oUP.Value =
dtRow.Item(objContact.GetOrdinalCustom("Area")).ToString
oUP = .UserProperties.Add("Company - Yes/No",
Outlook.OlUserPropertyType.olText)
oUP.Value = dtRow.Item(objContact.GetOrdinalCustom("CompanyY/N"))

.Save
End With

Changing my code to use the Redemption.RDOContactItem object, I no
longer get access to the UserProperties collection. I've googled much
and so far haven't found a way to do this. Can anyone help me out
with this?
 
K

Ken Slovak - [MVP - Outlook]

If you want to add actual UserProperties use the Outlook object model for
that. After the properties are added to the items you can then use RDO.

If you then want to access the UserProperties from RDO you can do so using
the Fields collection of the item and using the UserProperty name with
PS_PUBLIC_STRINGS and the type of UserProperty.

For example:

Const PS_PUBLIC_STRINGS = "{00062008-0000-0000-C000-000000000046}"
Const PT_LONG = &H3 ' example using a Long property (32 bit signed
integer)
Const PROP_NAME = "MyUserProperty"

' the RDO item is rdoItem

Dim tag As Long

tag = rdoItem.GetIDsFromNames(PS_PUBLIC_STRINGS, PROP_NAME)
tag = tag Or PT_LONG

You can then use tag with the Fields collection to access your UserProperty.

All UserProperties are created in the PS_PUBLIC_STRINGS namespace. However
the UserProperties collection also sets other properties in the folder when
a UserProperty is created, so using RDO to create a property in
PS_PUBLIC_STRINGS isn't enough to make that property a UserProperty for
Outlook.
 
C

CataGeek

If you want to add actual UserProperties use the Outlook object model for
that. After the properties are added to the items you can then use RDO.

If you then want to access the UserProperties from RDO you can do so using
the Fields collection of the item and using the UserProperty name with
PS_PUBLIC_STRINGS and the type of UserProperty.

For example:

Const PS_PUBLIC_STRINGS = "{00062008-0000-0000-C000-000000000046}"
Const PT_LONG = &H3    ' example using a Long property (32 bit signed
integer)
Const PROP_NAME = "MyUserProperty"

' the RDO item is rdoItem

Dim tag As Long

tag = rdoItem.GetIDsFromNames(PS_PUBLIC_STRINGS, PROP_NAME)
tag = tag Or PT_LONG

You can then use tag with the Fields collection to access your UserProperty.

All UserProperties are created in the PS_PUBLIC_STRINGS namespace. However
the UserProperties collection also sets other properties in the folder when
a UserProperty is created, so using RDO to create a property in
PS_PUBLIC_STRINGS isn't enough to make that property a UserProperty for
Outlook.

Thanks for that Ken. I've been coming to the conclusion that I have to
use the Outlook objects rather than redemption to do this, and it's
great to get such a clear explaination. Much appreciated!
 
D

Dmitry Streblechenko

Next version of Redemption (4.6) will expose UserProperties collection on
all RDO items.
Keep in mind that a user property is nothing but a named property
(accessible through RDOMail.Fields[]), but Outlook alos expects user
property definition in yet another named property blob. UserProperties reads
and updates that blob.
Contact me at my private e-mail address if you want a beta version.
--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
If you want to add actual UserProperties use the Outlook object model for
that. After the properties are added to the items you can then use RDO.

If you then want to access the UserProperties from RDO you can do so using
the Fields collection of the item and using the UserProperty name with
PS_PUBLIC_STRINGS and the type of UserProperty.

For example:

Const PS_PUBLIC_STRINGS = "{00062008-0000-0000-C000-000000000046}"
Const PT_LONG = &H3 ' example using a Long property (32 bit signed
integer)
Const PROP_NAME = "MyUserProperty"

' the RDO item is rdoItem

Dim tag As Long

tag = rdoItem.GetIDsFromNames(PS_PUBLIC_STRINGS, PROP_NAME)
tag = tag Or PT_LONG

You can then use tag with the Fields collection to access your
UserProperty.

All UserProperties are created in the PS_PUBLIC_STRINGS namespace. However
the UserProperties collection also sets other properties in the folder
when
a UserProperty is created, so using RDO to create a property in
PS_PUBLIC_STRINGS isn't enough to make that property a UserProperty for
Outlook.

Thanks for that Ken. I've been coming to the conclusion that I have to
use the Outlook objects rather than redemption to do this, and it's
great to get such a clear explaination. Much appreciated!
 

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