OfficeDev / office-js

A repo and NPM package for Office.js, corresponding to a copy of what gets published to the official "evergreen" Office.js CDN, at https://appsforoffice.microsoft.com/lib/1/hosted/office.js.
https://learn.microsoft.com/javascript/api/overview
Other
690 stars 95 forks source link

How do I open a document from a template in SharePoint through Word JavaScript in a task pane? #3550

Closed edgarmaus closed 1 year ago

edgarmaus commented 1 year ago

I am trying to open a SharePoint template as a document through a Word task pane using Word JavaScript. I am able to access the "webUrl" property of the file through the site's drive item collection. I need to convert this url into an object and convert it into a base64 string to pass to "context.application.createDocument(base64Document)" method. I am able to create the base64 string and open a document when using the HTMLInputElement "file" object. Searches refer to the "file" object as a type of Blob but this doesn't help in getting an equivalent object from the url. How do I correctly call SharePoint through the Graph API, get a drive item, and open the template as a file through JavaScript in the task pane.

ZYUN-MSFT commented 1 year ago

Hi @edgarmaus ,

Thanks for reaching us. In my understanding, what you are trying to do is Open a exist document through Word JS API.\ But unfortunatly, this feature is not supported by now.

We would like to suggest you go to https://techcommunity.microsoft.com/t5/microsoft-365-developer-platform/idb-p/Microsoft365DeveloperPlatform for asking a new feature. Feature requests on it are considered when we go through our planning process.

Thanks.

edgarmaus commented 1 year ago

Yun,

        Thanks for the quick response. I am trying to open a new document through a template stored in SharePoint. For example, selecting New in backstage allows me to pick a template on which to base a new document. I want to do the same thing in Word JavaScript with a SharePoint template.

Ed Maus Software Developer, BEC Legal Systemshttp://www.beclegal.com/ E @.**@.> O 513.948.1500 W beclegal.comhttp://beclegal.com/

@.***https://www.beclegal.com/bec-event/iltacon-2023/

BEC Legal Software Product Overviewhttps://www.beclegal.com/video/bec-legal-software-product-overview/

From: Yun Zhang @.> Sent: Monday, July 31, 2023 2:52 AM To: OfficeDev/office-js @.> Cc: Ed H. Maus @.>; Mention @.> Subject: Re: [OfficeDev/office-js] How do I open a document from a template in SharePoint through Word JavaScript in a task pane? (Issue #3550)

Hi @edgarmaushttps://github.com/edgarmaus ,

Thanks for reaching us. In my understanding, what you are trying to do is Open a exist document through Word JS API. But unfortunatly, this feature is not supported by now.

We would like to suggest you go to https://techcommunity.microsoft.com/t5/microsoft-365-developer-platform/idb-p/Microsoft365DeveloperPlatform for asking a new feature. Feature requests on it are considered when we go through our planning process.

Thanks.

— Reply to this email directly, view it on GitHubhttps://github.com/OfficeDev/office-js/issues/3550#issuecomment-1657773751, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A6NA4UKW2ZRGXQI7BOM4UDLXS5I2NANCNFSM6AAAAAA237VMPI. You are receiving this because you were mentioned.Message ID: @.**@.>>

This email has been scanned for email related threats and delivered safely by Mimecast. For more information please visit http://www.mimecast.com

ZYUN-MSFT commented 1 year ago

Hi @edgarmaus,

Thanks for the confirming. Word JS API doesn't support your scenario for now, please feel free to ask new feature at https://techcommunity.microsoft.com/t5/microsoft-365-developer-platform/idb-p/Microsoft365DeveloperPlatform.

Thanks for your support of Office Addins.

Refer to https://github.com/OfficeDev/office-js/issues/3512

ghost commented 1 year ago

This issue has been automatically marked as stale because it is marked as needing author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. Thank you for your interest in Office Add-ins!

microsoft-github-policy-service[bot] commented 1 year ago

This issue has been closed due to inactivity. Please comment if you still need assistance and we'll re-open the issue.