Share to Teams from personal app or tab
Share to Teams allows users to share the content from personal app or tab to other user or group or channel within Teams. Users can select Share to Teams to launch the Share to Teams experience in a pop-up window. The pop-up window allows users to add other user or group or channel to share the content.
The following image shows the Share to Teams pop-up window:
Enable Share to Teams button
Note
Ensure that you have Microsoft Teams JavaScript client library (@microsoft/teams-js@1.11.0-beta.7
or later) to enable Share to Teams for your personal app or tab.
To enable Share to Teams:
Create a personal app or tab with Teams Javascript client library.
Create a Share to Teams button.
On Share to Teams button, call
microsoftTeams.sharing.shareWebContent
with a content payload.
The following example explains how to create a content payload:
microsoftTeams.sharing.shareWebContent({
content: [
{
type: 'URL',
url: '<URL to be shared>',
message: 'Default message to be loaded in the compose box',
preview: true
}
]
});
The payload contains the following parameters:
Property name | Purpose |
---|---|
type |
The type must be URL |
url |
URL to be shared |
message |
Default message to be loaded in the compose box |
preview |
Set to true to enable URL preview |
The following image shows the Share to Teams option:
Share to Teams button can be hosted or embedded in an app running inside Teams. You can add Share to Teams button to the app created by using Teams JavaScript client library.
Note
Share to Teams isn't supported inside a modal dialog (referred as task modules in TeamsJS v1.x) or Stageview in Teams web client. You can't open a modal on top of another modal.
Response codes
The following table provides the response codes:
Response code | Description |
---|---|
100 | API not supported in the current platform. |
404 | The file specified wasn't found on the given location. |
500 | Internal error encountered while performing the required operation. |
501 | API isn't supported in current context. |
1000 | Permissions denied by user. |
2000 | Network issue. |
3000 | Underlying hardware doesn't support the capability. |
4000 | One or more arguments are invalid. |
5000 | User isn't authorized for this operation. |
6000 | Couldn't complete the operation due to insufficient resources. |
7000 | Platform throttled the request because of API was invoked too frequently. |
8000 | User aborted the operation. |
9000 | Platform code is old and doesn't implement this API. |
10000 | The return value is too large and has exceeded our size boundaries. |
End user Share to Teams experience
After you enable Share to Teams button on personal app or tab, you can share the content. To access, follow the steps:
Open a personal app or tab and select Share to Teams.
Add other user or group or channel to share the content.
Select Share.
Select View to reach the conversation where the link was shared.
Share to meeting from personal app
Teams enables you to share personal apps to meeting stage quickly using the Present now button. This button is available by default in all personal tab apps and doesn't require any developer implementation. Here are the two scenarios when you select Present now:
If there's an ongoing meeting, the personal app is shared on the meeting stage of the Teams desktop client.
If there's no ongoing meeting, a meet now instance is launched in a new window.
The content is presented in a view-only mode. The presenter can interact with the content while attendees have a view-only mode experience, enabling them to track the presenter's actions.