Group:  Microsoft Outlook ยป microsoft.public.outlook.program_addins
Thread: Differentiate between Task and Task Request in NewInspector event

Geek News

Differentiate between Task and Task Request in NewInspector event
"Piyush Gupta" <indorewale[ at ]gmail.com> 2/6/2007 9:11:44 PM
Hi All,

I am handling NewInspector event to show my custom form when user
clicks on "New > Task" or "New > Task Request". But somehow I am
getting same message class (i.e. IPM.Task) for both commands.

Can anyone of you pls. suggest a way to determine that whether
NewInspector request is for "Task" or "Task Request"?

Thanks.

Re: Differentiate between Task and Task Request in NewInspector event
"Sue Mosher [MVP-Outlook]" <suemvp[ at ]outlookcode.com> 2/6/2007 9:16:52 PM
THe value of the Class property should be different.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"Piyush Gupta" <indorewale[ at ]gmail.com> wrote in message news:1170796304.650166.152160[ at ]j27g2000cwj.googlegroups.com...
[Quoted Text]
> Hi All,
>
> I am handling NewInspector event to show my custom form when user
> clicks on "New > Task" or "New > Task Request". But somehow I am
> getting same message class (i.e. IPM.Task) for both commands.
>
> Can anyone of you pls. suggest a way to determine that whether
> NewInspector request is for "Task" or "Task Request"?
>
> Thanks.
>
Re: Differentiate between Task and Task Request in NewInspector event
"Piyush Gupta" <indorewale[ at ]gmail.com> 2/6/2007 10:46:57 PM
On Feb 6, 1:16 pm, "Sue Mosher [MVP-Outlook]" <sue...[ at ]outlookcode.com>
wrote:
[Quoted Text]
> THe value of the Class property should be different.
>
> --
> Sue Mosher, Outlook MVP
> Author of Configuring Microsoft Outlook 2003
> http://www.turtleflock.com/olconfig/index.htm
> and Microsoft Outlook Programming - Jumpstart for
> Administrators, Power Users, and Developers
> http://www.outlookcode.com/jumpstart.aspx
>
> "Piyush Gupta" <indorew...[ at ]gmail.com> wrote in messagenews:1170796304.650166.152160[ at ]j27g2000cwj.googlegroups.com...
> > Hi All,
>
> > I am handling NewInspector event to show my custom form when user
> > clicks on "New > Task" or "New > Task Request". But somehow I am
> > getting same message class (i.e. IPM.Task) for both commands.
>
> > Can anyone of you pls. suggest a way to determine that whether
> > NewInspector request is for "Task" or "Task Request"?
>
> > Thanks.

Thanks Sue.

That's the problem I am having, No matter if user clicks on "New >
Task" or "New > Task Request", inspector.CurrentItem is of TaskItem
type only. My C# code goes like this:

Outlook.TaskRequestItem taskRequest = inspector.CurrentItem as
Outlook.TaskRequestItem;
Outlook.TaskItem task = inspector.CurrentItem as Outlook.TaskItem;

For new Task and Task Request, taskRequest variable remains null. Is
there any property of TaskItem (other than TeamTask as it is always
false) which can tell me the option selected by user?

Re: Differentiate between Task and Task Request in NewInspector event
"Ken Slovak - [MVP - Outlook]" <kenslovak[ at ]mvps.org> 2/6/2007 11:10:35 PM
Sue told you. It's Inspector.CurrentItem.Class.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Piyush Gupta" <indorewale[ at ]gmail.com> wrote in message
news:1170802017.275721.92000[ at ]j27g2000cwj.googlegroups.com...
[Quoted Text]
> Thanks Sue.
>
> That's the problem I am having, No matter if user clicks on "New >
> Task" or "New > Task Request", inspector.CurrentItem is of TaskItem
> type only. My C# code goes like this:
>
> Outlook.TaskRequestItem taskRequest = inspector.CurrentItem as
> Outlook.TaskRequestItem;
> Outlook.TaskItem task = inspector.CurrentItem as Outlook.TaskItem;
>
> For new Task and Task Request, taskRequest variable remains null. Is
> there any property of TaskItem (other than TeamTask as it is always
> false) which can tell me the option selected by user?
>

