Configuring Microsoft 365 Web Queries for partial name object search
Applies to: Cayosoft Administrator 9.x or later.
Summary: Cayosoft Administrator uses MS Graph API for searching. MS Graph API doesn't support wildcards and 'contains' search, it uses only 'startswith' for the search. Learn more in: Use query parameters - Filter parameter. This article has two examples of configuring Microsoft 365 web queries to return a list of objects by the part of the name using 'contains'. In the first one, in the result grid post-filtering is used. In the second example, changes should be made per web query in design mode.
Configuration
Example 1
In the Web Portal, click Web Query.
Set Show to All.
Search for Objects.
In the Name column, type a search value that contains a part of the object name.
Example 2
This configuration can be applied to the following web queries:
For example, Team names:
Team1 - Community Services - Public
Team2 - Community Services - Private
We need to configure the Teams web query that will return all Teams with Public or Private in their names.
In the Cayosoft Administrator Console, navigate to Teams web query.
Open the Other Query settings section.
-
Copy/paste this script to the Initialization Section and replace the Team name search string with your search value:
Copy{if ($MSGraphAdvancedQueries -eq "0")
{
$stokens = @("Private","Public")
$tmp = @()
$stokens | %{ $stoken = $_; $tmp += [string]::Format('"displayName:{0}"', $s
$searchStr = [string]::Join(" OR ", $tmp)
$global:QueryOptions += @{"`$search"=$searchStr}
}}
Set MS Graph advanced queries to Enabled.
Enable Design Mode.
On the Query tab, open the Pre-processing section.
-
Move the Initialization data command down after the Preparedata command.
NOTE: If you are using Cayosoft Administrator version 10.1.1 or later, skip this step. It is already included in these versions.
Save changes.
Comments
0 comments
Please sign in to leave a comment.