Share via

SPFX: Graph APIs suddenly started returning empty values

Ivan Maria 86 Reputation points
2021-05-11T10:00:07.7+00:00

The API fired through SPFX has now started returning empty values However, the HTTP response status is 200. The issue has been observed only since last few days on multiple tenant. Moreover, when I access the same endpoint via Postman using Microsoft Graph Application Token, I get the expected response. I have also added the snippet of the code for reference.

context.msGraphClientFactory
        .getClient()
        .then((client: MSGraphClient): void => {
          client
            .api("/sites/" + siteId + "/sites/" + webId + "/drives")
            .version("v1.0")
            .select("id")
            .get((err, res) => {
              if (res) {
              // process res.value
              // But the problem is res.value is an empty array
              }
            }
          }

Was there any recent change at Microsoft Graph Server side that may be causing this issue?

Microsoft Security | Microsoft Graph
0 comments No comments

1 answer

Sort by: Most helpful
  1. MichaelHan-MSFT 18,136 Reputation points
    2021-05-14T07:50:10.14+00:00

    Hi @Ivan Maria ,

    I tested the endpoint in Graph explorer and can get expected values. Not sure if there is any change in Graph API.

    Usually I would add the search query parameter in the end when getting empty values. And this would solve the issue. You could have a try, it may also work for you:

    api("/sites/" + siteId + "/sites/" + webId + "/drives?search=*")  
    

    If an Answer is helpful, please click "Accept Answer" and upvote it.
    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.

    Was this answer helpful?

    1 person found this answer helpful.

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.