Share via

Webextensions folder not getting included in base64 format of currently opened document.

Rajat Bharadwaj 5 Reputation points
2026-02-27T06:15:38.2333333+00:00

Hi Team,

We are facing issue where as part of requirement we need to convert existing document to base64 that needs to be passed as parameter to our backend API.

We are storing some metadata related to our usecase using Office settings API which is stored in webextension1.xml. (word > webextensions > webextension1.xml )

 Office.context.document.settings.set(key, value);

As part of our requirement we need webextensions folder to be part of base64 which is being created using below Ofice JS API.

We tried below approach using "getFileAsync" but its not helping.

Office.context.document.getFileAsync(
Office.FileType.Compressed )

Can you please help how can we include webextensions folder in base64? Please refer the screenshot

Screenshot 2026-02-27 at 11.44.32 AM.png

Microsoft 365 and Office | Development | Office JavaScript API
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Teddie-D 12,845 Reputation points Microsoft External Staff Moderator
    2026-02-27T07:43:42.8566667+00:00

    Hi @Rajat Bharadwaj 

    Thank you for posting your question in the Microsoft Q&A forum. 

    When using Office.context.document.getFileAsync(Office.FileType.Compressed, …) in Word, the returned DOCX package may sometimes be missing the word/webextensions folder. As a result, any add‑in settings stored via Office.context.document.settings which are persisted into webextension1.xml won’t appear in the Base64 output. This behavior has been reported in Custom settings are not present in files retrieved using getFileAsync() · Issue #6434 · OfficeDev/o… 

    Currently, there isn’t an Office.js API option to force inclusion of the webextensions folder when the host application omits it. If you depend on those settings, here are some practical workarounds: 

    1.Trigger a real document save before export 

    -After a manual save (File > Save), the settings are correctly included in the package. 

    -The issue report also notes it does not appear in Office on the web, so Word for web may work normally. 

    2.Send metadata separately from the document 

    If your backend requires both the document and metadata, consider sending: 

    -Base64 of the document from getFileAsync. 

    -A separate JSON payload containing your metadata instead of embedding it in settings. 

    This avoids dependency on Word’s packaging internals, which can change across versions. 

    Reference: Persist add-in state and settings - Office Add-ins | Microsoft Learn

    3.Use alternative storage inside the document 

    Instead of relying on webextensions, metadata can be stored in: 

    -Custom document properties 

    -Custom XML parts 

    -Hidden content controls 

    These approaches store data in standard OOXML document parts, which are included in the document package generated by Word.

    Reference: Office.Document interface - Office Add-ins | Microsoft Learn

    I hope this clarifies the behavior and available options.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".  

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.

  2. Q&A Assist
    2026-02-27T06:15:50.36+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    Including the webextensions folder (and thus webextension1.xml that stores Office settings) in the base64 produced by Office.js is not supported by the documented APIs in the provided context.

    The relevant Word/Office.js objects in the context (such as Word.WebSettings) only expose limited properties and methods related to saving as a webpage (organizeInFolder, folderSuffix, useDefaultFolderSuffix) and do not provide any mechanism to:

    • Access or serialize the webextensions part of the document package, or
    • Control what Office.context.document.getFileAsync(Office.FileType.Compressed) includes in the returned file.

    Office.context.document.settings is designed as a key/value store for add-ins and is persisted in the document’s web extension part, but the context does not document any API to explicitly include or extract that webextensions folder when exporting the document via Office.js.

    Given only the documented APIs in the context, there is no supported way shown to force getFileAsync (or any other Office.js API here) to include the webextensions folder in the base64 payload.


    References:

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.