How To Use SharePoint Framework (SPFx) In Teams To Build An App

Microsoft has started supporting the Teams Tab/Personal App from SharePoint framework version1.18. And we can convert any SharePoint Framework widget build using framework 1.8 and above into Microsoft teams by making  a few changes in the webpart.
 
The main steps are: 
  • Open the webpart manifest file then add “Teams tab” (or) "Teams Personal APP" to the supportedHosts property
  • Deploy the solution into app catalogue
  • Choose the solution and click the “Sync to Teams” button.
Now the webpart will appear in teams.
 
Once the webpart is hosted in the Teams Tab, it will have access to the Teams SDK through the webpart context.
 
Starting with the SharePoint Framework v1.8, scaffolding will also include an additional /teams folder in the solution structure, with default configuration for your web parts, so that you can get started with Teams tab development as easily as possible.
 
Step 1
 
Add TeamsPersonal App (or) Teams Tab in Supportedhosts.
 
How To Use SharePoint Framework (SPFx) In Teams To Build An App
 
Step 2
 
Get the manifest file for teams from here and add the file into Teams folder.
 
Step 3
 
Update the ID (GUID)

How To Use SharePoint Framework (SPFx) In Teams To Build An App
 
Step 4
 
Deploy the app.
 
Go to command line
  • gullp bundle --ship
  • gulp package-solution –ship
Step 5
 
Upload the package to SharePoint app catalogue
 
How To Use SharePoint Framework (SPFx) In Teams To Build An App
 
How To Use SharePoint Framework (SPFx) In Teams To Build An App
 
Step 6
 
Sync that solutions to Teams
 
How To Use SharePoint Framework (SPFx) In Teams To Build An App
 
Step 7
 
Go to your Microsoft Team
 
Step 8
 
Click on + to add a new tab and search the app/webpart name

How To Use SharePoint Framework (SPFx) In Teams To Build An App
 
Step 9
 
SPfx app (webpart) is added into the teams tab.
 
How To Use SharePoint Framework (SPFx) In Teams To Build An App
 
Step 10
 
We can use the same webpart for SharePoint Online as well.

How To Use SharePoint Framework (SPFx) In Teams To Build An App
 
Happy Learning ! Happy Sharing !