Skip to content

Instantly share code, notes, and snippets.

Avatar
👨‍💻
Working on it...

Vardhaman Deshpande vman

👨‍💻
Working on it...
View GitHub Profile
View teams.spfx.code.ts
import * as React from 'react';
import styles from './HelloTeams.module.scss';
import { IHelloTeamsProps } from './IHelloTeamsProps';
import { useEffect, useState } from 'react';
const HelloTeams: React.FunctionComponent<IHelloTeamsProps> = (props: IHelloTeamsProps) => {
const [themeState, setThemeState] = useState<string>(props.teamsTheme || "default");
const [styleState, setStyleState] = useState<string>(styles.containerdefault);
View teams.spfx.css.ts
const [styleState, setStyleState] = useState<string>(styles.containerdefault);
//Run anytime the themeState changes.
useEffect(() => {
console.log("themeState useEffect fired");
switch (themeState) {
case "dark":
setStyleState(styles.containerdark);
View teams.spfx.theme.ts
const [themeState, setThemeState] = useState<string>(props.teamsTheme || "default");
//Run effect once when the component loads. We will use this effect to register our Theme Changed handler.
useEffect(() => {
console.log("registerOnThemeChangeHandler useEffect fired");
props.context.sdks.microsoftTeams.teamsJs.registerOnThemeChangeHandler((theme: string) => {
console.log(`theme changed to: ${theme}`);
View o365cliadminconsent.ps1
$PnPO365ManagementAppId = "31359c7f-bd7e-475c-86db-fdb8c937548e"
az ad sp create --id $PnPO365ManagementAppId
az ad app permission grant --id $PnPO365ManagementAppId --api 00000003-0000-0000-c000-000000000000 --scope AppCatalog.ReadWrite.All
View aadv2adminconsent.txt
https://login.microsoftonline.com/organizations/v2.0/adminconsent?client_id=31359c7f-bd7e-475c-86db-fdb8c937548e&scope=https://graph.microsoft.com/AppCatalog.ReadWrite.All
View TeamsBotPersonalMessage.cs
using Microsoft.Bot.Builder;
using Microsoft.Bot.Connector;
using Microsoft.Bot.Connector.Authentication;
using Microsoft.Bot.Schema;
using Microsoft.Bot.Schema.Teams;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
View TeamsBotTopLevelActivityWithMention.cs
using Microsoft.Bot.Builder;
using Microsoft.Bot.Connector;
using Microsoft.Bot.Connector.Authentication;
using Microsoft.Bot.Schema;
using Microsoft.Bot.Schema.Teams;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
View TeamsBotTopLevelActivity.cs
using Microsoft.Bot.Builder;
using Microsoft.Bot.Connector;
using Microsoft.Bot.Connector.Authentication;
using Microsoft.Bot.Schema;
using Microsoft.Bot.Schema.Teams;
using System;
using System.Threading.Tasks;
namespace Teams.Bot.Conversations
{
View HelloUser.tsx
import * as React from 'react';
import { ServiceScope } from '@microsoft/sp-core-library';
import { withServiceScope } from '../common/withServiceScope';
import { MSGraphClientFactory, MSGraphClient } from '@microsoft/sp-http';
interface IHelloUserProps {
serviceScope: ServiceScope;
}
interface IHelloUserState {