Getting started with ACE in SPFx

Published Apr 20 2022 11:50 PM 1,237 Views
Senior Member

Output.png

 

What is ACE?

 

  • ACE stands for Adaptive card extension.
  • Adaptive Card Extensions (ACEs) are a new SharePoint Framework component type that is provided in SPFx from version 1.13.
  • Adaptive cards are simple JSON objects which will render the UI in a consistent and direct way on all the devices as it is portable and automatically styled.
  • We can render it on multiple platforms with different screen sizes and devices.

For more details refer to this article.

 

Prerequisites:

 

How to create ACE:

 

1. Create a directory where you want to create a project.

 

md ACE_SPFx

 2. Move to the directory

 

cd ACE_SPFx

 

3. Now we have to execute the below command:

 

yo @microsoft/sharepoint

 

4. It will ask configuration questions as below so you can set it up as your requirement.

 

Note: In the component types question when you select Adaptive card extensions, it will provide 3 options.

 

ChandaniPrajapati_1-1649488225736.png

 

 

ACE_Setup.png

 

 

After the successful creation of the project, you can use any code editor to modify your code. Here I am using VS code so will execute the below command to open the project.

 

code .

 

Project Structure:

 

After you will open your code in any editor your src folder structure will be looks like the below,

 

ChandaniPrajapati_0-1649489228272.png

 

Let's see the importance of some files:

 

assets We can add some assets like images and then we can use them for our web part.
loc localizing it for different languages
BasicCardAceAdaptiveCardExtension.ts Export and declare card view, register it, and render card view.
BasicCardAcePropertyPane.ts Configurations for property pane.
cardView/CardView.ts

Which renders on Dashboard. 

Available methods are cardButtons, data, and onCardSelection.

quickView/QuickView.ts

Quick view will open a popup to display the quick view component.

quickView/template/QuickViewTemplate.json It renders data in quick view and for this, we have to use JSON.

 

Render ACE

 

The virtual renderCard() method returns the string identifier to the registered view. This method is invoked during the initial render of the Card view.

 

 

 

protected renderCard(): string | undefined {
    return CARD_VIEW_REGISTRY_ID;
}

 

 

Register View for ACE

 

  • The view must be registered within a constructor or onInit() before we use it.
  • To use views, it must be registered with its respective ViewNavigator.
  • Two ViewNavigators are exposed on the ACE: cardNavigator and quickViewNavigator.

 

 

public onInit(): Promise<void> {
    this.state = { };

    this.cardNavigator.register(CARD_VIEW_REGISTRY_ID, () => new CardView());
    this.quickViewNavigator.register(QUICK_VIEW_REGISTRY_ID, () => new QuickView());

    return Promise.resolve();
}

 

 

 

Types of View:

 

Let's see more about the card and quick views.

 

Quick view

  • Can have image, form, text, button, and so on.
  • We can create multiple quick views like rendering data, error handling, and so on.
  • Quick views extend the BaseAdaptiveCardView base class.
  • There are three optional generics that can be defined:

    • TData: The type returned from the data() getter method.

    • TProperties: Similar to the Card view, this is the same interface used by persisted properties of the ACE (a property bag).
      TState Similar to the Card view, this is the set of stateful data the View needs to render. TState must share properties with the ACE's state interface.

Card View

  • Three views and two sizes.
  • The card views for Adaptive Card templates are fixed and cannot be changed.
  • Can have a single card view. 
  • There are two generics for the properties and state objects shared between the view and the ACE.

    • TProperties: The View's properties interface, is the same interface used by persisted properties of the ACE (a property bag).

    • TState: Unique to ACEs and can optionally define the set of renderable data.

  • data() -  The data getter is the only method that must be implemented by a Card view.

  • cardButtons - This property determines the number of buttons that appear on the Card and actions to perform when clicked.
  • onCardSelection -This method determines what will happen when the Card is clicked.

 

