Run local - OfficeDev/microsoft-teams-apps-sustain GitHub Wiki

Teams Sustain App

Prerequisites

  • Visual Studio 2022
  • VS Code
  • OpenSSL
  • Node JS
  • Teams Account with side-loading enabled, please see this link more information about side-loading an application.
  • App Registration
  • A developer tenant with O365 subscription and Teams side-loading app enabled

To try this sample

API

  1. Checkout latest codes from the repository
  2. Modify configuration files (if needed), below are the common configurations that needs changes:
  • AzureAd
  • BlobStorage
  • PnPCore
  • ConnectionStrings.Sustainability
  1. Sign in to Azure CLI using PowerShell with the "az login" command
  2. Run API

image

React App

  1. Download and Install OpenSSL
  2. Run the following commands

openssl req -x509 -sha256 -nodes -days 365 -newkey rsa:2048 -keyout TeamsAppDev.key -out TeamsAppDev.crt -subj "/CN=TeamsAppDev" -addext "subjectAltName = DNS:dev.teamsapps.local"

  1. Create ".certs" folder in webui project

  2. Move certificates to that directory

  3. Modify hosts files located at: "C:\Windows\System32\drivers\etc"

  • Run notepad as administrator
  • Navigate to the directory and open the hosts file
  • Add needed items to hosts file
  • Add "127.0.0.1    dev.teamsapps.local" to hosts file
  1. Import certificates to "ctrmgr"
  • Type certmgr on cmd
  • Go to Trusted Root Certification Authorities/Certificates
  • Right to Certificates folder, select all tasks -> import
  1. navigate to WebUI project
  • npm install
  • npm start
  1. navigate to manifest on "dev-dturley" folder and edit manifest.json
  • Change client Id
  • Add :3000 to resource
  • Drag manifest.json to zip file
  1. Sideload to teams
  • Upload custom app and select the latest zip file
  • Go to .../About/Developer Preview
  1. Switch to developer view (Optional)
  • On the top right corner of Teams App.
  • Navigate to About > Developer View

image

  • After switching to Developer View, right click to Teams App Icon and open dev tools

image

Further reading