Query to pulled data using Microsoft graph - microsoft-graph-api

I never use Microsoft graph. I just want to query to just pull a selection of users by supervisor using Microsoft graph

Run https://graph.microsoft.com/v1.0/users/{id | userPrincipalName}/directReports
See reference

Create SPFx to call graph api to get users.
the demo had shared how to search/filter users, to get all users, just remove the filter logic.
https://graph.microsoft.com/v1.0/users?$select=displayName,mail,userPrincipalName

This should work, if you want to get specific user with given email ID. Just change your email ID. The email ID I have given is just an example.
https://graph.microsoft.com/v1.0/users/xyz#mail.com?$select=displayName

Related

Microsoft Graph Unified Contacts List

Is it possible to create Exchange contacts list which will be shared across the whole organisation using Graph API?
These contacts are not the part of the organisation.
I know we can add contact to user's contact list, however was not able to find a way to have a contact which will be shared across the whole organisation.
POST /me/contacts
POST /users/{id | userPrincipalName}/contacts
POST /me/contactFolders/{contactFolderId}/contacts
POST /users/{id | userPrincipalName}/contactFolders/{contactFolderId}/contacts
I am aware that contacts are shared if the contact is within organisation and if they are in Active Directory Domain Services (AD DS). However these contacts are outside of the org.
Mail Enabled directory contacts (which are stored in AD) are available using the organizational contacts endpoint https://learn.microsoft.com/en-us/graph/api/orgcontact-list?view=graph-rest-1.0&tabs=http. However they don't allow you to create Org contacts in the Graph there's a uservoice request for this https://microsoftgraph.uservoice.com/forums/920506-microsoft-graph-feature-requests/suggestions/38083912-make-it-possible-to-create-organizational-contacts (but not looking good at getting this changed)
So the Exchange cmldets are still the only real way of doing this programatically https://learn.microsoft.com/en-us/powershell/exchange/exchange-online-powershell-v2?view=exchange-ps
eg
New-MailContact -Name "Chris Ashton" -ExternalEmailAddress "chris#tailspintoys.com"
While this does not answer my question directly, one of the solutions would be to have a user which will serve as a master containing all contacts.
This way contacts list would be accessible using following Graph call
GET /users/{id | userPrincipalName}/contacts
The downside of this approach is that whenever new contact is added to personal list it would need to be added to this list as well.

Office365 - Get list of all Planner Plans

I would like to retrieve a list of all Planner Plans and number of tasks in each Plan. Goal is to understand which plans are actually in use. I used the Graph API for this. However it appears that most the Graph endpoints for Planner and Tasks use Delegation Permissions. In other words, I have to be part of each Planner Plan to even query for it. So even as Global Admin I am unable to pull this information. Is there any way to query for
List of ALL Planner Plans in the tenant
Owner for each Planner Plan
Number of tasks in each Plan
Thanks in advance,
Jake
You can now use application permissions to read this data.
Outdated reply:
Unfortunately it is not possible to get this through Microsoft Graph
API right now. However we do have another API, which is meant for
admins to be able to export their tenant's data, and it can be used to
get this information. You should contact support for this process.

Microsoft Graph API: admin can't list other users people

Logged in as the Office 365 Global Administrator, I want to get the relevant people list for any user in Active Directory.
I can get my calls to return using
https://graph.microsoft.com:443/v1.0/users('my.address#contoso.com')/people
and
https://graph.microsoft.com:443/v1.0/users/{the user id}/people
and
https://graph.microsoft.com:443/v1.0/users('{the user id}')/people
and
https://graph.microsoft.com:443/v1.0/users/my.address#contoso.com/people
but, as an Office 365 admin with People.Read.All consent in the app, the call only returns one person (the target user's profile) for any user but myself. If I call it for my user I get a list of ten people
If I log in as that other person and make the People List API call it returns the expected ten results.
JWT scope: "scp": "Files.ReadWrite Mail.Send People.Read.All User.Read
I have to change the scope to People.Read for the non-admin.
https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/user_list_people
the call only returns one person (the target user's profile) for any
user but myself.
Answer is in the API Doc. As the document says.
Retrieve a collection of person objects ordered by their relevance to
the user, which is determined by the user's communication and
collaboration patterns and business relationships.
The following request gets the people most relevant to another person in the signed-in user's organization
https://graph.microsoft.com:443/v1.0/users('my.address#contoso.com')/people
It might happen that there is no one relevant to that user.
If you want the list of contacts in other user's contact list then you can refer to this one :
https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/user_list_contacts
UPDATE
https://developer.microsoft.com/en-us/graph/graph-explorer
I used the demo account on this website. I used this query
https://graph.microsoft.com/v1.0/users/08fa38e4-cbfa-4488-94ed-c834da6539df/people It worked.
This query gives the same result
https://graph.microsoft.com/v1.0/users('08fa38e4-cbfa-4488-94ed-c834da6539df')/people
Same result
https://graph.microsoft.com/v1.0/users('MiriamG#M365x214355.onmicrosoft.com')/people/
Same result
https://graph.microsoft.com/v1.0/users/MiriamG#M365x214355.onmicrosoft.com/people/
If you still can't get it to work and specially on Graph Explorer Website. Then it means that according to Microsoft there are no relevant people for that particular user.
As you can see there are different ways to use the same thing. Try it all if it works. Let me know.
I am not seeing this behavior in the Graph Explorer sample tenant. The behavior seems to indicate that this is auth-related. I would try to sign in with the admin again and make sure that you've consented to any of the admin-only scopes. Additionally, one thing you can do to figure out whether you have the appropriate scope in your token is decoding the JWT and examining the "scp" collection.

Asana API: organization_exports

How do I get organization ID? I tried this:
https://app.asana.com/api/1.0/organization_exports
But it returns
{"errors":[{"message":"Not Found","help":"For more information on API status codes and how to handle them, read the docs on errors: https://asana.com/developers/documentation/getting-started/errors"}]}
Of course I'm logged in, or use an access token, and other API calls work fine.
My final goal is to make use of the organization ID in https://github.com/Asana/export_importer.
sorry for the delay - the system that was supposed to alert us to your question didn't pick this one up.
The easiest way to get the organization ID is to query our API for your user to see what organizations you're a member of, rather than use the organization_exports endpoint - that's for exporting a full organization data dump for backup or reporting purposes.
If you look at our API documentation for getting your user at app.asana.com/api/1.0/users/me, you'll see that your user record returns a list of workspaces which have ID and name information. This is probably the most straightforward way to get your organization ID from our API.

Find all users of all projects with Jira API

I need to get a list of projects for currently logged in user. I found the decision of oppozite task here: JIRA SOAP API : get the list of users
Is there a way to do this through Jira API?
Do you mean which projects a user is allowed to see issues in? If so, you want to use
getPermissionSchemes to retrieve an array of RemotePermissionSchemes, then use getPermissionMappings on each of those to get the permissions that you want to see, e.g. View Issues (by id). The problem is you'd have to do this for all projects (can be cached) but then getting the roles for the user only works for the logged in user.
summary: I'd write my own SOAP method to do this
These are 2 questions:
Which users are currently logged in?
List of projects for a user?
For the first one, I found some entries in the JIRA issue tracker: Users currently logged on
The second one is easier, have a look at the API

Resources