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
Related
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.
Question: Using Microsoft Graph how do we display the manager of a user? For example, using Microsoft Graph Explorer you can get a signed-in user profile info by calling https://graph.microsoft.com/v1.0/me. But this call does not return all the fields - specifically not the manager field.
I tried https://graph.microsoft.com/v1.0/me?$select=manager but it still did not return manager.
In the Relationships section of user resource type you see a manager field for a user's manager. And the Json representation of that Relationships shows manager field as follows:
"manager": { "#odata.type": "microsoft.graph.directoryObject" }
But I am not sure how do we use it to get he manager of a user.
UPDATE:
Following is a screenshot of just a portion of result from the query from the user #CarlShao. In fact it is returning tons of attributes for manager object. But I'm showing just current screen of my laptop:
If you need to expand the user's organizational relationship, you should use the $expand parameter, which supports expanding the user's directReports, manager and memberOf relationships.
GET https://graph.microsoft.com/v1.0/me?$expand=manager
referenceļ¼list manager and expand parameter.
Update:
You can specify $select inside $expand to select the individual manager's properties: $expand=manager($levels=max;$select=displayName)
https://graph.microsoft.com/v1.0/me?$expand=manager($levels=max;$select=displayName)&$count=true
Don't forget to add request header: ConsistencyLevel=eventual
I'm using Azure ActiveDirectory Graph API. I can list members(users,contacts,other groups) of a group. I noticed, when I add in office.outlook.com a contact (not personal, organizational contact) to a group, it will be a guest user (add a user, it will be a user ofc). When I list members of a group, I get a list of user objects. I got the guest users and the normal users too. I didn't find any solution for that, to list only the contacts (guest users) from a group. My question is, is this possible?
I use this in my code:
https://graph.windows.net/myorganization/groups/{object_id}/members?api-version
If you check the response , you will find userType property in Microsoft.DirectoryServices.User . userType is a string value that can be used to classify user types in your directory, such as "Member" and "Guest".
Unfortunately a service-side filter for this is not currently possible (filtering on the target of a navigation collection - for type and/or any property including extension properties). See this thread . And you could vote for this feature.
Currently you will need to get all members and then filter on the client side , find the guest users that userType value equals Guest .
I'm trying to use Office Graph with Graph Query Language (GQL) and SharePoint Online Search as per this MSDN article: https://msdn.microsoft.com/en-us/office/office365/howto/query-office-graph-using-gql-with-search-rest-api#available-action-types
For my office 365 environment, I can get data for myself using ACTOR(ME) in the GQL and even for another user using ActorID as ACTOR(21223), where 21223 is an actor ID for a user (for example).
In this case i know Actor ID before hand, but how do I get the ActorID for a given office 365 user? Is there a way to get actor Ids for all office 365users?
Looks like I've found how to do it.
It can be done by perfroming search a search against SharePoint User profile, by user name or email and reading the property "UserName,DocId" from the people search.
This is as per the comments by the author of this blog post (http://www.techmikael.com/2014/10/office-graph-support-in-sharepoint-2013.html?showComment=1470189211109#c659048088948213635.
This will be a query to get the ActorID for a user with username carls:
_api/search/query?Querytext='Username:carls'&SourceId='b09a7990-05ea-4af9-81ef-edfab16c4e31'&SelectProperties='UserName,DocId'
I have created a custom membership provider for a SharePoint application but would like to populate the Title and Department columns for the MembershipUsers that are displayed with data from my user repository.
Is this possible? How can it be done?
I don't see anything in the System.Web.Security.MembershipUser class that could store this information. How does the Windows AD MembershipProvider have a different Display Name than the Account Name? Are some of these values coming from someplace else?
What happens in the AD is that, SharePoint runs the User Profile Sync Job that will pull all the required information from AD and updated the SharePoint UserProfile DB which In turn pushes to Each of the Site. Whereas in the case of the Custom Membership we don't have a direct option to update the Profile Information.
One method you can do is to update those information using code.There are two options you can update the User Profile information in the SSP so that it will be displayed in all the Site Collection or to Update the SPWeb.SiteUserInfo List. Please refer these link1 , link2 on how to do that. In case you want to update in SiteUserInfo list it is just another list just search for Item based on the user account name and update that item.