Graph API search Sharepoint for images returns DispForm instead of the image

OM 0 Reputation points
2025-03-06T22:05:29.01+00:00

I am trying to search my Sharepoint site and get a list of images that match a search term eg if I have https://example.sharepoint.com/sites/photos

And my query is:

   {
      requests: [
        {
          entityTypes: ['listItem'],
          query: { queryString: 'Filetype:png' }, 
        },
      ],
    }

The results that come back are for "DispForm.aspx", not for the actual image. But DispForm does include the image details.

This happens when searching for listItem or driveItem - both have the same problem.

Results json: - every hit is a link to DispForm

{
hitId: '...', 
rank: 1, 
resource: {
	@odata.type: "#microsoft.graph.listItem",
webUrl: "
	}
}

And the DispForm does actually show the image details:

Name
photo.png
Title
Enter value here
Image Tags
stuff
Descriptions
Enter value here

Why? How do I get the search to return the image itself and not DispForm?

What I want to get instead is the webUrl to the actual image.

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
13,329 questions
0 comments No comments
{count} votes

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.