3

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?

RollRoll
  • 8,133
  • 20
  • 76
  • 135
  • 1
    Don't they correspond to the MailItem properties? All three you listed can be found on the page listing the properties of MailItem: https://msdn.microsoft.com/en-us/library/office/dn320330.aspx – Leaky Mar 10 '17 at 15:06
  • 1
    I looked through the examples on the Restrict and Find method's MSDN page, and it seems that all expression keys they showed can be found either in the MailItem or in the ContanctItem class as properties. – Leaky Mar 10 '17 at 15:27
  • you are absolutely right, I didn't figure the filter syntax would be the own MAilItem proprerty. you can make it an answer and I will accept it. thanks – RollRoll Mar 10 '17 at 16:41
  • 1
    Hmm, Dmitry's answer has more details, so it seems fitting to accept that instead. I was just extrapolating from correlations. – Leaky Mar 10 '17 at 17:00

1 Answers1

0

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

Dmitry Streblechenko
  • 62,942
  • 4
  • 53
  • 78