Re: Differentiate between Task and Task Request in NewInspector event
"Piyush Gupta" <indorewale[ at ]gmail.com> 2/6/2007 11:44:41 PM
On Feb 6, 3:10 pm, "Ken Slovak - [MVP - Outlook]" <kenslo...[ at ]mvps.org>
wrote:
[Quoted Text]
> Sue told you. It's Inspector.CurrentItem.Class.
>
> --
> Ken Slovak
> [MVP - Outlook]http://www.slovaktech.com
> Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
> Reminder Manager, Extended Reminders, Attachment Optionshttp://www.slovaktech.com/products.htm
>
> "Piyush Gupta" <indorew...[ at ]gmail.com> wrote in message
>
> news:1170802017.275721.92000[ at ]j27g2000cwj.googlegroups.com...
>
> > Thanks Sue.
>
> > That's the problem I am having, No matter if user clicks on "New >
> > Task" or "New > Task Request", inspector.CurrentItem is of TaskItem
> > type only. My C# code goes like this:
>
> > Outlook.TaskRequestItem taskRequest = inspector.CurrentItem as
> > Outlook.TaskRequestItem;
> > Outlook.TaskItem task = inspector.CurrentItem as Outlook.TaskItem;
>
> > For new Task and Task Request, taskRequest variable remains null. Is
> > there any property of TaskItem (other than TeamTask as it is always
> > false) which can tell me the option selected by user?

Sorry for the confusion. As I am writing C# code, Class property of
CurrentItem can't be used without casting it to some type and that's
why I am type casting it to TaskItem and TaskItem.Class always returns
IPM.Task. When I type cast it to TaskRequestItem, it returns null.

Re: Differentiate between Task and Task Request in NewInspector event
"Dmitry Streblechenko" <dmitry[ at ]dimastr.com> 2/7/2007 6:50:13 AM
Actually MessageClass will be "IPM.Task" and Class will olTask in both
cases.
The only difference will be the ResponseState property: it will be
olTaskSimple (0) for a brand new regular task and olTaskAssign (1) for New |
Task Request.
You can create olTaskAssign out of olTaskSimple by calling TaskItem.Assign.

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

"Piyush Gupta" <indorewale[ at ]gmail.com> wrote in message
news:1170805481.827591.266240[ at ]l53g2000cwa.googlegroups.com...
[Quoted Text]
> On Feb 6, 3:10 pm, "Ken Slovak - [MVP - Outlook]" <kenslo...[ at ]mvps.org>
> wrote:
>> Sue told you. It's Inspector.CurrentItem.Class.
>>
>> --
>> Ken Slovak
>> [MVP - Outlook]http://www.slovaktech.com
>> Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
>> Reminder Manager, Extended Reminders, Attachment
>> Optionshttp://www.slovaktech.com/products.htm
>>
>> "Piyush Gupta" <indorew...[ at ]gmail.com> wrote in message
>>
>> news:1170802017.275721.92000[ at ]j27g2000cwj.googlegroups.com...
>>
>> > Thanks Sue.
>>
>> > That's the problem I am having, No matter if user clicks on "New >
>> > Task" or "New > Task Request", inspector.CurrentItem is of TaskItem
>> > type only. My C# code goes like this:
>>
>> > Outlook.TaskRequestItem taskRequest = inspector.CurrentItem as
>> > Outlook.TaskRequestItem;
>> > Outlook.TaskItem task = inspector.CurrentItem as Outlook.TaskItem;
>>
>> > For new Task and Task Request, taskRequest variable remains null. Is
>> > there any property of TaskItem (other than TeamTask as it is always
>> > false) which can tell me the option selected by user?
>
> Sorry for the confusion. As I am writing C# code, Class property of
> CurrentItem can't be used without casting it to some type and that's
> why I am type casting it to TaskItem and TaskItem.Class always returns
> IPM.Task. When I type cast it to TaskRequestItem, it returns null.
>


