Search code examples
outlookmicrosoft-graph-apioffice365microsoft-graph-sdks

Microsoft Graph $filter by singleValueExtendedProperties


I'm trying to filter singleValueExtendedProperties through Graph api. A singleValueExtendedProperties which I want to filter is PidTagDeferredSendTime (Property ID: 0x3FEF, Data type: PtypTime, 0x0040).

I can get this value with expand.

https://graph.microsoft.com/v1.0/me/mailfolders/drafts/messages?$expand=singleValueExtendedProperties($filter=id eq 'SystemTime 0x3FEF')

However, I want to get list of messages which have value for PidTagDeferredSendTime. I tried bellow urls but failed.

https://graph.microsoft.com/v1.0/me/messages?$filter=singleValueExtendedProperties/Any(ep: ep/id eq 'SystemTime 0x3FEF' and ep/value ge '2023-04-24T04:00:00Z')

https://graph.microsoft.com/v1.0/me/messages?$filter=singleValueExtendedProperties/Any(ep: ep/id eq 'SystemTime 0x3FEF' and contains(ep/value, '2024'))

https://graph.microsoft.com/v1.0/me/messages?$filter=singleValueExtendedProperties/Any(ep: ep/id eq 'String {SystemTime 0x3FEF}' and ep/value ne null)&$expand=singleValueExtendedProperties($filter=id eq 'String {SystemTime 0x3FEF}')

I would be very appreciated for any help/hints/thoughts.


Solution

  • You need to cast ep/value to Edm.DateTimeOffset and the date time value should be without single quotes

    GET /v1.0/me/messages?$filter=singleValueExtendedProperties/Any(ep: ep/id eq 'SystemTime 0x3fef' and cast(ep/value, Edm.DateTimeOffset) ge 2023-04-24T04:00:00Z)
    

    The request should succeed, but I can't confirm the results, it's up to you.