|
| 1 | +# Share via Teams Chat |
| 2 | + |
| 3 | +## Summary |
| 4 | + |
| 5 | +Share via Teams Chat is a SharePoint Framework list view command set that enables users to send one or more selected SharePoint list items or documents to Microsoft Teams chats and channels as a rich, formatted message with an Adaptive Card. |
| 6 | + |
| 7 | +The solution is designed to make it easy to share contextual SharePoint content with colleagues directly from the list experience without leaving the site. |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | +## Compatibility |
| 14 | + |
| 15 | +This sample is compatible with the following environment configuration: |
| 16 | + |
| 17 | + |
| 18 | + |
| 19 | + |
| 20 | + |
| 21 | +## Applies to |
| 22 | + |
| 23 | +- [SharePoint Framework](https://learn.microsoft.com/sharepoint/dev/spfx/sharepoint-framework-overview) |
| 24 | +- [SharePoint Framework Extensions](https://learn.microsoft.com/sharepoint/dev/spfx/extensions/overview-extensions) |
| 25 | +- [List view command sets](https://learn.microsoft.com/sharepoint/dev/spfx/extensions/get-started/building-simple-cmdset-with-dialog-api) |
| 26 | +- [Microsoft 365 tenant](https://learn.microsoft.com/sharepoint/dev/spfx/set-up-your-developer-tenant) |
| 27 | +- SharePoint Online lists and document libraries |
| 28 | + |
| 29 | +## Contributors |
| 30 | + |
| 31 | +- [Harminder Singh](https://github.com/HarminderSethi) |
| 32 | + |
| 33 | +## Version history |
| 34 | + |
| 35 | +| Version | Date | Comments | |
| 36 | +| ------- | ---- | -------- | |
| 37 | +| 1.0.0 | July 2, 2026 | Initial sample version | |
| 38 | + |
| 39 | +## Prerequisites |
| 40 | + |
| 41 | +- SharePoint Online tenant |
| 42 | +- SharePoint site with a list or document library |
| 43 | +- Node.js v22 compatible with SPFx 1.23.0 |
| 44 | +- Tenant app catalog or site collection app catalog for deployment |
| 45 | +- Permissions to install SharePoint Framework solutions |
| 46 | +- Microsoft Graph permissions approved by a tenant administrator |
| 47 | + |
| 48 | +## Minimal Path to Awesome |
| 49 | + |
| 50 | +- Clone this repository or download this sample as a ZIP file. |
| 51 | +- In the command line, move to the sample folder: |
| 52 | + |
| 53 | +```bash |
| 54 | +cd samples/react-share-via-teams-chat-extension |
| 55 | +``` |
| 56 | + |
| 57 | +- Install dependencies: |
| 58 | + |
| 59 | +```bash |
| 60 | +npm install |
| 61 | +``` |
| 62 | + |
| 63 | +- Start the local debug server: |
| 64 | + |
| 65 | +```bash |
| 66 | +npm start |
| 67 | +``` |
| 68 | + |
| 69 | +- Open the SharePoint workbench and test the command set from a list or library view. |
| 70 | + |
| 71 | +## Features |
| 72 | + |
| 73 | +### Multi-item sharing |
| 74 | + |
| 75 | +Lets users select one or more SharePoint items and send them together to a Teams destination. |
| 76 | + |
| 77 | +### Teams destination selection |
| 78 | + |
| 79 | +Provides a dialog experience for choosing a Teams chat or channel before sending the message. |
| 80 | + |
| 81 | +### Rich message composition |
| 82 | + |
| 83 | +Supports an optional message body and a formatted Adaptive Card that links back to the SharePoint item or document. |
| 84 | + |
| 85 | +### Fluent UI experience |
| 86 | + |
| 87 | +Uses Fluent UI components for a polished, modern dialog experience in SharePoint. |
| 88 | + |
| 89 | +## Supported contexts |
| 90 | + |
| 91 | +The extension is intended for SharePoint Online lists and document libraries where the list view command set can surface the custom action. |
| 92 | + |
| 93 | +## Build and package |
| 94 | + |
| 95 | +To build the project: |
| 96 | + |
| 97 | +```bash |
| 98 | +npm run build |
| 99 | +``` |
| 100 | + |
| 101 | +This produces the SharePoint package in the solution folder for deployment. |
| 102 | + |
| 103 | +## Installation |
| 104 | + |
| 105 | +1. Build the solution package. |
| 106 | +2. Upload the generated .sppkg file to the tenant app catalog or a site collection app catalog. |
| 107 | +3. Deploy the solution. |
| 108 | +4. Navigate to the target SharePoint site. |
| 109 | +5. Add the app to the site and confirm the command set is available in list and library views. |
| 110 | + |
| 111 | +## Usage |
| 112 | + |
| 113 | +1. Open a SharePoint list or document library. |
| 114 | +2. Select one or more items. |
| 115 | +3. Choose Send to Teams from the command bar. |
| 116 | +4. Select a Teams chat or channel. |
| 117 | +5. Add an optional message. |
| 118 | +6. Send the message. |
| 119 | + |
| 120 | +## Permissions used |
| 121 | + |
| 122 | +The solution requests delegated Microsoft Graph permissions for: |
| 123 | + |
| 124 | +- Chat.Read |
| 125 | +- Chat.ReadWrite |
| 126 | +- Chat.ReadBasic |
| 127 | +- ChatMessage.Send |
| 128 | +- Team.ReadBasic.All |
| 129 | +- Channel.ReadBasic.All |
| 130 | +- ChannelMessage.Send |
| 131 | + |
| 132 | +## Privacy and data handling |
| 133 | + |
| 134 | +This sample uses Microsoft Graph from the SharePoint client-side context and does not require a custom backend service. |
| 135 | + |
| 136 | +- The selected SharePoint item information is sent only when a user initiates sharing. |
| 137 | +- Sharing a link or message in Teams does not automatically grant the recipient access to the underlying SharePoint item or document. |
| 138 | +- The experience relies on delegated permissions that must be approved by a tenant administrator. |
| 139 | +- The message content is composed by the user and sent to the chosen Teams destination. |
| 140 | + |
| 141 | +## Known limitations |
| 142 | + |
| 143 | +- The experience depends on the user having access to the target Teams chat or channel. |
| 144 | +- Microsoft Graph permissions must be approved before the sample can send messages successfully. |
| 145 | +- The sample is intended for SharePoint Online and relies on the modern command bar experience. |
| 146 | + |
| 147 | +## References |
| 148 | + |
| 149 | +- [SharePoint Framework overview](https://learn.microsoft.com/sharepoint/dev/spfx/sharepoint-framework-overview) |
| 150 | +- [Build your first list view command set](https://learn.microsoft.com/sharepoint/dev/spfx/extensions/get-started/building-simple-cmdset-with-dialog-api) |
| 151 | +- [Microsoft Graph permissions reference](https://learn.microsoft.com/graph/permissions-reference) |
| 152 | +- [PnPjs documentation](https://pnp.github.io/pnpjs/) |
| 153 | + |
| 154 | +## Disclaimer |
| 155 | + |
| 156 | +THIS CODE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. |
| 157 | + |
| 158 | +## Help |
| 159 | + |
| 160 | +We do not support samples directly, but the community is always willing to help. If you run into issues, please use the GitHub issues for this sample repository to report them or ask questions. |
| 161 | + |
| 162 | +You can try looking at [issues related to this sample](https://github.com/pnp/sp-dev-fx-extensions/issues?q=react-share-via-teams-chat-extension) to see if anybody else is having the same issues. |
| 163 | + |
| 164 | +You can also try looking at [discussions related to this sample](https://github.com/pnp/sp-dev-fx-extensions/discussions?discussions_q=react-share-via-teams-chat-extension) and see what the community is saying. |
| 165 | + |
| 166 | +If you encounter any issues while using this sample, [create a new issue](https://github.com/pnp/sp-dev-fx-extensions/issues/new?assignees=&labels=Needs%3A+Triage+%3Amag%3A%2Ctype%3Abug-suspected&template=bug-report.yml&sample=react-share-via-teams-chat-extension&authors=@Harminder_Sethi&title=react-share-via-teams-chat-extension%20-%20). |
| 167 | + |
| 168 | +For questions regarding this sample, [create a new question](https://github.com/pnp/sp-dev-fx-extensions/issues/new?assignees=&labels=Needs%3A+Triage+%3Amag%3A%2Ctype%3Aquestion&template=question.yml&sample=react-share-via-teams-chat-extension&authors=@Harminder_Sethi&title=react-share-via-teams-chat-extension%20-%20). |
| 169 | + |
| 170 | +Finally, if you have an idea for improvement, [make a suggestion](https://github.com/pnp/sp-dev-fx-extensions/issues/new?assignees=&labels=Needs%3A+Triage+%3Amag%3A%2Ctype%3Aenhancement&template=suggestion.yml&sample=react-share-via-teams-chat-extension&authors=@Harminder_Sethi&title=react-share-via-teams-chat-extension%20-%20). |
| 171 | + |
| 172 | +<img src="https://m365-visitor-stats.azurewebsites.net/sp-dev-fx-extensions/samples/react-share-via-teams-chat-extension" /> |
0 commit comments