Re: Differentiate between Task and Task Request in NewInspector event
"Piyush Gupta" <indorewale[ at ]gmail.com> 2/7/2007 7:42:36 AM
On Feb 6, 10:50 pm, "Dmitry Streblechenko" <dmi...[ at ]dimastr.com> wrote:
[Quoted Text]
> Actually MessageClass will be "IPM.Task" and Class will olTask in both
> cases.
> The only difference will be the ResponseState property: it will be
> olTaskSimple (0) for a brand new regular task and olTaskAssign (1) for New |
> Task Request.
> You can create olTaskAssign out of olTaskSimple by calling TaskItem.Assign.
>
> Dmitry Streblechenko (MVP)http://www.dimastr.com/
> OutlookSpy - Outlook, CDO
> and MAPI Developer Tool
>
> "Piyush Gupta" <indorew...[ at ]gmail.com> wrote in message
>
> news:1170805481.827591.266240[ at ]l53g2000cwa.googlegroups.com...
>
> > On Feb 6, 3:10 pm, "Ken Slovak - [MVP - Outlook]" <kenslo...[ at ]mvps.org>
> > wrote:
> >> Sue told you. It's Inspector.CurrentItem.Class.
>
> >> --
> >> Ken Slovak
> >> [MVP - Outlook]http://www.slovaktech.com
> >> Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
> >> Reminder Manager, Extended Reminders, Attachment
> >> Optionshttp://www.slovaktech.com/products.htm
>
> >> "Piyush Gupta" <indorew...[ at ]gmail.com> wrote in message
>
> >>news:1170802017.275721.92000[ at ]j27g2000cwj.googlegroups.com...
>
> >> > Thanks Sue.
>
> >> > That's the problem I am having, No matter if user clicks on "New >
> >> > Task" or "New > Task Request", inspector.CurrentItem is of TaskItem
> >> > type only. My C# code goes like this:
>
> >> > Outlook.TaskRequestItem taskRequest = inspector.CurrentItem as
> >> > Outlook.TaskRequestItem;
> >> > Outlook.TaskItem task = inspector.CurrentItem as Outlook.TaskItem;
>
> >> > For new Task and Task Request, taskRequest variable remains null. Is
> >> > there any property of TaskItem (other than TeamTask as it is always
> >> > false) which can tell me the option selected by user?
>
> > Sorry for the confusion. As I am writing C# code, Class property of
> > CurrentItem can't be used without casting it to some type and that's
> > why I am type casting it to TaskItem and TaskItem.Class always returns
> > IPM.Task. When I type cast it to TaskRequestItem, it returns null.

Thanks Dmitry, your suggestion worked and now I am able to
differentiate between Task and Task Request.

Can you pls. suggest way to differentiate between Appointment and
Meeting Request too? Similar to Task problem, I am getting
IPM.Appointment class in both cases.

Re: Differentiate between Task and Task Request in NewInspector event
"Dmitry Streblechenko" <dmitry[ at ]dimastr.com> 2/7/2007 5:53:46 PM
Look at the ResponseStatus property.
You can compare objects easily in OutlookSpy - dipaly the item, then hit the
CurrentItem button on the OutlookSpy toolbar and look at the properties.

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

"Piyush Gupta" <indorewale[ at ]gmail.com> wrote in message
news:1170834155.981038.180250[ at ]q2g2000cwa.googlegroups.com...
[Quoted Text]
> On Feb 6, 10:50 pm, "Dmitry Streblechenko" <dmi...[ at ]dimastr.com> wrote:
>> Actually MessageClass will be "IPM.Task" and Class will olTask in both
>> cases.
>> The only difference will be the ResponseState property: it will be
>> olTaskSimple (0) for a brand new regular task and olTaskAssign (1) for
>> New |
>> Task Request.
>> You can create olTaskAssign out of olTaskSimple by calling
>> TaskItem.Assign.
>>
>> Dmitry Streblechenko (MVP)http://www.dimastr.com/
>> OutlookSpy - Outlook, CDO
>> and MAPI Developer Tool
>>
>> "Piyush Gupta" <indorew...[ at ]gmail.com> wrote in message
>>
>> news:1170805481.827591.266240[ at ]l53g2000cwa.googlegroups.com...
>>
>> > On Feb 6, 3:10 pm, "Ken Slovak - [MVP - Outlook]" <kenslo...[ at ]mvps.org>
>> > wrote:
>> >> Sue told you. It's Inspector.CurrentItem.Class.
>>
>> >> --
>> >> Ken Slovak
>> >> [MVP - Outlook]http://www.slovaktech.com
>> >> Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
>> >> Reminder Manager, Extended Reminders, Attachment
>> >> Optionshttp://www.slovaktech.com/products.htm
>>
>> >> "Piyush Gupta" <indorew...[ at ]gmail.com> wrote in message
>>
>> >>news:1170802017.275721.92000[ at ]j27g2000cwj.googlegroups.com...
>>
>> >> > Thanks Sue.
>>
>> >> > That's the problem I am having, No matter if user clicks on "New >
>> >> > Task" or "New > Task Request", inspector.CurrentItem is of TaskItem
>> >> > type only. My C# code goes like this:
>>
>> >> > Outlook.TaskRequestItem taskRequest = inspector.CurrentItem as
>> >> > Outlook.TaskRequestItem;
>> >> > Outlook.TaskItem task = inspector.CurrentItem as Outlook.TaskItem;
>>
>> >> > For new Task and Task Request, taskRequest variable remains null. Is
>> >> > there any property of TaskItem (other than TeamTask as it is always
>> >> > false) which can tell me the option selected by user?
>>
>> > Sorry for the confusion. As I am writing C# code, Class property of
>> > CurrentItem can't be used without casting it to some type and that's
>> > why I am type casting it to TaskItem and TaskItem.Class always returns
>> > IPM.Task. When I type cast it to TaskRequestItem, it returns null.
>
> Thanks Dmitry, your suggestion worked and now I am able to
> differentiate between Task and Task Request.
>
> Can you pls. suggest way to differentiate between Appointment and
> Meeting Request too? Similar to Task problem, I am getting
> IPM.Appointment class in both cases.
>


