Sharepoint online run query on the Modified column?

Tim 156 Reputation points
2022-10-19T10:01:28.027+00:00

In Sharepoint, I have the following library with the following documents + 1 image:

251966-docs.png

I want to be able to run a recurring query where I get all documents with a Modified time of 'today', every day in some script. Now trying a search in the search area like this:

LastModifiedTime="today"

Only gives me back the image.png

So I try something like this:

LastModifiedTime >= "2022-10-01"

Same thing, only the image comes back.

Now then I try this for several searches:

LastModifiedTime >= "2022-07-01" (nothing, only image)
LastModifiedTime >= "2022-06-01" (nothing, only image)

Then comes '2022-05-01' and suddenly, I get returned 'testimg.png', 'testdoc1.pdf', 'testdoc2.pdf'. Ok weird, so now I get back 2 of the three pdfs. Then 2022-04-01 nothing is added. 'LastModifiedTime

= 2022-03-01' I finally get all documents.

Now these docs are named from different documents for which I don't know when they were initially added to Sharepoint, it's not like I created them today. However, I was thinking that the LastModifiedTime query would work on the time in the 'Modified' column, which now does not seem to be the case. My thinking is that it looks at something else, but how do I then run a query like this on the 'Modified' column?

Microsoft 365 and Office | SharePoint | For business | Windows
0 comments No comments
{count} votes

Answer accepted by question author
  1. Yi Lu_MSFT 17,626 Reputation points
    2022-10-24T08:49:29.79+00:00

    Hi @Tim
    I'm glad to hear you solve the problem, if you have any issue about SharePoint, you are welcome to raise a ticket in this forum.

    By the way, since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others.". and according to the scenario introduced here: Answering your own questions on Microsoft Q&A, I would make a brief summary of this thread:

    Issue Symptom:
    I want to be able to run a recurring query where I get all documents with a Modified time of 'today', every day in some script. Now trying a search in the search area like this:

    LastModifiedTime="today"

    Only gives me back the image.png

    So I try something like this:

    LastModifiedTime >= "2022-10-01"

    Same thing, only the image comes back.

    Now then I try this for several searches:

    LastModifiedTime >= "2022-07-01" (nothing, only image)
    LastModifiedTime >= "2022-06-01" (nothing, only image)

    Then comes '2022-05-01' and suddenly, I get returned 'testimg.png', 'testdoc1.pdf', 'testdoc2.pdf'. Ok weird, so now I get back 2 of the three pdfs. Then 2022-04-01 nothing is added. 'LastModifiedTime

    = 2022-03-01' I finally get all documents.

    Now these docs are named from different documents for which I don't know when they were initially added to Sharepoint, it's not like I created them today. However, I was thinking that the LastModifiedTime query would work on the time in the 'Modified' column, which now does not seem to be the case. My thinking is that it looks at something else, but how do I then run a query like this on the 'Modified' column?

    Current status:
    I am now using: LastModifiedTimeForRetention >= "2022-10-01". This does seem to work in my case for matching the 'Modified' column!

    You could click the "Accept Answer" button for this summary to close this thread, and this can make it easier for other community member's to see the useful information when reading this thread. Thanks for your understanding!


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. S D Andrews 226 Reputation points Volunteer Moderator
    2022-10-19T10:23:12.857+00:00

    Hi @Tim

    Just to clarify, when you say you're using a query, how're you doing this? Within a view, calculated column or some other mechanism? I suspect we'll be able to provide a fuller guidance once we know.

    Thanks
    Steve


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.