Microsoft Team Extendibility | Configure existing SPFx as Teams Tab Component using App Manifest

 Microsoft introduced the possibility to create custom Tab in Microsoft Teams using SharePoint Framework. With the version of SharePoint Framework 1.8, developer can implement Microsoft Teams cusotm Tab using SharePoint Framework.

 
Its significantly simplifies the development and automatically hosted the custom tab within sharepoint without any need of external services. 
 
In this article, I am going to take an already developed web part and see what it takes to get it into Microsoft Teams with upload custom app i.e. SPFx using manifest file. 



Project Setup

 
As mentioned you will need to setup your development environment with at least version of the SharePoint Framework at least 1.8 is required. Setup M365 Tenant Setup SPFx development environment
 

Development Process 

 
Microsoft Teams custom tabs created simply by using the SharePoint Framework 1.8 or later packages.
 
The high-level steps to get started are as follows,
  1. Create a SharePoint Framework solution with a client-side web part
  2. Add "TeamsTab" to the supportedHosts property of the web part manifest to use it as a tab in a channel: "supportedHosts": ["SharePointWebPart", "TeamsTab"]
  3. Add "TeamsPersonalApp" to the SupportedHost property of the web part manifest to use it as a personal app: "supportedHosts": ["SharePointWebPart", "TeamsPersonalApp"]
  4. Deploy the SPFx web part using tenant scoped deployment option to your SharePoint app catalog.
  5. Activate the SPFx solution, which you deployed and Sync to Teams button in the app catalog.
