Skip to content

Analyze the code, build and run the bot (NodeJS)

Benjamin Tsai edited this page Jun 18, 2023 · 2 revisions

To build and run the service using latest version of Visual Studio Code

  1. Launch the latest version of Visual Studio Code.
  2. Open the bots/sharepointMessagingExtensionsActionBot.js file
  3. In the SharepointMessagingExtensionsActionBot class you'll find these following methods:
async OnSharePointTaskGetCardViewAsync(context, taskModuleRequest)
...

async OnSharePointTaskGetQuickViewAsync(context, taskModuleRequest)
...

async OnSharePointTaskGetPropertyPaneConfigurationAsync(context, taskModuleRequest)
...

async OnSharePointTaskSetPropertyPaneConfigurationAsync(context, taskModuleRequest)

Let's quickly review what those methods are and how they get used by ACEs infrastructure:

OnSharePointTaskGetCardViewAsync

This method gets called when a card view is rendered. As a card may have multiple views, each view rendering calls this method. The code in the sample generates this output:

image

OnSharePointTaskGetQuickViewAsync

This method gets called when a quick view is rendered. As a card may have multiple quick views, each view rendering calls this method. The code in the sample generates this output: After doing this, you'll see your quick view render as follows:

image

OnSharePointTaskGetPropertyPaneConfigurationAsync

This method gets called when the dahsboard operator configures the card and opens the property pane. Developers can use this method to surface configuration options for the operator to configure a specific instance of the card.

OnSharePointTaskSetPropertyPaneConfigurationAsync

This method gets called when the dashboard operator commits the changes in the property pane.

You can find out more about this data, how it's rendered and the different card view templates at https://aka.ms/spfx or more specifically Build your first SharePoint Adaptive Card Extension | Microsoft Learn.

To run the project:

  1. Navigate to BotPoweredAcePreview/labs/NewBotACE/nodejs and run the below in your VS Code terminal:
npm start
  1. When you see the below in your terminal, your bot is ready!

    npm success