A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Differentiate between Task and Task Request in NewInspector event



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old February 6th 07, 05:38 AM posted to microsoft.public.outlook.program_vba
Piyush Gupta
external usenet poster
 
Posts: 9
Default Differentiate between Task and Task Request in NewInspector event

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.

Ads
  #2  
Old February 7th 07, 06:00 PM posted to microsoft.public.outlook.program_vba
Eric Legault [MVP - Outlook]
external usenet poster
 
Posts: 830
Default Differentiate between Task and Task Request in NewInspector event

There's no way to tell the difference directly. TaskRequestItems cannot be
created by a user, they are created by Outlook when the request is received
in the recipient's Inbox.

Your best bet is to trap the Click event for the respective
CommandBarButtons for the Task entries in the New dropdown. Try this code in
your ThisOutlookSession module to see how to do it:

Option Explicit
Private WithEvents myTaskButton As Office.CommandBarButton
Private WithEvents myTaskRequestButton As Office.CommandBarButton
Private WithEvents objInspectors As Outlook.Inspectors
Enum TaskTypes
RegularTask = 0
TaskRequest = 1
End Enum
Private lngCurrentTaskType As TaskTypes

Private Sub Application_Startup()
Dim objCBs As CommandBars
Dim objCBCs As CommandBarControls

Set objInspectors = Application.Inspectors
Set objCBs = Application.ActiveExplorer.CommandBars
Set myTaskRequestButton = objCBs.FindControl(, 2006) 'TaskRequestItem
Set myTaskButton = objCBs.FindControl(, 1100) 'TaskItem
End Sub

Private Sub myTaskButton_Click(ByVal Ctrl As Office.CommandBarButton,
CancelDefault As Boolean)
'Set global variable to track which button was clicked to be read by the
NewInspector event
lngCurrentTaskType = RegularTask
End Sub

Private Sub myTaskRequestButton_Click(ByVal Ctrl As Office.CommandBarButton,
CancelDefault As Boolean)
'Set global variable to track which button was clicked to be read by the
NewInspector event
lngCurrentTaskType = TaskRequest
End Sub

Private Sub objInspectors_NewInspector(ByVal Inspector As Inspector)
MsgBox "Task Type = " & lngCurrentTaskType
End Sub


--
Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


"Piyush Gupta" wrote:

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.


 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
custom TASK REQUEST form error Cass Outlook - General Queries 1 October 4th 06 07:28 PM
custom TASK REQUEST form error Cass Outlook - General Queries 0 October 3rd 06 03:51 PM
OFT as a Task Request SteveM - GSTC Outlook - Using Forms 9 September 5th 06 09:57 AM
Can not open "task request" "task accepted" in Inbox LaParker Outlook - General Queries 2 August 9th 06 10:09 PM
Task read receipt request edro61 Outlook - Using Forms 0 June 13th 06 06:21 PM


All times are GMT +1. The time now is 01:18 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2024 Outlook Banter.
The comments are property of their posters.