This file contains hidden or 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
import { config } from 'dotenv'; | |
import * as path from 'path'; | |
import "isomorphic-fetch"; | |
import { Client, ClientOptions } from "@microsoft/microsoft-graph-client"; | |
import { ClientCredentialAuthenticationProvider } from "./AuthenticationProvider" | |
// Read environment variables from .env file | |
const ENV_FILE = path.join(__dirname, '.env'); | |
config({ path: ENV_FILE }); |
This file contains hidden or 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
import { AuthenticationProvider } from "@microsoft/microsoft-graph-client"; | |
import * as qs from "qs"; | |
import axios from "axios" | |
export class ClientCredentialAuthenticationProvider implements AuthenticationProvider { | |
public async getAccessToken(): Promise<string> { | |
const url: string = "https://login.microsoftonline.com/" + process.env.MicrosoftAppTenantId + "/oauth2/v2.0/token"; |
This file contains hidden or 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
{ | |
"version": "Notebook/1.0", | |
"items": [ | |
{ | |
"type": 1, | |
"content": { | |
"json": "## Teams Client Network Usage\n" | |
}, | |
"name": "text - 2" | |
}, |
This file contains hidden or 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
{ | |
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json", | |
"type": "AdaptiveCard", | |
"version": "1.2", | |
"body": [ | |
{ | |
"type": "TextBlock", | |
"text": "@{triggerBody()?['UserDetails']?['FullName']} has mentioned you on Twitter", | |
"weight": "Bolder", | |
"size": "Large" |
This file contains hidden or 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
{ | |
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json", | |
"type": "AdaptiveCard", | |
"version": "1.2", | |
"body": [ | |
{ | |
"type": "TextBlock", | |
"text": "Publish Adaptive Card schema", | |
"weight": "bolder", | |
"size": "large" |
This file contains hidden or 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
# Application (client) ID, tenant ID, resource and scope | |
$clientId = "" | |
$tenantId = "" | |
$resource = "https://graph.microsoft.com/" | |
$scope = "Group.Read.All" | |
$codeBody = @{ | |
resource = $resource | |
client_id = $clientId |
This file contains hidden or 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
# Get-ChannelWebpageTabs.ps1 | |
# Example script to list all webpage Tabs in Teams Channels | |
function GraphAPICall { | |
param ( | |
[Parameter(mandatory = $true)][uri]$URI | |
) | |
$Headers = @{"Authorization" = "Bearer $script:token" } |
This file contains hidden or 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
# GraphAPIPaging.ps1 | |
# Example script on paging with Graph API | |
### Authenticate ### | |
# Application (client) ID, tenant ID and secret | |
$clientId = "" | |
$tenantId = "" | |
$clientSecret = '' | |
# Construct URI |
This file contains hidden or 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
# New-Team.ps1 | |
# Create a new Team using Graph API | |
# Application (client) ID, tenant ID and secret | |
$clientId = "clientid" | |
$tenantId = "tenantid" | |
$clientSecret = 'secret' | |
# Contruct URI | |
$uri = "https://login.microsoftonline.com/$tenantId/oauth2/v2.0/token" |
This file contains hidden or 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
# Get-Me.ps1 | |
# Get logged in user using Graph API | |
# Add required assemblies | |
Add-Type -AssemblyName System.Web, PresentationFramework, PresentationCore | |
# Application (client) ID, tenant ID and redirect URI | |
$clientId = "clientid" | |
$tenantId = "tenantid" | |
$redirectUri = "https://login.microsoftonline.com/common/oauth2/nativeclient" |
NewerOlder