MessageClass and Outlook 2007

O

OutlookWiz

I am creating an addin using C# and want to convert existing appointment item
to use my custom form once the button in the ribbon is clicked. (the active
inspector)

I have tried different solutions but not fully succeeded

a) Changing the message class and then call save . This is not working form
still pointin to IPM.Appointment

b) Changing the Message Class then close the item and gets the item from the
seesion by its entryID. This is not working as well and when I opened the
appointment then it still using the IPM.Appointment class instead of my
custom class. Although when I am debugging the item its message clase is
changed to custom message class but on calendar display its still using the
IPM.Appointment.

c) Deleting the current Item and creating the New Item using Items.Add
method and specifying the custom message class and then copying the old
Appointment Item to the new Item. This is working in case of single items but
in case of Recurring Items this technique fails and also I will loose
tracking and other information.

This is only happening Outlook 2007. it is only happening on Appointment
Items. it seems that Outlook 2007 is not releasing some object to refresh the
item to use the new message class. We have been using DC.collect,
DC.WaitForPendingFinalizers and GC.CollectObject etc etc buyt top no avial.

Has any body got a reliable fool proof way of changing the message class of
the item whilst the item is open and having the inspector load the item
inside the custom form

Please let me know.

Many thanks
 
D

Dmitry Streblechenko

Outlook really likes to hold on to the appointment items...
In case of (c), why not work with the master appointment (returns by
AppointmentItem.Parent) if AppointmentItem.RecurrenceState =
olApptOccurrence/olApptException?

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
 
O

OutlookWiz

I know it does Dmitry !

Is this a bug with Outlook 2007. Sue Certainly thought it is.! - can
anybody from MS shed any light to why it seems that sometimes only a restart
of outlook "unlocks" the appointment item - or even better a viable
work-around. !

Thanks for the suggestion - we do that - however we loose tracking
information from the item. hmm - just thought Is there a way to copy an item
(the whole object & all...) and then spoof its entry ID. You see the
deperate measures that we
are willing to take to make this work.
 
K

Ken Slovak - [MVP - Outlook]

Have you been calling Marshal.ReleaseComObject() on the appointments and
then setting them to null before any calls to GC.Collect() and
WaitForPendingFinalizers()?
 
O

OutlookWiz

Yes

I have since found the answer. You need to also place Application.DoEvents
before re-opening the form (it seems that Outlook likes to take its time
doing stuff), and the one that I nearly shot myself - the preview pae. If the
preview pane is visible the item is effectively locked no matter what you do
(nice one MS). So remove it before doing the operation and then put it back
on
 

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