How do i get the files updated in the last 8 hours in graph api

Felix Read 30 Reputation points
2024-05-16T17:56:33.3533333+00:00

I have been trying to create a process to tag all recently modified files in sharepoint, to then update some custom fields we created for the sites.

We are using java MS graph api, but i have not been able to do this with graph.

This is the queries i have tried

{
    "requests": [
        {
            "entityTypes": [
                "driveItem"
            ],
            "query": {
                "queryString": "isDocument:true AND Modified>\"2024-05-16:11:00:00Z\" AND refinablestring14:True AND path:\"<siteURL>\""
            }
        }
    ]
}

{
    "requests": [
        {
            "entityTypes": [
                "driveItem"
            ],
            "query": {
                "queryString": "isDocument:true AND lastModifiedDateTime>\"2024-05-16:11:00:00Z\" AND refinablestring14:True AND path:\"<siteURL>\""
            }
        }
    ]
}

The refinablestring14 is a custom field, that can be true or false, to tell me that the file was check by a previous process to fill some other fields.

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,913 questions
SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
9,913 questions
0 comments No comments
{count} votes

Accepted answer
  1. RaytheonXie_MSFT 32,401 Reputation points Microsoft Vendor
    2024-05-17T02:48:50.8566667+00:00

    Hi @Felix Read,

    As far as I know, the graph search api doesn't support custom field currently. The queryString shouldn't contain custom field. The queryString should be like following

    
    POST https://graph.microsoft.com/v1.0/search/query
    {
        "requests": [
            {
                "entityTypes": [
                    "driveItem"
                ],
                "query": {
                    "queryString": "(LastModifiedTime>2024-05-16 AND path:\"https://contoso.sharepoint.com/sites/siteName\")"
                }
            }
        ]
    }
    
    
    

    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 additional answers

Sort by: Most helpful