Project Structure look like this ( as i am using SPFx V1.9 for this demo, as it doesn't add manifest file automatically here)



Add Team Tab to Web Part Name manifest.json file

"supportedHosts": ["SharePointWebPart","TeamsTab"
Assumption here, you have finally deployed the SPFx web part and Sync to Team successfully.

 

Teams Manifest File 

 
This is the place where actual magic happen, The teams manifest file with in the teams package describe how to load the SPFx webpart into teams. 
 
There are five important section, which i need to call out here




The manifest file with 5 important parts,
 
Part 1
 
This section holds the package name and the id of the web part. This id is the same as the id in your web part manifest file. So that’s the connection to the web part to load.
 
Part 2
 
This section holds the name, description and icons as it will appear in Teams. So in order to make your app appear differently in the App catalog, this is the place to edit. The icons match to the icons in your ‘teams’ folder.
 
Part 3
 
This section holds the url to your Site collection connected to your team. Not only the Site collection, but a _layouts page ‘TeamsLogon.aspx’ is called with a ‘dest’ query string parameter holding a _layouts page called ‘teamshostedapp.aspx’. Next to this there are some other parameters. Let’s look into the actual url, 

  1. "configurableTabs": [  
  2.       {  
  3.           "configurationUrl""https://mittal1201.sharepoint.com/sites/Incident/_layouts/15/TeamsLogon.aspx?SPFX=true&dest=https://mittal1201.sharepoint.com/sites/Incident/_layouts/15/teamshostedapp.aspx%3FopenPropertyPane=true%26teams%26componentId=cf3de6a0-3b30-4dfc-a19b-c9f72432239d%26forceLocale=%7Blocale%7D",  
  4.           "canUpdateConfiguration"true,  
  5.           "scopes": [  
  6.               "team"  
  7.           ]  
  8.       }  
  9.   ]


Note
  • mittal1201.sharepoint.com -> team site domian.
  • /sites/incident -> team site path 
  • Encoded character format is very important, it will keep failing, if you missed any like %26 should not be replace with & , %7B should not replace with { , %7D should not replace with } 
The TeamsLogon.aspx is used to authenticate and with the current user to the SharePoint Online site. The TeamshostedApp.aspx page will render the actual web part using the component ID query string parameter, which point to the web part id in the manifest. Further more you can see there is a scopes property, which for now is only available for team
 
Part 4
 
This section hold all valid domain connected to your teams.

  1. "validDomains": [  
  2.         "mittal1201.sharepoint.com"  
  3.     ]

Part 5
 
This section used for SPFx web part SSO integration with Custom Teams Tab. 

  1. "webApplicationInfo": {  
  2.         "id""00000003-0000-0ff1-ce00-000000000000",  
  3.         "resource""https://mittal1201.sharepoint.com"  
  4.     }  


"id": "00000003-0000-0ff1-ce00-000000000000" . This is dummy resource id Or you can create an Azure AD APP within same tenant directory. Use Client ID from there.
 
Now, we are set with final configuraiton i.e.  Manifest and SPfx component . Let's start with Configuration steps 
 
Step 1 - Create Teams and Navigate to Manage Teams Setting
  • Create a new teams example "MSTeams-Tab"  into Microsoft Teams
  • Select "..." and Manage Teams 


Step 2: Navigate to  Selected Teams App Setting
  • Select Apps Tab
  • Right Bottom click to Upload Custom App to upload the manifest file.

Step 3 - Upload Created Manifest Zip File 
  • Create Zip file by selecting all three files i.e. manifest.json, color.png, outline.png
  • Upload via custom app options
  • Click to add button to add into selected Ms Teams 



 At this stage, you have added SPFx control configuration to MS Teams. Now you can add SPFx as a tab.
 
Step 4 - Add and Configure Cusotm Tab
  • Select the MSTeams and Navigate to General Channel or desired Channel within Teams
  • Click to "+" i.e. available next to tab.
  • Search your app name from avaialble created app name 
  • Select the created app name and App addition popup will appear.


Click Save to Continue and your SPFx control will appear as custom Tab i.e. given name "Reporting Management" into manifest file will appear here.
 
As i have already build SPFx control with charting (pre-requisites for this article) , which is configured and appeared now.



 I hope you enjoyed and learned something new in this article.

    Design Feedback Card with Microsoft Teams Using Power Automate and Adaptive Card

     In this article, we'll turn our attention toward designing a feedback card using Low Code Solution. Here I am going to articulate how to collect a feedback response from a MS Teams User and update the response back into sharepoint online list as data source.



    Power Automate has below actions under Microsoft Teams Connector (which is in preview mode as of now).
    1. Post an adaptive card as the Flow bot to a Teams user, and wait for a response
    2. Post an adaptive card as the Flow bot to a Teams channel, and wait for a response
    Once the adaptive card posted into MS Teams User or Channel with above defined actions. Power Automate instance will wait (async call) unless user didn't respond.
    Power Automate  documentation maximum waiting time for async call is 30 days. 
     
    Prerequisites
    1. Adaptive Card Designer refernece
    2. Power Automate i.e. Create Automate workflow reference
    3. SharePoint Online Cusotm List (Ticket Details & Feedback). Based on status of ticket i.e. closed  power automate post adaptive card respone to MS Teams User. Once User respond , user input will get store into data source i.e. feedback sharepoint online list.
    4. Microsoft Teams access 
    Lets start with power automate creation
    1. Login to https://flow.microsoft.com
    2. Create an instant flow with trigger "create or update sharepoint online list item"
    3. Create two SharePoint List i.e. Ticket Details & Feedback Response 
    On ticket detail status change trigger the feedback card.
     
     Column Name DataType Default Value
     TitleSingle Line Of Text  
     RequestorNamePeople Picker 
     Ticket StatusChoice 
    new, assigned,in progress
    on hold,resolved,closed
    cancelled
     Ticket DescriptionMulti line text  (Plain)
     
    Another List name Feedback Response,
     
     Column Name Data Type Default Value
     Title Single Line Of Text 
     Feedback Comment Multiple Line Of Text  
     Raiting Number 
     Ticket Id Single Line Of Text 
     
    Add an action "When an item is created or modified: in SharePoint Online List.



    Note
    In this scenario, As item get updated, power automate will get trigger and check the condition ticket status has closed or not. If ticket status has closed, then condtion will be true and it will trigger the rest of action to continue
     
    Add another action "Post an Adaptive Card to a Teams user and wait for a respnse"
    • Add Requestor Name (it can be find in ticket table, who has created a ticket)
    • Enter the Messgae 
    • Select "Should Update Card" Yes

    Click Create Adaptive Card and it will prompt adaptive card designer within same context.




    Select Card Payload Editor and Paste below JSON or You are free to design the card as per your requirement. 
    1. {  
    2.     "$schema""http://adaptivecards.io/schemas/adaptive-card.json",  
    3.     "type""AdaptiveCard",  
    4.     "version""1.2",  
    5.     "body": [  
    6.         {  
    7.             "type""TextBlock",  
    8.             "text""Ticket ID : @{triggerOutputs()?['body/ID']}",  
    9.             "size""large",  
    10.             "weight""bolder",  
    11.             "wrap"true  
    12.         },  
    13.         {  
    14.             "type""TextBlock",  
    15.             "text""Ticket Detail: @{triggerOutputs()?['body/Title']}",  
    16.             "isSubtle"true,  
    17.             "spacing""None",  
    18.             "wrap"true  
    19.         },  
    20.         {  
    21.             "type""TextBlock",  
    22.             "text""We would love to hear your thoughts, concerns or problems so we can improve.",  
    23.             "wrap"true  
    24.         },  
    25.         {  
    26.             "type""Input.ChoiceSet",  
    27.             "id""Feedback",  
    28.             "value""",  
    29.             "choices": [  
    30.                 {  
    31.                     "title""Bad",  
    32.                     "value""1"  
    33.                 },  
    34.                 {  
    35.                     "title""Poor",  
    36.                     "value""2"  
    37.                 },  
    38.                 {  
    39.                     "title""Moderate",  
    40.                     "value""3"  
    41.                 },  
    42.                 {  
    43.                     "title""Good",  
    44.                     "value""4"  
    45.                 },  
    46.                 {  
    47.                     "title""Excellent",  
    48.                     "value""5"  
    49.                 }  
    50.             ]  
    51.         },  
    52.         {  
    53.             "type""Input.Text",  
    54.             "id""Comments",  
    55.             "placeholder""What can we do to make it better?",  
    56.             "maxLength": 250,  
    57.             "isMultiline"true  
    58.         }  
    59.     ],  
    60.     "actions": [  
    61.         {  
    62.             "type""Action.Submit",  
    63.             "title""Send Feedback"  
    64.         }  
    65.     ]  
    66. }  
    Create Item based on user response into Feedback List



    Comment and Rating value will be populated from teams response, If value doesn't exist in your case , you can use below formula
     
    Comment ;- @{body('Post_an_Adaptive_Card_to_a_Teams_user_and_wait_for_a_response')?['data']?['Comments']}
    Rating :- @{body('Post_an_Adaptive_Card_to_a_Teams_user_and_wait_for_a_response')?['data']?['Rating']} 
     
    Validate and Save with user friendly name. 
     
    Once ticket status gets closed or user can manually chnage the status in the backend for testing purposes, Feedback Card will be post to indiviual user based on status.
     
    Flow Bot will post the feedback card to ticket creator. 


    Now user needs to respond or provide the feedback within 30 days (time out limitation for power automate)


    User can select the rating from dropdown and provide the relevant comments. Once user submits the response, user input will get stored into feedback response list.



    I hope you enjoyed and learned something new in this article.  Thanks for reading and stay tuned for the next article.