Re: Differentiate between Task and Task Request in NewInspector event
"Piyush Gupta" <indorewale[ at ]gmail.com> 2/7/2007 9:01:51 PM
On Feb 7, 9:53 am, "Dmitry Streblechenko" <dmi...[ at ]dimastr.com> wrote:
[Quoted Text]
> Look at the ResponseStatus property.
> You can compare objects easily in OutlookSpy - dipaly the item, then hit the
> CurrentItem button on the OutlookSpy toolbar and look at the properties.
>
> Dmitry Streblechenko (MVP)http://www.dimastr.com/
> OutlookSpy - Outlook, CDO
> and MAPI Developer Tool
>
> "Piyush Gupta" <indorew...[ at ]gmail.com> wrote in message
>
> news:1170834155.981038.180250[ at ]q2g2000cwa.googlegroups.com...
>
> > On Feb 6, 10:50 pm, "Dmitry Streblechenko" <dmi...[ at ]dimastr.com> wrote:
> >> Actually MessageClass will be "IPM.Task" and Class will olTask in both
> >> cases.
> >> The only difference will be the ResponseState property: it will be
> >> olTaskSimple (0) for a brand new regular task and olTaskAssign (1) for
> >> New |
> >> Task Request.
> >> You can create olTaskAssign out of olTaskSimple by calling
> >> TaskItem.Assign.
>
> >> Dmitry Streblechenko (MVP)http://www.dimastr.com/
> >> OutlookSpy - Outlook, CDO
> >> and MAPI Developer Tool
>
> >> "Piyush Gupta" <indorew...[ at ]gmail.com> wrote in message
>
> >>news:1170805481.827591.266240[ at ]l53g2000cwa.googlegroups.com...
>
> >> > On Feb 6, 3:10 pm, "Ken Slovak - [MVP - Outlook]" <kenslo...[ at ]mvps.org>
> >> > wrote:
> >> >> Sue told you. It's Inspector.CurrentItem.Class.
>
> >> >> --
> >> >> Ken Slovak
> >> >> [MVP - Outlook]http://www.slovaktech.com
> >> >> Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
> >> >> Reminder Manager, Extended Reminders, Attachment
> >> >> Optionshttp://www.slovaktech.com/products.htm
>
> >> >> "Piyush Gupta" <indorew...[ at ]gmail.com> wrote in message
>
> >> >>news:1170802017.275721.92000[ at ]j27g2000cwj.googlegroups.com...
>
> >> >> > Thanks Sue.
>
> >> >> > That's the problem I am having, No matter if user clicks on "New >
> >> >> > Task" or "New > Task Request", inspector.CurrentItem is of TaskItem
> >> >> > type only. My C# code goes like this:
>
> >> >> > Outlook.TaskRequestItem taskRequest = inspector.CurrentItem as
> >> >> > Outlook.TaskRequestItem;
> >> >> > Outlook.TaskItem task = inspector.CurrentItem as Outlook.TaskItem;
>
> >> >> > For new Task and Task Request, taskRequest variable remains null. Is
> >> >> > there any property of TaskItem (other than TeamTask as it is always
> >> >> > false) which can tell me the option selected by user?
>
> >> > Sorry for the confusion. As I am writing C# code, Class property of
> >> > CurrentItem can't be used without casting it to some type and that's
> >> > why I am type casting it to TaskItem and TaskItem.Class always returns
> >> > IPM.Task. When I type cast it to TaskRequestItem, it returns null.
>
> > Thanks Dmitry, your suggestion worked and now I am able to
> > differentiate between Task and Task Request.
>
> > Can you pls. suggest way to differentiate between Appointment and
> > Meeting Request too? Similar to Task problem, I am getting
> > IPM.Appointment class in both cases.

Thanks to everyone. I was able to resolve issue with Response state
property.

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net