Microsoft graph api always retrieves old document library name even if the library name is modified in SharePoint

Nandhini. S [ INDEC 4.0 ] 20 Reputation points
2024-09-06T09:23:39.0766667+00:00

Hi,

I have been using Microsoft Graph api to retrieve SharePoint site's files, folders, document libraries for my application.

When i change the document library name in SharePoint, graph api always returns me the old library name in its result.

I was using the below request to retrieve all the libraries under a SharePoint site. This request was always returning old drive name even if its modified in SharePoint.

https://graph.microsoft.com/v1.0/sites/{site-id}/drives?expand=children

I also used the below request to retrieve drive by drive id. Still, the request was always returning old drive name even if its modified in SharePoint.

https://graph.microsoft.com/v1.0/sites/{site-id}/drives/{driveid}

Graph api returns the old library name always no matter how many times the library name has been modified in SharePoint.

Please help on this.

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
12,273 questions
SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
3,044 questions
{count} votes

Accepted answer
  1. Yanli Jiang - MSFT 26,766 Reputation points Microsoft Vendor
    2024-09-12T09:13:32.49+00:00

    Hi @Nandhini. S [ INDEC 4.0 ] ,

    Attention please:

    Please be sure to blur the private information in the image, such as your webUrl and email. Thank you.

    Maybe there is a delay in Postman, I used Graph Explorer and it worked fine.

    This is my test process:

    BeforeUser's image

    091201

    After:

    User's image

    091202

    If the problem persists, we recommend you directly create a support ticket from Microsoft 365 Admin Center. The support team over there has the correct escalation channel, they can involve more resource and investigate the behavior from back end as fast as possible. They also can check the behavior on your end remotely. For reference: Get support - Microsoft 365 admin | Microsoft Docs, you can select online support or phone support to have a live chat with the support engineers.  

    Good day!


    If the answer is helpful, please click "Accept as 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 additional answer

Sort by: Most helpful
  1. Yanli Jiang - MSFT 26,766 Reputation points Microsoft Vendor
    2024-09-10T09:22:57.4166667+00:00

    Hi @Nandhini. S [ INDEC 4.0 ] ,Welcome to Q&A forum!

    The Microsoft Graph API caches certain data to improve performance. In this case, it is likely that the API is returning the cached data for the document library name instead of retrieving the updated name from SharePoint. To ensure that you are getting the most up-to-date information, you can use the delta query feature of the Microsoft Graph API. Delta query allows you to retrieve only the changes that have occurred since the last time you made a request. This will ensure that you are always getting the most current information for the document library name.

    To use delta query, you can add the ?$deltatoken parameter to your request. The first time you make the request, the API will return a delta token in the response. You can then use this delta token in subsequent requests to retrieve only the changes that have occurred since the last request.

    Here is an example of how to use delta query to retrieve the document libraries for a SharePoint site:

    GET https://graph.microsoft.com/v1.0/sites/{site-id}/drives?$expand=children&$deltatoken={delta-token}
    

    Replace {site-id} with the ID of the SharePoint site and {delta-token} with the delta token returned in the previous response.

    References:

    https://video2.skills-academy.com/en-us/onedrive/developer/rest-api/concepts/scan-guidance?view=odsp-graph-online#discover-locations-to-scan

    https://video2.skills-academy.com/en-us/graph/delta-query-overview

    Good day!


    If the answer is helpful, please click "Accept as 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.


Your answer

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