PC Review


Reply
Thread Tools Rate Thread

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

 
 
CataGeek
Guest
Posts: n/a
 
      9th Jul 2008
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?
 
Reply With Quote
 
 
 
 
Ken Slovak - [MVP - Outlook]
Guest
Posts: n/a
 
      9th Jul 2008
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.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"CataGeek" <(E-Mail Removed)> wrote in message
news:44c77204-4b26-4d56-b8ac-(E-Mail Removed)...
> 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?


 
Reply With Quote
 
CataGeek
Guest
Posts: n/a
 
      9th Jul 2008
On Jul 10, 1:45*am, "Ken Slovak - [MVP - Outlook]"
<kenslo...@mvps.org> wrote:
> 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.
>
> --
> Ken Slovak
> [MVP - Outlook]http://www.slovaktech.com
> Author: Professional Programming Outlook 2007.
> Reminder Manager, Extended Reminders, Attachment Options.http://www.slovaktech.com/products.htm
>
> "CataGeek" <k...@dyke.geek.nz> wrote in message
>
> news:44c77204-4b26-4d56-b8ac-(E-Mail Removed)...
>
> > 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?


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!
 
Reply With Quote
 
Dmitry Streblechenko
Guest
Posts: n/a
 
      10th Jul 2008
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
-
"CataGeek" <(E-Mail Removed)> wrote in message
news:6b5d0d73-abe4-41d7-ae5b-(E-Mail Removed)...
On Jul 10, 1:45 am, "Ken Slovak - [MVP - Outlook]"
<kenslo...@mvps.org> wrote:
> 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.
>
> --
> Ken Slovak
> [MVP - Outlook]http://www.slovaktech.com
> Author: Professional Programming Outlook 2007.
> Reminder Manager, Extended Reminders, Attachment
> Options.http://www.slovaktech.com/products.htm
>
> "CataGeek" <k...@dyke.geek.nz> wrote in message
>
> news:44c77204-4b26-4d56-b8ac-(E-Mail Removed)...
>
> > 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?


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!


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
What is the recommendet way to read/write a user defined Field (Named Property) in the MailItem Object using VSTO? Michael Schmitz Microsoft Outlook Form Programming 5 22nd Apr 2009 08:27 PM
What is the recommendet way to read/write a user defined Field (Named Property) in the MailItem Object using VSTO? Michael Schmitz Microsoft Outlook Program Addins 1 22nd Apr 2009 07:26 AM
Field Property (OldValue) not available in Field Object defined withDim As Field? insomniux Microsoft Access VBA Modules 2 11th Apr 2009 03:19 PM
Link/import OL contacts with category field + user defined field =?Utf-8?B?SVM=?= Microsoft Access External Data 0 7th May 2005 01:44 AM
reference to DAO object causes 'User-defined ttype not defined' error =?Utf-8?B?ZGVteWFu?= Microsoft Access VBA Modules 3 20th Jan 2004 01:04 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:16 AM.