Outlook 2007 DASL query tasks
-
22-07-2019 - |
Question
I'm going crazy on this one. Basically I want to retrieve a task based on the EntryID of this task. so what I do is the following:
Outlook.MAPIFolder outlookTasksFolder = Application.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderTasks); string filter = String.Format("@SQL=\"urn:schemas:tasks:entryid\" like '%{0}%'", myEntryID); Outlook.Items outlookTasksDataItems = outlookTasksFolder.Restrict(filter);
but i does not work. I don't know how to format my query to get the corresponding items (there should be only one really).
can anyone please help me? thank you
Solution
Outlook.MAPIFolder outlookTasksFolder = Application.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderTasks);
Outlook.TaskItem myOutlookTask = (Outlook.TaskItem)Application.Session.GetItemFromID(myEntryID, outlookTasksFolder.EntryId);
That should do it.