'What are all the possible expression keys used in Outlook .find .restrict method?
I can't come across the full list anywhere, it makes life creating tools for outlook particularly painfull.
I am creating series of tools in WPF integrating with Microsoft.Office.Interop.Outlook
I am able to apply filters using .find and .restrict just fine like an example below:
restrictedItems = inboxFolder.Items
.Restrict("[ReceivedTime] > '" + dateFilter1.ToString("MM/dd/yyyy HH:mm")
+ "' And [ReceivedTime] < '" + dateFilter2.ToString("MM/dd/yyyy HH:mm") + "' ");
however I just don't know all the possible fields I can use to filter. Microsoft does a terrible job documenting it.
Here are some examples: [ReceivedTime] [MessageClass] [LastModificationTime]
But I would like to have it all
any directions?
Solution 1:[1]
It can be any MailItem
, ContactItem
, AppointmentItem
etc. property (there are some exclusions and you cannot work with any PT_BINARY
properties). You can also specify any MAPI property if the query is in the SQL format (prefix it with @SQL=
) and you specify the property name in the DASL format (quoted). E.g. to filter on the PR_MESSAGE_DELIVERY_TIME
property, use a filter like
@SQL="http://schemas.microsoft.com/mapi/proptag/0x0E060040" > '03/05/2017'
To figure out the DASL property names, you can use OutlookSpy (I am its author) - select the message, click IMessage button on the OutlookSpy ribbon, select the appropriate property on the GetProps tab, look at the DASL edit box. OutlookSpy can also show all live Outlook Object Model objects (click Item button etc.)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Dmitry Streblechenko |