Types of card view:

 

  • Basic card template:
    • It extends from the BaseBasicCardView base class.
    • It manages the primary text, Title, and Icon configuration.

 

Basic card.png

 

  • Image card template:
    • It extends from the BaseImageCardView base class.

    • It manages the primary text, Title, Icon, and Image configuration.

 

 

Image card.png

 

  • Primary card template:
    • It extends from the BasePrimaryTextCardView base class.

    • It Manages the primary text, Title, Description, and Icon configuration.

       

 

Primary text.png

 

 

Execution:

 

Update the initial page property within the ./config/serve.json to point to your SharePoint Online tenant.

 

ChandaniPrajapati_0-1650031400531.png

 

And then execute the below command,

 

gulp serve

 

this command will open the page that we have used in initialPage on the localhost server to verify the ACE.

 

Deployment: 

 

If the project is working properly on a local server without any error, We can deploy it on the app catalog. We can deploy it using the following two commands.

 

gulp bundle --ship
gulp package-solution --ship

After successful execution of the above commands, it will create a .sppkg file to sharepoint/solution. Now add the package file to the app catalog.

 

Then move to the communication site.

 

Setup viva connection if you haven't done it.

 

ChandaniPrajapati_0-1650032199455.png

 

 

Or you can directly move to the /SitePages/Dashboard.aspx and add ACE.

 

ChandaniPrajapati_1-1650032377896.png

 

References:

 

Build your first SharePoint Adaptive Card Extension 

Advanced Card View Functionality 

Advanced Quick View Functionality 

 

Summary

 

In this article, we have seen what is ACE, How to create ACE, the importance of files, types of views, render and register ACE, and different card templates.

 

I hope this helps, if this helps you then share it with others.

 

Sharing is caring!

 

 

 

