Group:  Microsoft Outlook ยป microsoft.public.outlook.program_addins
Thread: MessageClass and Outlook 2007

MessageClass and Outlook 2007
OutlookWiz 11/26/2008 5:19:01 PM
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
Re: MessageClass and Outlook 2007
"Dmitry Streblechenko" <dmitry[ at ]dimastr.com> 11/26/2008 8:14:18 PM
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
-
"OutlookWiz" <OutlookWiz[ at ]discussions.microsoft.com> wrote in message
news:8839A665-0A2B-41BF-8E58-6924D809AC17[ at ]microsoft.com...
[Quoted Text]
>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


Re: MessageClass and Outlook 2007
OutlookWiz 11/26/2008 11:38:02 PM
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.

"Dmitry Streblechenko" wrote:

[Quoted Text]
> 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
> -
> "OutlookWiz" <OutlookWiz[ at ]discussions.microsoft.com> wrote in message
> news:8839A665-0A2B-41BF-8E58-6924D809AC17[ at ]microsoft.com...
> >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
>
>
>
Re: MessageClass and Outlook 2007
"Ken Slovak - [MVP - Outlook]" <kenslovak[ at ]mvps.org> 11/26/2008 11:43:29 PM
Have you been calling Marshal.ReleaseComObject() on the appointments and
then setting them to null before any calls to GC.Collect() and
WaitForPendingFinalizers()?

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


"OutlookWiz" <OutlookWiz[ at ]discussions.microsoft.com> wrote in message
news:5730EC9C-011F-4679-A851-EBA84D6FBC84[ at ]microsoft.com...
[Quoted Text]
>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.

Re: MessageClass and Outlook 2007
OutlookWiz 12/16/2008 10:23:01 AM
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

"Ken Slovak - [MVP - Outlook]" wrote:

[Quoted Text]
> Have you been calling Marshal.ReleaseComObject() on the appointments and
> then setting them to null before any calls to GC.Collect() and
> WaitForPendingFinalizers()?
>
> --
> 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
>
>
> "OutlookWiz" <OutlookWiz[ at ]discussions.microsoft.com> wrote in message
> news:5730EC9C-011F-4679-A851-EBA84D6FBC84[ at ]microsoft.com...
> >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.
>
>

Home | Search | Terms | Imprint
Newsgroups Reader