page_type | languages | products | name | urlFragment | description | extensions | ||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
sample |
|
|
Todo List with SPFx |
officedev-teamsfx-samples-tab-todo-list-SPFx |
Todo List app hosting on SharePoint. |
|
Todo List with SPFx
is a Todo List Manage tool for a group of people. This app is installed in Teams Team or Channel and hosted on SharePoint, members in the Team/Channel can collaborate on the same Todo List, manipulate the same set of Todo items. There is no requirement asking for an Azure account to deploy Azure resources to run this sample app.
- How to create SharePoint List in the SharePoint team site and how to do CRUD operations on SharePoint List in SPFx context.
- How to deploy your app to SharePoint App Catalog and sync the solution to Teams App Catalog.
- Set up SharePoint Framework development environment(Recommend to use SPFx v1.18.2)
- An Microsoft 365 account. Get your own free Microsoft 365 tenant from Microsoft 365 developer program
- Use the team site in SharePoint to create a List.
- Navigate to the SharePoint team site, in
Home
tab, clickNew
and selectList
.
Note: Each Team/Channel in Teams has a corresponding team site in SharePoint. You must navigate to the target SharePoint team site of the Team/Channel in which you want to add the "Todo List" app. The team site URL ends with xx.sharepoint.com/sites/xx. eg.
https://{your-tenant-name}.sharepoint.com/sites/{your-team-name}
. In case you want to create a List in subsite of the team site, you will need manual steps to change the site url in ./src/src/webparts/todoList/components/SharePointListManager.ts.- Name the List 'To Do List'
- Click
Add Column
, selectSingle line of text
, name the column 'description' - Click
Add Column
, selectYes/No
, name the column 'isCompleted', and set the default value toNo
.
- Navigate to the SharePoint team site, in
- Teams Toolkit Visual Studio Code Extension version 5.0.0 and higher or Teams Toolkit CLI
- [Optional] If you want your users see only the items created by themselves, add access control to your List.
- [Optional] If you want your guest users use the To-Do-list when using Teams Desktop app, add access permission to your app catlog.
Debug the app with Teams workbench
- In Debug mode, select
Teams workbench (Edge)
orTeams workbench (Chrome)
and press start button. The browser will be opened and you need to sign in Teams with your Microsoft 365 account. - Click
Add to a team
. - You should see the app running in your Teams.
Here are the instructions to run the sample in Visual Studio Code. You can also try to run the app using Teams Toolkit CLI tool, refer to Try sample with Teams Toolkit CLI
-
Clone the repo to your local workspace or directly download the source code.
-
Open ./src/src/webparts/todoList/components/SharePointListManager.ts, navigate to line:17, set the
listname
variable to your SharePoint List name. -
Open the project in Visual Studio Code, click
Provision
in LIFECYCLE panel of Microsoft Teams Toolkit extension or open the command palette and selectTeams: Provision
. This step will create an app in Teams App Studio. -
Go back to Microsoft Teams Toolkit extension, click
Deploy
in LIFECYCLE panel or open the command palette and selectTeams: Deploy
.This step will build a SharePoint package (*.sppkg) under
sharepoint/solution
folder. The Teams Toolkit will automatically upload and deploy it to your tenant App Catalog site. Only tenant App Catalog site admin has permission to do it. If you are not the admin, you can create your test tenant following Setup your Microsoft 365 tenant. -
Go back to Microsoft Teams Toolkit extension, in LIFECYCLE panel, click
Publish
or open the command palette and selectTeams: Publish
. -
Check the published app in Microsoft Teams admin center by searching "todoList" in the search box.
-
Click the 'TodoList' app you just published and select
Publish
in the Publishing status.It may take a few minutes to publish the Teams app.
-
Login to Teams using your Microsoft 365 tenant admin account, same account you are using to create SharePoint environment and logging to VS Code extension. You will see your app in the
Apps - Built for your org
.
- Since SharePoint can get the context so app user doesn't need to do consent/login operation.
- You could add new todo item by clicking "Add Task" button.
- You could complete todo item by choosing the checkbox before the item.
- You could update todo item by typing text in todo item list.
- You could delete todo item by clicking "..." and then choose "Delete" button.
- Getting started with SharePoint Framework
- Building for Microsoft teams
- Publish SharePoint Framework applications to the Marketplace
- Microsoft 365 Patterns and Practices - Guidance, tooling, samples and open-source controls for your Microsoft 365 development
- Importing msteams-ui-components-react package will cause issues during package build:
- When you want to switch accounts to test the app, and if you are using edge browser with profile mode instead of guest mode, we suggest you to switch accounts by switching profiles in the browser. This is because if you simply log out in Teams site, SharePoint site will still use the profile account. Thus the accounts for these two sites may be not consistent and will cause error.
Date | Author | Comments |
---|---|---|
Apr 21, 2022 | huihuiwu | Update to support Teams Toolkit v4.0.0 |
Mar 23, 2023 | huihuiwu | Update to support Teams Toolkit v5.0.0 |
Dec 5, 2023 | yuqzho | Upgrade to SPFx 1.18.2 |
We really appreciate your feedback! If you encounter any issue or error, please report issues to us following the Supporting Guide. Meanwhile you can make recording of your journey with our product, they really make the product better. Thank you!