I'm using the Microsoft Graph API to search for Sharepoint sites. I want to search for sites with a name that starts with Digital_ . I can search with $search="Digital_"
and that will return me those sites, however it will also return other sites based on searching something other than their name (not sure which property is used). I want to limit the search only to the site's name.
When I try $search="name:Digital_"
I get no results. How can I search for sites limiting search only to the name?
When using /sites?$search="..."
, you cannot search by a specific property like name
or displayName
.
You can try search API where you can search for site(s)
POST https://graph.microsoft.com/v1.0/search/query
{
"requests": [
{
"entityTypes": [
"site"
],
"query": {
"queryString": "Digital_"
}
}
]
}
It will search for the term Digital_
in properties name
, displayName
and description
.
To search only by the name
property, specify the queryString
like
"queryString": "SiteName:Digital_"
To search only by the displayName
property, specify the queryString
like
"queryString": "Title:Digital_"
To search only by the description
property, specify the queryString
like
"queryString": "description:Digital_"