View Single Post
  #5  
Old December 6th 07, 08:05 PM posted to microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Empty UserProperties and PropertyAccessor ( Outlook Spy )

How are you trying to save the user properties? Are you binding the fields
on the form region to already existing user properties or one created when
you bind the fields?

--
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


"Jeff" wrote in message
...
Well... it get's weireder.... It appears to happen only with the
FormRegions I am making, using OL's form designer.

If I use a FormRegion from sample code, it all works fine. But if I create
a new FormRegion using Tools-Forms-Design a Form
the new form will not save the UserProperties :S

VERY STRANGE!

Any ideas anyone?

"Jeff" wrote in message
...
Alright.... Using Dmitry Streblechenko's excellent Outlook Spy product I
discovered what the problem was / is.

I modified one of the Contact's using OL's All Properties page and what
ya know... the UserProperties were all saved and accessible via the Item?

So I used Outlook Spy to compare this Contact to one that didn't have the
UserProperties.

The Contact showing the problem was missing the IMAP "UserProperties"
PT_BINARY tag. So, even though all the UserProperties
themselves were stored in the IMAP IMessage Properties, since this
particular tag was missing, accessing the item via the Outlook objects
did not
return the UserProperties collection. I assume the IMAP "UserProperties"
tag is some kind of internal tab used by OL.

It seems ( at least via Native C++ ) if you have a custom Form Region
connected to ContactItem, OL will NOT save the UserProperties collection.
But, you can force it to by adding a "UserProperty" programmatically and
then saving the item ( the workaround ). Oddly, OL WILL save Form Region
generated UserProperties as IMAP Properties in the
{00020329-0000-0000-C000-000000000046} namespace.

I hope my explanation is a little clearer than mud and this helps someone
else.

Personally, I think this behaviour is an Outlook 2007 Form Region related
bug.

Thanks Dmitry!

"Jeff" wrote in message
...

Interestingly, using Outlook Spy, it does not see the UserProperties
either on the contact item, when it is in the folder ( selected ) but
DOES
when the item is open in the Form Region ( Outllook 2007 )

Looking at the item useing Outlook Spy's IMessage view, all the
properties are there.

Very Odd...

Any Ideas?




"Jeff" wrote in message
...
Hi All

I've got the following strange problem. Language == C++

I've added custom properties to the containg outlook contact folder and
create the contact item using replacement form regions. Within
the form regions all the custom values are saved and redisplayed every
time you open and close the contact item.

BUT, if I grab the items collection for the folder and access each
contact item, the UserProperties items are "empty". ie: have no value
and
a the count for the collection is 0

ie:
_ItemsPtr spItems = NULL;
MAPIFolderPtr spFdr = GetListingsFolder(m_spApp);
if(spFdr){
spItems = spFdr-Items;
}


if(spItems){
_ContactItemPtr spContact;
for(int i=1; i=spItems-Count; i++){
spContact = spItems-Item(i);

UserPropertiesPtr spProps = spContact-UserProperties;
int ic = spProps-Count;

ie:
UserPropertyPtr spProp = spContact-UserProperties-Item("RE MY
Value");
if(spProp ==NULL){
Barf.... Allways...
}

Strangly, I can access most of the custom properties using the
PropertyAccessor:

ie:
PropertyAccessor-GetProperty(http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000-000000000046}/RE%20MY%20Value);

But NOT if the custom property is a Currancy value. In the case of
currancy values, I can access them if I have just resaved them using
the form region, but not if Outlook
has been shut down and restarted. :S

It seems to me, that the UserProperties are not being loaded when the
items collection is filled. Is there any way to "Force" the loading of
the UserProperties for each item in the items collection?

Any ideas? Thanks!









Ads