Microsoft Teams provides the flexibility to change the default storage from OneDrive and SharePoint to a preferred third-party cloud storage provider app. When a file is drag-dropped into the message compose area of a Teams chat or channel, you can allow the file to be stored in a third-party cloud storage using Microsoft Teams JavaScript client library (TeamsJS).
Prerequisites
For Teams app to support third-party cloud storage for drag-dropped files:
The app manifest (previously called Teams app manifest) must be configured with the app ID of the third-party storage app. Search for the property named defaultFilesUploadAppId and configure the app ID.
Note
Use plain string only and do not use inverted commas.
The app manifest must have the first action as Upload. This action automatically opens the app in upload mode when files are drag-dropped into the message compose area.
Following code sample shows the first action added as Upload under composeExtensions:
If you want your Teams app to have a third-party storage of your preference, you must use the getDragAndDropFiles API of thirdPartyCloudStorage in TeamsJS SDK. This API enables uploading files from the message compose area of a Teams chat or channel to third-party storage app.
Note
The thirdPartyCloudStorage API is used only in scenarios when the files are drag-dropped. It's not used when the files are added using the plus icon in the message compose toolbar.
To implement third-party cloud storage for the drag-dropped files in Teams, follow these steps:
Ensure the property defaultFilesUploadAppId is configured with the third-party storage app ID and the first action is set as Upload in the app manifest.
Create the unique ID using the following parameters from the application context:
const uniqueIdForChats = replyToId + id (that is, threadId).
All the above values are present in the application context. If "commandContext" = "thirdParty", it helps third-party cloud storage app to determine that the app is opened programmatically. If replyToId isn't present in the context, then the unique ID is ""+threadId.
The following image shows the sample of the application context with the values to create the unique ID highlighted:
Use the getDragAndDropFiles API from the thirdPartyCloudStorage in TeamsJS SDK for the third-party storage app to fetch the drag-dropped files.
A callback function is implemented to receive and handle the files.
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.
Platform Docs feedback
Platform Docs is an open source project. Select a link to provide feedback:
Demonstrate skills to plan, deploy, configure, and manage Microsoft Teams to focus on efficient and effective collaboration and communication in a Microsoft 365 environment.
Learn best practices or considerations for integrating existing web apps with Teams, API requirements, authentication, and deep linking of your app with Teams.
If you're working on a Line of Business application, a Software as a Service application, or an entirely different category of application, you can bring your apps directly into Teams and provide a more productive way for users to get work done. In this session Burke Holland and Dan Wahlin will demonstrate key benefits your users will experience by integrating Web apps into Teams such as Single Sign-On, Teams tab access, interactive bots (with AI capabilities), mobile access to
Learn about app templates for Teams that includes Microsoft 365 Learning Pathways and Company Communicator with deployment and installation instructions.
Learn to integrate device capabilities. Power platform to create Power apps, Power Virtual Agents, Virtual Assistant, app templates, Shift connectors, Moodle LMS.
Did you know you can take an existing web app experience and adapt it for Teams? Barnam Bora and Waldek Mastykarz will show you how you can display rich interactive web content within Microsoft Teams clients. For more information about integrating web apps with Teams, check out our Docs - Integrate web apps with Teamshttps://github.com/microsoft/DevAppsForTeams