How to retrieve the GUID of SharePoint groups - sharepoint

I want to create an API in MS Graph to retrieve the groups:
https://graph.microsoft.com/v1.0/groups/{guid_id}/members
How can I retrieve the GUID of SharePoint groups from the current sites and dynamically add it in the query?
Thanks!

You can list all Groups in your organization using
https://graph.microsoft.com/v1.0/groups
which gives you group objects. You would get id for each object which is nothing but the GUID in your above call.
To list all Groups there is a concept of pagination where you would be getting a nextLink which can get you next set of results. See this paging document.
You can also get the groups you are member of using
https://graph.microsoft.com/v1.0/me/transitiveMemberOf/microsoft.graph.group?$count=true
which also gives you the id's of groups.

Related

How to get the group members of a sub site in SharePoint online using CSOM

I have a requirement to retrieve the members of a specific group ( This is a custom SP security group) in a subsite using CSOM. Please let me know how I can retrieve a specific security group using its name and get it's users in SharePoint online. I found multiple solutions which get the users of a site collection but I need it for a sub site. The client context in my case would look something like below -
https://abc.sharepoint.com/sites/applications/xyz/123456 ( where 123456 is a sub-site within the site collection xyz and need members of '123456 Owners' group)
Appreciate all your help. Thank you in advance.

Is there an azure DevOps API to fetch all lists of work items assigned to a user under and organisation

i am working with azure DevOps API and i was able to integrate with the API to fetch releases, builds and projects, but i need an azure API endpoint i can call to fetch list of all work items that had been assigned to each users under an organisation(get all workitems by user/organisation), need this to generate a report to my organisation top management staff. Please
There are couple of ways to fetch all lists of work items assigned to a user under an organization.
Returning a Single Work Item.
GET https://dev.azure.com/{organization}/{project}/_apis/wit/workitems/{id}?api-version=6.0
When you are requesting for a single work item, you need to pass the specific work Item Id in the URL.
Please take a look at this doc for a sample return response : Single Work Item
Returns multiple work items for a list of work item ids (Maximum 200)
GET https://dev.azure.com/{organization}/{project}/_apis/wit/workitems/{id}?api-version=6.0
When returning a multiple work items, you need to pass the name of an organization in the API endpoint.
Take a look at this doc for more reference : Multiple Work Items in a batch

Microsoft Graph V1 Getting Member using list lookup field

I have a lookup field in a SharePoint list that offers the (lookup) id for a user that exists within Microsoft. The id is something similar to 100. I want to be able to use that id through Microsoft Graph to retrieve the associated member.
I have no idea how SharePoint uses that id to find the user.
"fields": {
"User1LookupId": "138"
}
The id used in lookup fields is from the SharePoint user list. The SharePoint user list is not in Microsoft Graph, rather you need to use the SharePoint REST API to get the user information:
https://contoso.sharepoint.com/sites/sitename/_api/web/GetUserById(lookupId)
This call should return the UPN, which you can use to get the Microsoft Graph User (if needed).
https://learn.microsoft.com/en-us/previous-versions/office/developer/sharepoint-rest-reference/dn531432(v=office.15)?redirectedfrom=MSDN#user-resource

How can I get all the Groups from Azure via the Graph API for which I am an owner?

I need to query Azure via the Graph API to find which Groups I own (or am one of multiple owners). The closest query I've been able to find is:
/users/{userId}/ownedObjects
This returns different types of objects, including Groups. However, it appears to return items that are NOT in fact owned by user {userId}.
Is there a better way to do this?

Ordering Azure Active Directory Graph Results by Created Date

Does anyone know how to order the results of a query to the Azure AD Graph API using the nuget assembly (https://www.nuget.org/packages/Microsoft.Azure.ActiveDirectory.GraphClient/) by "Created Date" (i.e. when the user was created in the directory?
I can't find any documentation about a property which would contain this. Is the result set automatically ordered in this way?
There is a restriction at the moment on the '$orderby' expressions that can be specified for a Graph API query. From the documentation -
The following restrictions apply to $orderby expressions:
Two sort orders are currently supported: DisplayName for User and Group objects, and UserPrincipalName for User objects. The default sort order for users is by UserPrincipalName.
So even if the 'Created Date' was exposed as property on the User I doubt the query will work.

Resources