Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View vman's full-sized avatar
👨‍💻

Vardhaman Deshpande vman

👨‍💻
View GitHub Profile
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);
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);
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}`);
this.context.sdks.microsoftTeams.context.theme
$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
https://login.microsoftonline.com/organizations/v2.0/adminconsent?client_id=31359c7f-bd7e-475c-86db-fdb8c937548e&scope=https://graph.microsoft.com/AppCatalog.ReadWrite.All
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;
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;
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
{
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 {