Teams Deeplink - Open word file from Teams SharePoint Files in embedded word - sharepoint

I am developing a custom Teams tab. In the tab i am rendering my React web app with the #microsoft/teams-js package. I want to open an existing word file in the Teams SharePoint in the embedded word app in Teams. How can I create such a deep link (https://learn.microsoft.com/en-us/microsoftteams/platform/concepts/build-and-test/deep-link-application?tabs=teamsjs-v2) to open my word file in the embedded word?
I tried to open the direct web link to the SharePoint file, but unfortunately this only opens the file in the word online version in the browser and not in the embedded word in teams:
microsoftTeams.app.openLink(sharePointFileUrl);
As well have I set the "file open preference" setting in Teams to "Teams", which did not work either.

Related

Open sharepoint word file in users desktop app by clicking on direct hyperlink to word document

In our web application, we have direct link to word document in SharePoint site. So when user clicks on the hyperlink, I would like to open that in users local desktop word application. But I am unable to achieve it.
I have tried other work arounds like, when user clicks on the document in the sharepoint site, able to open in word desktop app. But it is still two clicks for user to reach the word desktop app.
Is there any way if we pass any parameters in the url saying open in local desktop app?
Thanks
Below is the code to open the desktop app directly in users machine. It will ask for confirmation though before opening the document in local.
ms-word:ofe|u|https://xxx.sharepoint.com/sites/xxx/xxx/xx.docx

Open a file directly in Teams from a tab

I have deployed a SharePoint webpart (SharePoint Framework) to Microsoft Teams. In this web part, I have a list of files that I want to open directly in Teams.
I have tried to get the link from the "Files" tab (https://teams.microsoft.com/l/file/7FFA7D9D-CBF1-4679-9C80-76446AE11ABD?tenantId=0f48c6f4-52a5-4553-b476-4ee2ee0aecca&fileType=docx&objectUrl=https%3A%2F%2Fxyz.sharepoint.com%2Fsites%2FAZRTZ%2FShared%20Documents%2FGeneral%2FArchitecture%2FTest.docx&baseUrl=https%3A%2F%2Fxyz.sharepoint.com%2Fsites%2FAZRTZ&serviceName=teams&threadId=19:0d1f6f397c51421189e791a9ab436a48#thread.skype&groupId=98edc5a8-02ac-4f58-8638-ea88ac6aaa4d) and put it in the href="" of the link. It does not work, it opens the file in the browser.
I also tried to put the direct link in the href (https://xyz.sharepoint.com/sites/AZRTZ/Shared Documents/General/Architecture/Test.docx). It downloads a copy of the file in the browser.
I want to open the file directly into Teams, the same way the files are opened if the user goes to the "Files" tab (eg. if the user opens a .doc file, Word Online in Teams must open, if the user opens an image, a previsualisation in Teams must be opened, ...)
Succeed with a shorter version of the Deep Link syntax myself, in a message card from an incoming webhook connector, provided I used the OpenUri action syntax and not a plain markdown link:
https://teams.microsoft.com/l/file/?fileType=<extension>&objectUrl=<absoluteUrl>
this was linking to Sharepoint files.
Using the Deep link I managed to open the file directly in Teams. I had to format the URL :
https://teams.microsoft.com/l/file/{file-id}
?tenantId={tenant-id}
&fileType={file-type (jpg, xlsx, docx, ...)}
&objectUrl={file-encoded-link (SharePoint link, aboslute URL)}

How to Read a word document in asp.net in mvc

can any one help me to find out the solution to show/Read the word
documents in asp.net mvc any example or any suitable links. searched a lot on internet for suitable
article but did not find any thing helpful. i have implemented the
download functionality of the document. but can not able to read or
preview the documents.
You could use the Office Web Viewer provided as a service from Microsoft .
What is the Office Web Viewer?
It’s a service that creates Office Web Viewer links. Office Web Viewer links open Word, PowerPoint or Excel files in the browser that would otherwise be downloaded. You can easily turn a download link into an Office Web Viewer link to use in your website or blog (e.g., recipes, photo slide show, a menu, or a budget template).
Office Web Viewer: View Office documents in a browser
Some benefits of the Office Web Viewer include:
You don’t need to convert Office files for the web (e.g., PDF, HTML).
Anyone can view Office files from your website or blog, even if they
don’t have Office.
It keeps eyes on your website or blog, because readers don’t need to
download the file and they stay in the browser.
One link will work for computers, tablets, and mobile phones.
To manipulate .docx files (as well as .xlsx, .pptx, etc.) you would use Open XML SDK (also available as installer from Microsoft download centre).
The PowerTools for Open XML, which greatly simplifies working with Open XML SDK, contains functionality for
High-fidelity conversion of DOCX to HTML/CSS using HtmlConverter.cs
I've only used this SDK and Powertools to manipulate Word documents, so could not say much about conversion to HTML/CSS. But this could be one of your options for previewing Word documents, although it is a complicated way of solving your problem.
Try the MVC viewer in Gnostice XtremeDocumentStudio .NET.
ASP.NET MVC document viewer using ASPX and Razor engines.
DISCLAIMER: I work for this company.

Mimic Sharepoint edit Office file download

When you browse a list of files in Sharepoint using IE and attempt to download the file, you get the option of opening it in read-only or edit mode. When you open the document, Office knows that the file exists in Sharepoint so when you save, it is updated in Sharepoint without the user having to re-upload the file.
I'd like to have this same functionality in a custom website. I have access to Sharepoint and the file list so I'm using the same URL that Sharepoint is to download the file but there's something else happening in Sharepoint that tells the computer to not download a copy of the file but to open it in Office from the Sharepoint URL.
Does anyone know how to mimic this same behavior so I can get a file to be opened in Office from Sharepoint to it can save directly back to Sharepoint?
The special thing about this, is the link:
It's not just http://example.com/document.docx . It's ms-word:ofe|u|http://example.com/document.docx .
Just add ms-word:ofe|u| in front of the link for letting the browser know to open the link with an other Application.
There are other strings for other links.
Open a OneNote-File with:
onenote:http://example.com/document.one
And Excel-Files with
ms-excel:ofv|u|http://example.com/document.xlsx
And just for fun a TeamSpeak Link:
ts3server://example.com
Create URL for MS Office 2010 (and higher) to:
open document in view mode:
ms-excel:ofv|u|http://server.com/path/filename.xlsx
open document in edit mode:
ms-excel:ofe|u|http://server.com/path/filename.xlsx
List of MS Office apps URL scheme names:
ms-word:
ms-powerpoint:
ms-excel:
ms-visio:
ms-access:
ms-project:
ms-publisher:
ms-spd:
ms-infopath:
MS has a good page with explanation:
MS Office Dev Center > Office URI Schemes

Integrate pdf excel word viewer on a website

I would like to integrate a viewer tool for viewing files in pdf, excel, word formats. I am developing a website that store manuals and I would like visitors to have an ability to view these manuals online instead of downloading. I found a tool named ViewerJS that can view PDF and Open Documents online. However the tool doesn't support Microsoft Office.
You should probably use the Google Drive API
https://developers.google.com/discovery/libraries & https://developers.google.com/picker/docs/

Resources