-
-
Notifications
You must be signed in to change notification settings - Fork 121
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #55 from arambazamba:graph-demos
graph demos copied from ms-600
- Loading branch information
Showing
10 changed files
with
234 additions
and
13 deletions.
There are no files selected for viewing
File renamed without changes
File renamed without changes
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# @name auth | ||
POST https://login.microsoftonline.com/{{tenantId}}/oauth2/v2.0/token HTTP/1.1 | ||
Content-type: application/x-www-form-urlencoded | ||
|
||
grant_type=client_credentials | ||
&client_id={{clientId}} | ||
&client_secret={{clientSecret}} | ||
&scope={{scope}} | ||
|
||
### get all users | ||
# @name users | ||
GET https://graph.microsoft.com/v1.0/users | ||
Authorization: Bearer {{auth.response.body.access_token}} | ||
|
||
|
||
### get profile | ||
GET https://graph.microsoft.com/v1.0/users/{{users.response.body.value[0].userPrincipalName }}/ | ||
Accept: application/json | ||
Content-Type: application/json | ||
Authorization: Bearer {{auth.response.body.access_token}} | ||
|
||
### batch request | ||
POST https://graph.microsoft.com/v1.0/$batch | ||
Accept: application/json | ||
Content-Type: application/json | ||
Authorization: Bearer {{auth.response.body.access_token}} | ||
|
||
{ | ||
"requests": [ | ||
{ | ||
"url": "/users/{{users.response.body.value[0].userPrincipalName }}/", | ||
"method": "GET", | ||
"id": "1" | ||
}, | ||
{ | ||
"url": "/users/{{users.response.body.value[3].userPrincipalName }}/events", | ||
"method": "GET", | ||
"id": "2" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
Demos/06-Identity/Demo-05/setup-rest-client/create-appreg.azcli
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
app=vscode-rest-client | ||
id=$(az ad app create --display-name $app --enable-access-token-issuance true --enable-id-token-issuance true --query appId -o tsv) | ||
|
||
az ad app credential reset --id $id --append |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
### Set the graph base url | ||
@graph=https://graph.microsoft.com/v1.0 | ||
@tenanat=integrationsonline | ||
@splistapp=6a04eb4c-afa8-4673-829a-19ca38640abb | ||
|
||
# Autenticate User | ||
# @name auth | ||
POST https://login.microsoftonline.com/{{tenantId}}/oauth2/v2.0/token HTTP/1.1 | ||
Content-type: application/x-www-form-urlencoded | ||
|
||
grant_type=client_credentials | ||
&client_id={{clientId}} | ||
&client_secret={{clientSecret}} | ||
&scope={{scope}} | ||
|
||
### get a specific user | ||
# @name user | ||
GET {{graph}}/users/[email protected] | ||
Authorization: Bearer {{auth.response.body.access_token}} | ||
|
||
|
||
### Create group | ||
# @name m365grp | ||
POST {{graph}}/groups | ||
Accept: application/json | ||
Content-Type: application/json | ||
Authorization: Bearer {{auth.response.body.access_token}} | ||
|
||
{ | ||
"displayName":"graph-teams", | ||
"mailNickname":"graph-teams", | ||
"description":"a group for teams development", | ||
"visibility":"Private", | ||
"groupTypes":["Unified"], | ||
"mailEnabled":true, | ||
"securityEnabled":false, | ||
"[email protected]":[ | ||
"{{graph}}/users/{{user.response.body.id }}", | ||
], | ||
"[email protected]":[ | ||
"{{graph}}/users/{{user.response.body.id }}" | ||
] | ||
} | ||
|
||
### List groups | ||
GET {{graph}}/groups | ||
Accept: application/json | ||
Authorization: Bearer {{auth.response.body.access_token}} | ||
|
||
### Convert it to a Microsoft Teams | ||
# @name team | ||
POST {{graph}}/teams | ||
Accept: application/json | ||
Content-Type: application/json | ||
Authorization: Bearer {{auth.response.body.access_token}} | ||
|
||
{ | ||
"[email protected]": "{{graph}}/teamsTemplates('standard')", | ||
"[email protected]": "{{graph}}/groups('{{m365grp.response.body.id}}')" | ||
} | ||
|
||
### List Teams | ||
GET {{graph}}/groups?$select=id,displayName,resourceProvisioningOptions | ||
Accept: application/json | ||
Authorization: Bearer {{auth.response.body.access_token}} | ||
|
||
### List all teams the current user has joined: | ||
GET {{graph}}/users/{{user.response.body.id }}/joinedTeams | ||
Accept: application/json | ||
Authorization: Bearer {{auth.response.body.access_token}} | ||
|
||
### Get channel id of default channel | ||
# @name channel | ||
GET {{graph}}/teams/{{m365grp.response.body.id}}/channels | ||
Accept: application/json | ||
Authorization: Bearer {{auth.response.body.access_token}} | ||
|
||
### todo install app https://docs.microsoft.com/en-us/graph/api/team-list-installedapps?view=graph-rest-1.0&tabs=http | ||
### Get installed apps | ||
GET {{graph}}/teams/{{m365grp.response.body.id}}/installedApps | ||
Accept: application/json | ||
Authorization: Bearer {{auth.response.body.access_token}} | ||
|
||
### Install app | ||
POST {{graph}}/teams/{{m365grp.response.body.id}}/installedApps | ||
Content-Type: application/json | ||
Accept: application/json | ||
Authorization: Bearer {{auth.response.body.access_token}} | ||
|
||
{ | ||
"[email protected]":"{{graph}}/appCatalogs/teamsApps/{{splistapp}}" | ||
} | ||
|
||
### Add a tab to a teams default channel | ||
POST {{graph}}/teams/{{m365grp.response.body.id}}/channels/{channelId}/tabs | ||
Content-Type: application/json | ||
Accept: application/json | ||
Authorization: Bearer {{auth.response.body.access_token}} | ||
|
||
{ | ||
"displayName": "Skills", | ||
"[email protected]" : "{{graph}}//appCatalogs/teamsApps/{{m365grp.response.body.id}}", | ||
"configuration": { | ||
"entityId": "2a527703-1f6f-4559-a332-d8a7d288cd88", | ||
"contentUrl": "https://{tenant}.sharepoint.com/sites/m365-dev/skills", | ||
"removeUrl": null, | ||
"websiteUrl": null | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
### Set base vars | ||
@graph=https://graph.microsoft.com/v1.0 | ||
|
||
### Authenticate | ||
# @name auth | ||
POST https://login.microsoftonline.com/{{tenantId}}/oauth2/v2.0/token HTTP/1.1 | ||
Content-type: application/x-www-form-urlencoded | ||
|
||
grant_type=client_credentials | ||
&client_id={{clientId}} | ||
&client_secret={{clientSecret}} | ||
&scope={{scope}} | ||
|
||
### get a specific user | ||
# @name user | ||
GET {{graph}}/users/[email protected] | ||
Authorization: Bearer {{auth.response.body.access_token}} | ||
|
||
### get a specific user photo | ||
# @name photo | ||
GET {{graph}}/users/{{user.response.body.id}}/photo/$value | ||
Authorization: Bearer {{auth.response.body.access_token}} | ||
|
||
### Get groups | ||
# @name grps | ||
GET {{graph}}/groups | ||
Authorization: Bearer {{auth.response.body.access_token}} | ||
|
||
### Get group owner | ||
GET {{graph}}/groups/{{grps.response.body.value[0].id}}/owners | ||
Authorization: Bearer {{auth.response.body.access_token}} | ||
|
||
### Get the list of groups where a user is an owner | ||
GET {{graph}}/users/{{user.response.body.id}}/ownedObjects | ||
Authorization: Bearer {{auth.response.body.access_token}} | ||
|
||
### list groups | ||
# @name grps | ||
GET {{graph}}/groups | ||
Authorization: Bearer {{auth.response.body.access_token}} | ||
|
||
### create grp | ||
# @name grp | ||
POST {{graph}}/groups/ | ||
Content-type: application/json | ||
Authorization: Bearer {{auth.response.body.access_token}} | ||
|
||
{ | ||
"description": "a dynamic group for ms-600", | ||
"displayName": "ms600-dynamic", | ||
"groupTypes": [ | ||
"Unified" | ||
], | ||
"mailEnabled": false, | ||
"mailNickname": "ms600-dynamic", | ||
"securityEnabled": true | ||
} | ||
|
||
### add dynamic members - requires Azure AD Premium P1 or higher | ||
PATCH https://graph.microsoft.com/v1.0/groups/{{grp.response.body.id}} | ||
Content-type: application/json | ||
Authorization: Bearer {{auth.response.body.access_token}} | ||
|
||
{ | ||
"groupTypes": | ||
["Unified", "DynamicMembership"], | ||
"membershipRule": "user.department -eq 'IT'","membershipRuleProcessingState": "on" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.