%3CLINGO-SUB%20id%3D%22lingo-sub-3280615%22%20slang%3D%22en-US%22%3EGetting%20started%20with%20ACE%20in%20SPFx%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3280615%22%20slang%3D%22en-US%22%3E%3CH2%20id%3D%22toc-hId-394564099%22%20id%3D%22toc-hId-415986837%22%3E%3CSTRONG%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22Output.png%22%20style%3D%22width%3A%20528px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F362552iEE655A2C2F8A45B2%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Output.png%22%20alt%3D%22Output.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSTRONG%3E%3C%2FH2%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--1412890364%22%20id%3D%22toc-hId--1391467626%22%3E%3CSTRONG%3EWhat%20is%20ACE%3F%3C%2FSTRONG%3E%3C%2FH2%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EACE%20stands%20for%20Adaptive%20card%20extension.%3C%2FLI%3E%0A%3CLI%3EAdaptive%20Card%20Extensions%20(ACEs)%20are%20a%20new%20SharePoint%20Framework%20component%20type%26nbsp%3Bthat%20is%20provided%20in%20SPFx%20from%20version%201.13.%3C%2FLI%3E%0A%3CLI%3EAdaptive%20cards%20are%20simple%20JSON%20objects%20which%20will%20render%20the%20UI%20in%20a%20consistent%20and%20direct%20way%20on%20all%20the%20devices%20as%20it%20is%20portable%20and%20automatically%20styled.%3C%2FLI%3E%0A%3CLI%3EWe%20can%20render%20it%20on%20multiple%20platforms%20with%20different%20screen%20sizes%20and%20devices.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EFor%20more%20details%20refer%20to%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fsharepoint%2Fdev%2Fspfx%2Fviva%2Fget-started%2Fbuild-first-sharepoint-adaptive-card-extension%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ethis%3C%2FA%3E%26nbsp%3Barticle.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-1074622469%22%20id%3D%22toc-hId-1096045207%22%3E%3CSTRONG%3EPrerequisites%3A%3C%2FSTRONG%3E%3C%2FH2%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3ENode%20-%20v14%20or%20v12%3C%2FLI%3E%0A%3CLI%3ESPFx%20version%20-%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fsharepoint%2Fdev%2Fspfx%2Frelease-1.13%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3E1.13%20and%20onwards%3C%2FA%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CH2%20id%3D%22toc-hId--732831994%22%20id%3D%22toc-hId--711409256%22%3E%3CSTRONG%3EHow%20to%20create%20ACE%3A%3C%2FSTRONG%3E%3C%2FH2%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E1.%20Create%20a%20directory%20where%20you%20want%20to%20create%20a%20project.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3Emd%20ACE_SPFx%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B2.%20Move%20to%20the%20directory%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3Ecd%20ACE_SPFx%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E3.%20Now%20we%20have%20to%20execute%20the%20below%20command%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3Eyo%20%40microsoft%2Fsharepoint%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E4.%20It%20will%20ask%20configuration%20questions%20as%20below%20so%20you%20can%20set%20it%20up%20as%20your%20requirement.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3ENote%3A%20In%20the%20component%20types%20question%20when%20you%20select%20Adaptive%20card%20extensions%2C%20it%20will%20provide%203%20options.%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22ChandaniPrajapati_1-1649488225736.png%22%20style%3D%22width%3A%20797px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F362551iA4E2BC24E8AE2DF4%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22ChandaniPrajapati_1-1649488225736.png%22%20alt%3D%22ChandaniPrajapati_1-1649488225736.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22ACE_Setup.png%22%20style%3D%22width%3A%20836px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F362550i4C0C9BF133BEEFA8%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22ACE_Setup.png%22%20alt%3D%22ACE_Setup.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAfter%20the%20successful%20creation%20of%20the%20project%2C%20you%20can%20use%20any%20code%20editor%20to%20modify%20your%20code.%20Here%20I%20am%20using%20VS%20code%20so%20will%20execute%20the%20below%20command%20to%20open%20the%20project.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3Ecode%20.%3C%2FPRE%3E%0A%3CH2%20id%3D%22toc-hId-1754680839%22%20id%3D%22toc-hId-1776103577%22%3E%26nbsp%3B%3C%2FH2%3E%0A%3CH2%20id%3D%22toc-hId--52773624%22%20id%3D%22toc-hId--31350886%22%3E%3CSTRONG%3EProject%20Structure%3A%3C%2FSTRONG%3E%3C%2FH2%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAfter%20you%20will%20open%20your%20code%20in%20any%20editor%20your%20%3CSTRONG%3Esrc%3C%2FSTRONG%3E%20folder%20structure%20will%20be%20looks%20like%20the%20below%2C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22ChandaniPrajapati_0-1649489228272.png%22%20style%3D%22width%3A%20456px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F362553i2ABA2788B79AA646%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22ChandaniPrajapati_0-1649489228272.png%22%20alt%3D%22ChandaniPrajapati_0-1649489228272.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ELet's%20see%20the%20importance%20of%20some%20files%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CTABLE%20border%3D%221%22%20width%3D%22100%25%22%3E%0A%3CTBODY%3E%0A%3CTR%3E%0A%3CTD%20width%3D%2250%25%22%20height%3D%2257px%22%3E%3CSTRONG%3Eassets%3C%2FSTRONG%3E%3C%2FTD%3E%0A%3CTD%20width%3D%2250%25%22%20height%3D%2257px%22%3EWe%20can%20add%20some%20assets%20like%20images%20and%20then%20we%20can%20use%20them%20for%20our%20web%20part.%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20width%3D%2250%25%22%20height%3D%2239px%22%3E%3CSTRONG%3Eloc%3C%2FSTRONG%3E%3C%2FTD%3E%0A%3CTD%20width%3D%2250%25%22%20height%3D%2239px%22%3Elocalizing%20it%20for%20different%20languages%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20width%3D%2250%25%22%20height%3D%2239px%22%3E%3CSTRONG%3EBasicCardAceAdaptiveCardExtension.ts%3C%2FSTRONG%3E%3C%2FTD%3E%0A%3CTD%20width%3D%2250%25%22%20height%3D%2239px%22%3EExport%20and%20declare%20card%20view%2C%20register%20it%2C%20and%20render%20card%20view.%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20width%3D%2250%25%22%20height%3D%2239px%22%3E%3CSTRONG%3EBasicCardAcePropertyPane.ts%3C%2FSTRONG%3E%3C%2FTD%3E%0A%3CTD%20width%3D%2250%25%22%20height%3D%2239px%22%3EConfigurations%20for%20property%20pane.%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%3E%3CSTRONG%3EcardView%2FCardView.ts%3C%2FSTRONG%3E%3C%2FTD%3E%0A%3CTD%3E%3CP%3EWhich%20renders%20on%20Dashboard.%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAvailable%20methods%20are%26nbsp%3B%3CSTRONG%3EcardButtons%3C%2FSTRONG%3E%2C%20%3CSTRONG%3Edata%2C%3C%2FSTRONG%3E%20and%26nbsp%3B%3CSTRONG%3EonCardSelection%3C%2FSTRONG%3E.%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20width%3D%2250%25%22%20height%3D%2239px%22%3E%3CSTRONG%3EquickView%2FQuickView.ts%3C%2FSTRONG%3E%3C%2FTD%3E%0A%3CTD%20width%3D%2250%25%22%20height%3D%2239px%22%3E%3CP%3EQuick%20view%20will%20open%20a%20popup%20to%20display%20the%20quick%20view%20component.%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20width%3D%2250%25%22%20height%3D%2239px%22%3E%3CSTRONG%3EquickView%2Ftemplate%2FQuickViewTemplate.json%3C%2FSTRONG%3E%3C%2FTD%3E%0A%3CTD%20width%3D%2250%25%22%20height%3D%2239px%22%3EIt%20renders%20data%20in%20quick%20view%20and%20for%20this%2C%20we%20have%20to%20use%20JSON.%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3C%2FTBODY%3E%0A%3C%2FTABLE%3E%0A%3CH3%20id%3D%22toc-hId-637787850%22%20id%3D%22toc-hId-659210588%22%3E%26nbsp%3B%3C%2FH3%3E%0A%3CH3%20id%3D%22toc-hId--1169666613%22%20id%3D%22toc-hId--1148243875%22%3E%3CSTRONG%3ERender%20ACE%3C%2FSTRONG%3E%3C%2FH3%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20virtual%20%3CSTRONG%3ErenderCard()%3C%2FSTRONG%3E%20method%20returns%20the%20string%20identifier%20to%20the%20registered%20view.%20This%20method%20is%20invoked%20during%20the%20initial%20render%20of%20the%20Card%20view.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-javascript%22%3E%3CCODE%3Eprotected%20renderCard()%3A%20string%20%7C%20undefined%20%7B%0A%20%20%20%20return%20CARD_VIEW_REGISTRY_ID%3B%0A%7D%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId-1317846220%22%20id%3D%22toc-hId-1339268958%22%3E%3CSTRONG%3ERegister%20View%20for%20ACE%3C%2FSTRONG%3E%3C%2FH3%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EThe%20view%20must%20be%20registered%20within%20a%20constructor%20or%20%3CSTRONG%3EonInit()%3C%2FSTRONG%3E%20before%20we%20use%20it.%3C%2FLI%3E%0A%3CLI%3ETo%20use%20views%2C%20it%20must%20be%20registered%20with%20its%20respective%20%3CSTRONG%3EViewNavigator%3C%2FSTRONG%3E.%3C%2FLI%3E%0A%3CLI%3ETwo%20%3CSTRONG%3EViewNavigators%3C%2FSTRONG%3E%20are%20exposed%20on%20the%20ACE%3A%20%3CSTRONG%3EcardNavigator%3C%2FSTRONG%3E%20and%20%3CSTRONG%3EquickViewNavigator.%3C%2FSTRONG%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-javascript%22%3E%3CCODE%3Epublic%20onInit()%3A%20Promise%3CVOID%3E%20%7B%0A%20%20%20%20this.state%20%3D%20%7B%20%7D%3B%0A%0A%20%20%20%20this.cardNavigator.register(CARD_VIEW_REGISTRY_ID%2C%20()%20%3D%26gt%3B%20new%20CardView())%3B%0A%20%20%20%20this.quickViewNavigator.register(QUICK_VIEW_REGISTRY_ID%2C%20()%20%3D%26gt%3B%20new%20QuickView())%3B%0A%0A%20%20%20%20return%20Promise.resolve()%3B%0A%7D%3C%2FVOID%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-1307343116%22%20id%3D%22toc-hId-1328765854%22%3E%3CSTRONG%3ETypes%20of%20View%3A%3C%2FSTRONG%3E%3C%2FH2%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ELet's%20see%20more%20about%20the%20card%20and%20quick%20views.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH4%20id%3D%22toc-hId-1431823830%22%20id%3D%22toc-hId-1453246568%22%3E%3CSTRONG%3EQuick%20view%3C%2FSTRONG%3E%3C%2FH4%3E%0A%3CUL%3E%0A%3CLI%3ECan%20have%20image%2C%20form%2C%20text%2C%20button%2C%20and%20so%20on.%3C%2FLI%3E%0A%3CLI%3EWe%20can%20create%20multiple%20quick%20views%20like%20rendering%20data%2C%20error%20handling%2C%20and%20so%20on.%3C%2FLI%3E%0A%3CLI%3E%3CSPAN%3EQuick%20views%20extend%20the%26nbsp%3BBaseAdaptiveCardView%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3Ebase%20class.%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%3E%3CP%3EThere%20are%20three%20optional%20generics%20that%20can%20be%20defined%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CP%3E%3CSTRONG%3ETData%3C%2FSTRONG%3E%3A%20The%20type%20returned%20from%20the%20%3CSTRONG%3Edata()%3C%2FSTRONG%3E%20getter%20method.%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%3CP%3E%3CSTRONG%3ETProperties%3C%2FSTRONG%3E%3A%20Similar%20to%20the%20Card%20view%2C%20this%20is%20the%20same%20interface%20used%20by%20persisted%20properties%20of%20the%20ACE%20(a%20property%20bag).%3CBR%20%2F%3ETState%20Similar%20to%20the%20Card%20view%2C%20this%20is%20the%20set%20of%20stateful%20data%20the%20View%20needs%20to%20render.%20TState%20must%20share%20properties%20with%20the%20ACE's%20state%20interface.%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%0A%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CH4%20id%3D%22toc-hId--375630633%22%20id%3D%22toc-hId--354207895%22%3E%3CSTRONG%3ECard%20View%3C%2FSTRONG%3E%3C%2FH4%3E%0A%3CUL%3E%0A%3CLI%3EThree%20views%20and%20two%20sizes.%3C%2FLI%3E%0A%3CLI%3EThe%20card%20views%20for%20Adaptive%20Card%20templates%20are%20fixed%20and%20cannot%20be%20changed.%3C%2FLI%3E%0A%3CLI%3ECan%20have%20a%20single%20card%20view.%26nbsp%3B%3C%2FLI%3E%0A%3CLI%3E%3CP%3EThere%20are%20two%20generics%20for%20the%20properties%20and%20state%20objects%20shared%20between%20the%20view%20and%20the%20ACE.%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CP%3E%3CSTRONG%3ETProperties%3C%2FSTRONG%3E%3A%20The%20View's%20properties%20interface%2C%20is%20the%20same%20interface%20used%20by%20persisted%20properties%20of%20the%20ACE%20(a%20property%20bag).%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%3CP%3E%3CSTRONG%3ETState%3C%2FSTRONG%3E%3A%20Unique%20to%20ACEs%20and%20can%20optionally%20define%20the%20set%20of%20renderable%20data.%3C%2FP%3E%0A%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FLI%3E%0A%3CLI%3E%3CP%3E%3CSTRONG%3Edata%3C%2FSTRONG%3E()%20-%26nbsp%3B%20The%20data%20getter%20is%20the%20only%20method%20that%20must%20be%20implemented%20by%20a%20Card%20view.%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3EcardButtons%3C%2FSTRONG%3E%26nbsp%3B-%20This%20property%20determines%20the%20number%20of%20buttons%20that%20appear%20on%20the%20Card%20and%20actions%20to%20perform%20when%20clicked.%3C%2FLI%3E%0A%3CLI%3E%3CP%3E%3CSTRONG%3EonCardSelection%3C%2FSTRONG%3E%26nbsp%3B-This%20method%20determines%20what%20will%20happen%20when%20the%20Card%20is%20clicked.%3C%2FP%3E%0A%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId-1982799481%22%20id%3D%22toc-hId-2004222219%22%3E%3CSTRONG%3ETypes%20of%20card%20view%3A%3C%2FSTRONG%3E%3C%2FH3%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CSTRONG%3EBasic%20card%20template%3A%3C%2FSTRONG%3E%3CUL%3E%0A%3CLI%3EIt%20extends%20from%20the%26nbsp%3B%3CSPAN%3EBaseBasicCardView%26nbsp%3B%3C%2FSPAN%3Ebase%20class.%3C%2FLI%3E%0A%3CLI%3EIt%20manages%20the%20primary%20text%2C%20Title%2C%20and%20Icon%20configuration.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22Basic%20card.png%22%20style%3D%22width%3A%20602px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F364211i1503E3CFF85A3058%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Basic%20card.png%22%20alt%3D%22Basic%20card.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CSTRONG%3EImage%20card%20template%3A%3C%2FSTRONG%3E%3CUL%3E%0A%3CLI%3E%3CP%3EIt%20extends%20from%20the%20BaseImageCardView%20base%20class.%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%3CP%3E%3CSPAN%3EIt%20manages%20the%20primary%20text%2C%20Title%2C%20Icon%2C%20and%20Image%20configuration.%3C%2FSPAN%3E%3C%2FP%3E%0A%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22Image%20card.png%22%20style%3D%22width%3A%20748px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F364212i11B33A7D26FFE4EA%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Image%20card.png%22%20alt%3D%22Image%20card.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CSTRONG%3EPrimary%20card%20template%3A%3C%2FSTRONG%3E%3CUL%3E%0A%3CLI%3E%3CP%3EIt%20extends%20from%20the%20BasePrimaryTextCardView%20base%20class.%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%3CP%3E%3CSPAN%3EIt%20Manages%20the%20primary%20text%2C%20Title%2C%20Description%2C%20and%20Icon%20configuration.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22Primary%20text.png%22%20style%3D%22width%3A%20577px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F364213i9466BEA64B549962%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Primary%20text.png%22%20alt%3D%22Primary%20text.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-46262299%22%20id%3D%22toc-hId-67685037%22%3E%26nbsp%3B%3C%2FH2%3E%0A%3CH2%20id%3D%22toc-hId--1761192164%22%20id%3D%22toc-hId--1739769426%22%3E%3CSTRONG%3EExecution%3A%3C%2FSTRONG%3E%3C%2FH2%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EUpdate%20the%20initial%20page%20property%20within%20the%20%3CSTRONG%3E.%2Fconfig%2Fserve.json%3C%2FSTRONG%3E%20to%20point%20to%20your%20SharePoint%20Online%20tenant.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22ChandaniPrajapati_0-1650031400531.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F364524iCE8EDDDC265994B6%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22ChandaniPrajapati_0-1650031400531.png%22%20alt%3D%22ChandaniPrajapati_0-1650031400531.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAnd%20then%20execute%20the%20below%20command%2C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3Egulp%20serve%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3Ethis%20command%20will%20open%20the%26nbsp%3Bpage%20that%20we%20have%20used%20in%20%3CSTRONG%3EinitialPage%3C%2FSTRONG%3E%3C%2FSPAN%3E%3CSPAN%3E%3CSTRONG%3E%26nbsp%3B%3C%2FSTRONG%3Eon%20the%20localhost%20server%20to%20verify%20the%20ACE.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-726320669%22%20id%3D%22toc-hId-747743407%22%3E%3CSTRONG%3EDeployment%3A%26nbsp%3B%3C%2FSTRONG%3E%3C%2FH2%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20the%20project%20is%20working%20properly%20on%20a%20local%20server%20without%20any%20error%2C%20We%20can%20deploy%20it%20on%20the%20app%20catalog.%20We%20can%20deploy%20it%20using%20the%20following%20two%20commands.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3Egulp%20bundle%20--ship%3C%2FPRE%3E%0A%3CPRE%3Egulp%20package-solution%20--ship%3C%2FPRE%3E%0A%3CP%3EAfter%20successful%20execution%20of%20the%20above%20commands%2C%20it%20will%20create%20a%20.sppkg%20file%20to%20%3CSTRONG%3Esharepoint%2Fsolution.%3C%2FSTRONG%3E%20Now%20add%20the%20package%20file%20to%20the%20app%20catalog.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThen%20move%20to%20the%20communication%20site.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ESetup%20viva%20connection%20if%20you%20haven't%20done%20it.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22ChandaniPrajapati_0-1650032199455.png%22%20style%3D%22width%3A%20279px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F364534i60A6078584DF766D%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22ChandaniPrajapati_0-1650032199455.png%22%20alt%3D%22ChandaniPrajapati_0-1650032199455.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EOr%20you%20can%20directly%20move%20to%20the%20%3CSTRONG%3E%2FSitePages%2FDashboard.aspx%3C%2FSTRONG%3E%20and%20add%20ACE.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22ChandaniPrajapati_1-1650032377896.png%22%20style%3D%22width%3A%20573px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F364535i578A4C65607FD4E7%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22ChandaniPrajapati_1-1650032377896.png%22%20alt%3D%22ChandaniPrajapati_1-1650032377896.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--1081133794%22%20id%3D%22toc-hId--1059711056%22%3EReferences%3A%3C%2FH2%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fsharepoint%2Fdev%2Fspfx%2Fviva%2Fget-started%2Fbuild-first-sharepoint-adaptive-card-extension%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EBuild%20your%20first%20SharePoint%20Adaptive%20Card%20Extension%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fsharepoint%2Fdev%2Fspfx%2Fviva%2Fget-started%2Fadvanced-card-view-functionality%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EAdvanced%20Card%20View%20Functionality%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fsharepoint%2Fdev%2Fspfx%2Fviva%2Fget-started%2Fadvanced-quick-view-functionality%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EAdvanced%20Quick%20View%20Functionality%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-1406379039%22%20id%3D%22toc-hId-1427801777%22%3ESummary%3C%2FH2%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIn%20this%20article%2C%20we%20have%20seen%20what%20is%20ACE%2C%20How%20to%20create%20ACE%2C%20the%20importance%20of%20files%2C%20types%20of%20views%2C%20render%20and%20register%20ACE%2C%20and%20different%20card%20templates.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%20hope%20this%20helps%2C%20if%20this%20helps%20you%20then%20share%20it%20with%20others.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ESharing%20is%20caring!%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-3280615%22%20slang%3D%22en-US%22%3E%3CP%3EIn%20this%20article%2C%20we%20will%20see%20what%20is%20ACE%2C%20How%20to%20create%20ACE%2C%20the%20importance%20of%20files%2C%20types%20of%20views%2C%20render%20and%20register%20ACE%2C%20and%20different%20card%20templates.%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-3280615%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EGetting%20started%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Co-Authors
Version history
Last update:
‎Apr 20 2022 07:45 AM
Updated by: