Integrate & display files in custom app

Copper Contributor

What is the best way to integrate files within Teams in a custom app? Is there a framework/widget for:

  1. Selecting a file within Team
  2. Display a file within your App (e.g. PPT, PDF, Excel, Word)
  3. Controlling the current slide/page, if you want all users to see the same thing?

Thanks

5 Replies

@e_morling - Yes you can display the file with in the teams. You can provide the file url to the tab and open the file with in the tab Or to the adaptive card button, but you need to encode the file url please check the below code to encode the URL.

new AdaptiveOpenUrlAction() {​​ Title = actionText, Url = new Uri(GetFileViewerURL("Your File URL here", "pptx")) }​​;
private string GetFileViewerURL(string actionData_URL, string prefix)
        {​​
            return $"https://teams.microsoft.com/_#/{​​prefix}​​/viewer/teams/" + actionData_URL?.Replace("/", "~2F");
        }​​

@Nikitha-MSFT Thank you, do you have an example with Javascript?

@e_morling - Currently we don't have example in javascript

@Nikitha-MSFT But it is possible to do in Javascript? With the example you provided in Java, is the file "on top" of the application? So that once the user closes the file the app is still open behind it? 

@e_morling - The code which I provided for the file not application. When you close it will close the file not application. It is by design.