Using the graph api documentation I read that its possible to list all the groups within a tenant ( /groups endpoint) and its possible to use startswith or eq in displayname query. I was wondering if there is a way so search for groups with a specific text in the group displayname. Contains and endswith are not supported. If possible I want to prevent code that reads all groups and searches within the result.
Currently filter parameters for Graph API's does not support "contains". Check this document - https://learn.microsoft.com/en-us/graph/query-parameters
Related
I want to fetch all users together with their group names from MS Graph API.
It works as long as I don't want to do some advanced filtering (endsWith()).
Here's the select query I'm running:
https://graph.microsoft.com/v1.0/users?$select=displayName,userPrincipalName,mail,id,givenName,surname,memberOf&$expand=memberOf($select=displayName)
It produces a nice set of users together with the display name's of groups they are in.
I wanted to restrict the result to a specific mail domain (i have added ConsistencyLevel: eventual), however I am unable to do it unless I remove the memberOf expand. This works:
https://graph.microsoft.com/v1.0/users?$select=displayName,userPrincipalName,mail,id,givenName,surname,memberOf&$count=true&$filter=endsWith(mail,'#somedomain.com')
But as expected, there are no groups. In fact, there are no groups at all despite selecting memberOf! I thought I'll just fetch groups first and then pair them in my code, but to get them I must expand, and with expand the filter doesn't work!
This produces an Request_UnsupportedQuery error:
https://graph.microsoft.com/v1.0/users?$select=displayName,userPrincipalName,mail,id,givenName,surname,memberOf&$expand=memberOf($select=displayName)&$count=true&$filter=endsWith(mail,'#somedomain.com')
Is there any way to achieve what I want without filtering manually or issuing multiple requests and mapping stuff on my own? We're talking about directories containing tens of thousands of users.. Graph seemed to be nice at the beginning but as I wanted to do anything more complex it turns out to be a limited POS where one query totally excludes another. I was also unable to filter by the expanded memberOf in any way
Based on Microsoft Docs
$expand is not currently supported with advanced queries.
I'm trying to filter on the sharepoint lists, but the semantics seems to be different to the default semantics.
What I already tried was (with $ and without; single quotes and no quotes):
https://graph.microsoft.com/v1.0/sites/root/lists?filter=name eq 'Something'
https://graph.microsoft.com/v1.0/sites/root/lists?$filter=name eq 'Something'
https://graph.microsoft.com/v1.0/sites/root/lists?filter=id eq 'CFFF1460-B4D7-419C-A921-61B5279BBDDC'
https://graph.microsoft.com/v1.0/sites/root/lists?$filter=id eq 'CFFF1460-B4D7-419C-A921-61B5279BBDDC'
https://graph.microsoft.com/v1.0/sites/root/lists?filter=id eq CFFF1460-B4D7-419C-A921-61B5279BBDDC
https://graph.microsoft.com/v1.0/sites/root/lists?$filter=id eq CFFF1460-B4D7-419C-A921-61B5279BBDDC
But everything returns an array containing all lists and not only the subset matching the desired criteria.
So how can I filter on sharepoint lists?
If you know the id of the list you want to filter and get a response for.
YOu can run a graph API query like this.
https://graph.microsoft.com/v1.0/sites/root/lists/{list-id}
This will give you data about that list.
Let me know if you need further details on this.
Unfortunately (like Marc already mentioned in the comments) it is not possible to filter on SharePoint lists. If you need to, you have to do it on the client side, by reading the list without any filter and make a LINQ statement (or something similar) on the received collection. Be aware that (like all collections in Graph) you don't get always all elements at once. Potentially you have to call the next link request from the last response and wade through more requests and elements till you find what you need.
So when you found what you need, it is a good idea to store the list id within a memory cache or Redis cache for faster lookups the next time, you need this information.
Microsoft graph provides a people query that can receive $search url parameter e.g.
https://graph.microsoft.com/beta/me/people/?$search="topic: work"
what search parameters are supported in the people query?
what is the exact meaning of the topic filter?
The $search parameter searches across the displayName and emailAddress properties of a person.
Searches on people occur on both the displayName and emailAddress properties of the person resource. Searches implement a fuzzy matching algorithm. They will return results based on an exact match and also on inferences about the intent of the search.
The topic: attempts to match people who are interested in a given topic by looking through the user's mail history. If you're emailing with someone about avocados then topic:avocado would surface that person.
You can also perform searches for people who are interested in a particular topic. Searches are performed based on inferences derived from the user's mail conversations. .
"Topics" are just words that have been used most by users in email conversations. Microsoft extracts such words and creates an index for this data to facilitate fuzzy searches.
A search like the following:
GET https://graph.microsoft.com/v1.0/me/people/?$search="topic:windows"
is a fuzzy search in this topic data index. Topics in this data are context free, so a search for "windows" can include instances that mean the Windows operating system, an opening in a building wall, or other definitions.
I know it is possible to list comments for a single video on youtbue but is it possible to find all comments on youtbue data api v3 that match a query?
For example if I search for "BMW" I find all comments on different videos with "BMW" in it. If it is not supported what would be a work around?
I am using python.
Comments: list Returns a list of comments that match the API
request parameters.
There is a filter parameter which will return the only certain comment ids, (why you would want to do this no idea)
id string The id parameter specifies a comma-separated list of
comment IDs for the resources that are being retrieved. In a comment
resource, the id property specifies the comment's ID.
For the Google methods that do allow you to do a string search (Which is what I think you are looking for) the parameter is normally q.
search.list has this option you can search for videos by text string, Google drive file.list also has it you can search for files that start with a name or type.
Answer: by checking the documentation we can see that it is not possible to find all comments on YouTube Data API v3 that match a string query.
Is there a way to query by multiple resourceId's using the .Net library?
For instance, usually I query for a single feed entry by resourceId like this:
DocumentsListQuery query = new DocumentsListQuery();
query.Uri = new Uri(string.Format("{0}/{1}", DocumentsListQuery.documentsBaseUri, doc.ResourceId));
DocumentsFeed feed = service.Query(query);
I'm wondering if there's some way to query for multiple documents by their resourceId's in a single query, instead of just fetching the whole list.
A single RESTful query can only return a single element or a feed, so there's no way to query by multiple resourceId's.
An alternative might be to specify a search query that restricts your results to the elements you want, but such search criteria only exist if your files have something in common that differentiates them from the other documents.
The documentation for search query in the Documents List API is available at https://developers.google.com/google-apps/documents-list/#searching_for_documents_and_files, but I'd also recommend you to take a look at the newer Drive API and at how it manages search:
https://developers.google.com/google-apps/documents-list/#searching_for_documents_and_files