Where to store a unique reference in an Appointment Item?

A

AlanGlover

I'm writing an Outlook Add-in to link calendar appointments with room
bookings in our room and resources booking application. I need to store a
room booking reference with the calendar appointment so that if they move or
delete the appointment I can move or delete the room booking.

I don't want to use the outlook item user properties as this makes the
appointment a "one-off" non-standard item.

I tried using the globalObjId MAPI property (because I noticed this is where
Outlook stores the UID when an iCal or vCal is received). But Outlook (or
something) changes this property from time to time and I lose my reference.

I tried creating a named property and this is OK unless the user deletes an
appointment using the right mouse button menu. In this case I catch the
Item_Add event in the Deleted Items folder but when I look in the MAPIObject
my named property has dissappeared.

Do named properties get lost when items are moved from folder to folder? Is
there any safe place I can store my booking reference?
 
K

Ken Slovak - [MVP - Outlook]

Both UserProperties and MAPI named properties on items should remain on
those items even if they're moved. I also don't see why creating a
UserProperty would one-off an item unless the item is using a custom form.

Once a global ObjectID property is assigned to an item it's supposed to not
change, that's the entire purpose of that property. Since EntryID may change
when an item is moved or deleted, depending on the store provider, that
property was created to allow tracking of changed meetings and appointments
despite EntryID changes.
 
A

AlanGlover

Thanks for this.

I suppose the second paragraph means I shouldn't write to this property?

The first para is a great help though I have clearly misunderstood something
I read (or read some internet garbage), and it sounds like I can just use a
user property. Will try that tomorrow.

Thanks

Alan
 
K

Ken Slovak - [MVP - Outlook]

Writing to GlobalObjectID is a real good way to screw things up with
meetings and appointments.
 
A

AlanGlover

I still have problems I'm afraid. I am adding a userproperty when the user
saves a new appointment and setting its value with my user reference string.
I can go to the saved appointment with Outlook Spy and my property is there
and set correctly.

I right click and delete the appointment. Go into the deleted items folder
and open the item with Outlook Spy - the user property has gone -
userproperties.count is 0.

Alan
 
A

AlanGlover

OK call off the rescue party! It seems I have to save the appointment item
again if I update the userproperties during the write event. The change does
persist for a while so Outlook Spy shows it and that made me think it was
saved OK, but it wasn't.
 

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