MS Graph ServiceAnnouncement.Messages filter by lastModifiedDateTiem

asked 2021-11-05T16:28:23.527+00:00
Cummings, Bob G 21 Reputation points

I am trying to filter by the LastModifiedDateTime when asking for a list of Service Announcements. But it is not working. The documentation 1 for List serviceAnnouncement messages indicates it accepts the OData Query parameters.

Here is what I am doing.

var messages = await graphClient.Admin.ServiceAnnouncement.Messages
.Request()
.Filter(filterString)
.GetAsync();

Here is my filterString : "LastModifiedDateTime gt '11/5/2018 11:16:38 AM -06:00'"

I am using a System.DateTimeOffset for the value to filter on. Because that is what it looks like in the debugger after a successful get.

In my googling it always seems that the specific object does not support filtering by lastModifiedDate. But I do not know where to look to see if this is supported and I am doing something wrong, or it just is not supported.

Any help or advice appreciated.

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
23,733 questions
No comments
{count} votes

1 answer

Sort by: Most helpful
  1. answered 2022-01-05T19:10:37.423+00:00
    SrinivasaRaoDarna - MSFT 6,076 Reputation points Microsoft Employee

    Hi @Cummings, Bob G ,

    I am able to filter with lastModifiedDateTime on /admin/serviceAnnouncement/messages, below is what I used

    https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/messages?$filter=lastModifiedDateTime+gt+2021-11-05T11:24:37.837Z
    162417-ci-serviceannouncements-lastmodified.jpg

    Please check the datetime format in your filter.
    Hope this helps.

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have further questions about this answer, please click "Comment".

    No comments