Skip to content

Analyze the code, build and run the bot

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

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

  1. Go to File > Open > Project/Solution.
  2. Select TeamsMessagingExtensionsAction.csproj file from /labs/NewBotACE/csharp/.
  3. Open SharePointAdapativeCardExtensionBot.cs under /Bots folder. In the SharePointAdapativeCardExtensionBot class you'll find these following methods:
protected override Task<GetQuickViewResponse> OnSharePointTaskGetQuickViewAsync(ITurnContext<IInvokeActivity> turnContext, TaskModuleRequest taskModuleRequest, CancellationToken cancellationToken)
...

protected override Task<GetCardViewResponse> OnSharePointTaskGetCardViewAsync(ITurnContext<IInvokeActivity> turnContext, TaskModuleRequest taskModuleRequest, CancellationToken cancellationToken)
...

protected override Task<GetPropertyPaneConfigurationResponse> OnSharePointTaskGetPropertyPaneConfigurationAsync(ITurnContext<IInvokeActivity> turnContext, TaskModuleRequest taskModuleRequest, CancellationToken cancellationToken)
...

protected override Task OnSharePointTaskSetPropertyPaneConfigurationAsync(ITurnContext<IInvokeActivity> turnContext, TaskModuleRequest taskModuleRequest, CancellationToken cancellationToken)

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 will call this method. The code in the sample generates this output:
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. Press F5 to run the project.
  2. Select Yes if the following dialog appears:

image

A webpage appears with a message Your bot is ready!. image