Skip to content

Latest commit

 

History

History
page_type description products languages extensions urlFragment
sample
This sample app demonstrates bulk meeting creation on Teams calendars using an Excel upload.
office-teams
office
office-365
csharp
contentType createdDate
samples
09/13/2022 12:00:00 AM
officedev-microsoft-teams-samples-graph-bulk-meetings-csharp

Graph bulk meetings

This sample application allows users to efficiently create multiple meetings in Microsoft Teams calendars by uploading an Excel sheet. It utilizes the Graph API, provides a user-friendly tab interface for interaction, and includes comprehensive setup instructions for Microsoft Entra ID app registration and bot configuration.

Included Features

  • Tabs
  • Graph API

Interact with app

Meeting Event

Prerequisites

Run the app (Using Teams Toolkit for Visual Studio)

The simplest way to run this sample in Teams is to use Teams Toolkit for Visual Studio.

  1. Install Visual Studio 2022 Version 17.10 Preview 4 or higher Visual Studio
  2. Install Teams Toolkit for Visual Studio Teams Toolkit extension
  3. In the debug dropdown menu of Visual Studio, select Dev Tunnels > Create A Tunnel (set authentication type to Public) or select an existing public dev tunnel.
  4. In the debug dropdown menu of Visual Studio, select default startup project > Microsoft Teams (browser)
  5. In Visual Studio, right-click your TeamsApp project and Select Teams Toolkit > Prepare Teams App Dependencies
  6. Using the extension, sign in with your Microsoft 365 account where you have permissions to upload custom apps.
  7. Select Debug > Start Debugging or F5 to run the menu in Visual Studio.
  8. In the browser that launches, select the Add button to install the app to Teams.

If you do not have permission to upload custom apps (sideloading), Teams Toolkit will recommend creating and using a Microsoft 365 Developer Program account - a free program to get your own dev environment sandbox that includes Teams.

Setup

Note these instructions are for running the sample on your local machine, the tunnelling solution is required because the Teams service needs to call into the bot.

  1. Run ngrok - point to port 3978

    ngrok http 3978 --host-header="localhost:3978"

    Alternatively, you can also use the dev tunnels. Please follow Create and host a dev tunnel and host the tunnel with anonymous user access command as shown below:

    devtunnel host -p 3978 --allow-anonymous

Ngrok

  1. Setup for Microsoft Entra ID app registration In Azure portal, create a Microsoft Entra ID app registration - Navigate to API Permissions, and make sure to add the below permissions: - Select Add a permission, select Microsoft Graph -> Application permissions. - Calendars.ReadWrite - Calendars.Read

     - Click on Add permissions. Please make sure to grant the admin consent for the required permissions.
    

    Navigate to the Certificates & secrets. In the Client secrets section, click on "+ New client secret". Add a description (Name of the secret) for the secret and select “Never” for Expires. Click "Add". Once the client secret is created, copy its value, it need to be placed in the appsettings.json file.

  2. Setup for Bot In Azure portal, create a Azure Bot resource.

    • For bot handle, make up a name.
    • Select "Use existing app registration" (Create the app registration in Microsoft Entra ID beforehand.)
    • If you don't have an Azure account create an Azure free account here

    In the new Azure Bot resource in the Portal,

    • Ensure that you've enabled the Teams Channel
    • In Settings/Configuration/Messaging endpoint, enter the current https URL you were given by running the tunnelling application. Append with the path /api/messages
  3. Clone the repository

    git clone https://github.com/OfficeDev/Microsoft-Teams-Samples.git
  4. Launch Visual Studio

    • File -> Open -> Project/Solution
    • Navigate to folder where repository is cloned and then open this file samples/EventMeeting/csharp/EventMeeting.sln
  5. Setup and run the bot from Visual Studio: Modify the appsettings.json file with the following details:

    • Update configuration with the MicrosoftAppId, MicrosoftAppPassword and MicrosoftAppTenantId values received while doing Microsoft Entra ID app registration in your Azure portal.
    • Press F5 to run the project
  6. Modify the manifest.json in the /appPackage folder Replace the following details:

    • {{AAD_APP_CLIENT_ID}} with your MicrosoftAppId received after doing Microsoft Entra ID app registration in your Azure portal.
    • {{BOT_DOMAIN}} with base Url domain. E.g. if you are using ngrok it would be https://1234.ngrok-free.app then your domain-name will be 1234.ngrok-free.app and if you are using dev tunnels then your domain will be like: 12345.devtunnels.ms.
    • Zip up the contents of the appPackage folder to create a manifest.zip
    • Upload the manifest.zip to Teams (in the Apps view click "Upload a custom app")

Running the sample

  1. Imported Meetings view from the excel sheet. Meeting Event

  2. Dashborad of the Meetings Here is the all created meetings list. Meeting Event

  3. Created Meeting view in teams. Meeting Event

Deploy the bot to Azure

To learn more about deploying a bot to Azure, see Deploy your bot to Azure for a complete list of deployment instructions.

Further reading