Code Monkey home page Code Monkey logo

office-js-docs-reference's Introduction

Office JavaScript API Reference

Welcome to the Office JavaScript API Reference documentation repository. For the best experience, we recommend you view this content on the Microsoft Learn site.

Note: You can find the documentation source files for Office JavaScript API concepts, quick starts, tutorials, and how-to guides in the OfficeDev/office-js-docs-pr repository.

Give us your feedback

Your feedback is important to us.

  • To let us know about any questions or issues you find in the docs, submit an issue in this repository. Make sure you state the version + build number of the client you are using, and provide repro steps, console output, and error messages, as appropriate.

  • We also welcome your contributions to this documentation. To contribute, fork this repository, update the files as you deem necessary, and submit a pull request with your proposed changes. For details, see Contribute to this documentation.

    IMPORTANT: Do not modify files within the /docs/docs-ref-autogen folder of this repository. All of the files in that folder are autogenerated, so it is not possible to update them via pull request. To request a change to any of the files in the /docs/docs-ref-autogen folder, please submit an issue in this repository. You can read more about how the tooling in this repository here.

  • To submit a feature request for the Office.js API or platform, post your idea to the Microsoft 365 Developer Platform Tech Community, or if the feature request already exists there, add your vote for it.

Join the Microsoft 365 Developer Program

Join the Microsoft 365 Developer Program to get resources and information to help you build solutions for the Microsoft 365 platform, including recommendations tailored to your areas of interest.

You might also qualify for a free developer subscription that's renewable for 90 days and comes configured with sample data; for details, see the FAQ.

Microsoft Open Source Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct. For more information, see the Code of Conduct FAQ, or contact [email protected] with any additional questions or comments.

office-js-docs-reference's People

Contributors

aafvstam avatar alexjerabek avatar alison-mk avatar angryberryms avatar carlosgamez-nova avatar davidchesnut avatar dend avatar dependabot[bot] avatar elizabethsamuel-msft avatar herohua avatar jargil avatar jmazzotta avatar joelfmrodrigues avatar kbrandl avatar kenanlv avatar keyur32 avatar lauragra avatar learn-build-service-prod[bot] avatar linda-editor avatar lindalu-msft avatar mattgeim avatar mertsch avatar microsoft-github-policy-service[bot] avatar pgonzal avatar rick-kirkham avatar samantharamon avatar supernova-eng avatar v-pegao avatar yunair avatar zhiliangxu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

office-js-docs-reference's Issues

delete if found

I would appreciate if in the example of delete() you also showed the proper way to delete a sheet if i'm not sure it exists. Thanks!


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

RequestContext.trace is not properly documented

The OfficeExtension.Error object (for Word, Excel, and OneNote) has a traceMessages member, which is a string array. The Word error.md page shows an example where it creates these trace messages, by calling context.trace (short example: Word.run(function(context) { context.trace("Hello world"); })). However, reference/word/requestcontext.md contains no mention of the trace method. A search for the word "trace" reveals it to be mentioned only in the error.md pages for Word, Excel, and OneNote, and only the Word error.md page reveals how to use context.trace. I would expect this method to be documented on the requestcontext.md page also. In addition, if traceMessages is available in other applications (e.g. PowerPoint, Outlook) it should be documented on those pages as well.

Information for contentControl.get​Item(index) is incomplete / misleading

The explanation for getItem(index) is: "Gets a content control by its index in the collection." And the expected data type is "number". This implies the method returns the content control at the given position in the document (first, second, etc.) Using the method in this manner returns the error "ItemNotFound: We couldn’t find the item you requested. Check the OfficeExtension.Error.debugInfo for more information." On Stack Overflow Juan B. Labra states: "getItem() works with IDs". The ID value of a content control is of type String (in the COM APIs) and it's also not an "index" value. I lost a lot of time trying to get this to work. Plesae update the documentation.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

getSelectedRegExMatches() doesn't work in the Outlook 2013 desktop client

Office.context.mailbox.item.getSelectedRegExMatches() returns null in Outlook 2013 desktop experience while returning an expected array of one match in the web client.

Expected Behavior

Using contextual add-in, when I open the add-in in outlook 2013 desktop client, it should return the array of all the matched texts.

Current Behavior

Instead of returning the list of the matched texts, its retunring me null in Outlook 2013, though is working fine on Outlook 365 (web).

Steps to Reproduce, or Live Example

  1. Extension point in Manifest file:
<ExtensionPoint xsi:type="DetectedEntity">
              <Label resid="AddIn.Title" />
              <SourceLocation resid="AddIn.WebApp" />
              <Rule xsi:type="RuleCollection" Mode="And">
                <Rule xsi:type="ItemIs" ItemType="Message" />
                <Rule xsi:type="ItemHasRegularExpressionMatch" PropertyName="BodyAsPlaintext" RegExName="BodyFilter" RegExValue="Click here to (Play|Poll|View)" Highlight="all" />
              </Rule>
</ExtensionPoint>
  1. Debugged the issue with Outlook 2013 desktop client. The value returning was null, instead of the matching tests array

Context

By opening the add-in with the text match, I am trying to load up a web page.

Your Environment

  • Platform [PC desktop, Mac, iOS, Office Online]: PC desktop
  • Host [Excel, Word, PowerPoint, etc.]: Outlook 2013
  • Office version number: 2013
  • Operating System: Windows

Example code - instruction not required

[Enter feedback here]


Document Details

Retrieving the page is not required as it's not being used on the sample code

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Excel.Range.values has an undocumented limit

There seems to be an undocumented limit to the size of the array which can be assigned to Excel.Range.values. To demonstrate:

await Excel.run(async (context) => {
    context.application.suspendApiCalculationUntilNextSync();
    const worksheet = context.workbook.worksheets.getActiveWorksheet();
    const newValues = (new Array(2000)).fill((new Array(10)).fill('0'));
    worksheet.getRangeByIndexes(0, 0, 2000, 10).values = newValues;
    await context.sync();
});

Running this in an add-in in Excel Online (Build ID 16.0.11512.37951) will cause the API to throw RichApi.Error: An internal error has occurred. This code successfully sets the specified cell values if I change the number of rows to less than 500. I understand that I can assign a non-array string to set identical values to all cells in that range; my task involves setting different values to a range.

I am not seeing anything about limits in the API documentation or the Excel add-in concepts pages. I would appreciate it if Excel.Range.values contained info on: a way to find out the size limits for new values, and any differences to this limit for various platforms (desktop and browsers). Thank you.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Double-Click Event Tracking How-to vs. WorksheetSingleClickedEventArgs

How would one determine if a cell has been double-clicked?
Also, How would one be able to detect a right-click event?

These seems to be missing from the API for Excel.

Is there a coding solution for the above handling of user actions that you could share?


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

missing a semicolon in the example

missing a semicolon after this line var controlBackgroundColor = Office.context.officeTheme.controlBackgroundColor in the example


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Arguments for add(content, cellAddress, contentType)

The argument cellAddress can be an excel range. Maybe it could be nice to specify that the range object must be a singular cell. Cheers


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Error code table help developers to write conditional statement

Hi Office.js team,
This interface is really clear and I can understand definition, but let me share feedback for better developer experience. If the document provide error code table, developers can consider and write better conditional statements. Currently we don't have any info about what number is passed through code property.

Fortunately and unfortunately, I've never seen error in my environment and hard to see what happen and to decide conditional statement. Would you please consider to provide error table like Microsoft Graph document?
https://docs.microsoft.com/en-us/graph/errors


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Property description typo

Property description for controlForegroundColor reads "Gets the Office theme body control color as a hexadecimal color triplet (e.g. "FFA500")" where it should read "...control foreground color..." striking "body."


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

The property title isn't read only

The documentation on this page for the title property indicates it is read only. It isn't.

This code runs fine chart.axes.valueAxis.title.text = "Title"; //Excel API 1.1

It would seem useless if it were really read only.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

getAsync() have a wrong callback datatype

GetAsync() returns a string, not the object it was called on.

callback?: (result: AsyncResult&lt;Office.Body&gt;)
Should be:
``callback?: (result: AsyncResult<string>)````
for all getAsync() methods


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Overview folder needs a toc.yml file

Currently there's no toc.yml file in the overview folder, which results in there being no TOC, breadcrumbs, or "PDF download" link displayed when the Overview page is loaded without the view parameter in the URL.

image

We should add a toc.yml file to the overview folder (just as there's a toc.yml file in every other docs-ref-autogen subfolder). Maybe just have it contain a link to the Preview or otherwise newest (where there's no Preview) docs page for each host?

image

Adding this toc.yml file will eliminate a few errors in the CATS report. Not urgent, but we should do it when we can find time.

Is the description of the color property wrong

Not the color of the border line.
It's the background color.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

removeHandlerAsync(eventType, handler, [options], [callback]) is not working.

Hello,

I was trying to use below code.

Office.context.mailbox.removeHandlerAsync(Office.EventType.ItemChanged, loadNewItem, function (result) {
      if (result.status === Office.AsyncResultStatus.Failed) {
        console.log("event failed");
      }
    });
function loadNewItem(eventArgs) {
  // Load the properties of the newly selected item
  console.log("event changed");
}

It is throwing me parameter mismatch error.

outlook-web-16.01.js:9 Uncaught Error: Sys.ParameterCountException: multiple optional functions in parameter list
at Function.Error.create (MicrosoftAjax.js:5)
at Function.Error.parameterCount (MicrosoftAjax.js:5)
at c (outlook-web-16.01.js:9)
at OSF.DDA.AsyncMethodCall.verifyAndExtractCall (outlook-web-16.01.js:9)
at f.(lab5228.lab.pega.com/prweb/OutlookAddIn/aDksxW2FqLyskV_TGzmXXSRT2XjlmHkP*/anonymous function) (https://appsforoffice.microsoft.com/lib/1.1/hosted/outlook-web-16.01.js:9:73976)
at window.OSF.DDA.OutlookAppOm.u.DDA.OutlookAppOm.value [as removeHandlerAsync] (outlook-web-16.01.js:9)
at revokeAsyncHandler (outlookaddin_1955471633.js!sfaoutlookaddin_13410501646.js!crm_ui_harnessactions_13285258855.js!!.js:1342)
at :1:1

Can some one let me know whether removeHandlerAsync usage is proper or not. Is it documented wrong in Office API doc?

diagnostics.hostname values are incorrect

The hostname field states that:
A string that can be one of the following values: Outlook, Mac Outlook, OutlookIOS, or OutlookWebApp.

This is not the case.

  • When running Outlook on a Mac, the value returned is Outlook, not Mac Outlook. This is has been the case since 1.0
  • Additionally, it can return OutlookAndroid.

I propose you change to:
A string that can be one of the following values: Outlook, OutlookAndroid, OutlookIOS, or OutlookWebApp.

This was already brought up in issue #462 (resolved via #467) but I cannot see the changes on this page, which looks to be a new URL compared to when I added the original issues.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Image filetype option

Would love to see an option to export individual or more PowerPoint slides to images (for example base64 or png).


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Should "Supported hosts, by platform" be removed?

At the bottom on each shared api page is that grid that shows "Supported hosts, by platform". This has been there from the beginning but I'm not sure it makes a lot of sense any longer:

  • It is often out of date (most recently, issue #1089).
  • The Add-in Availability page provides the a superior view of the same data.
  • The grid of platforms is comically out of date, ignoring Office 2016 for Mac and continuing to reference OWA for Devices .

It seems like this boilerplate could simply be replaced with a link to the Add-in Availability page. For the handful of methods that have an edge constraints (i.e. support on platform x is slightly different from the other platforms), this could be continue to live within the overall "Support details" section.

insertParagraph can not currently take the values of "Start" | "End" | "Replace" yet they are documented in the intellisense

this is a tooling bug and may result from additional parameters being added without these parameters being supported. Versioning must be done at the function level since there can be multiple versions of the same function.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

ContentControl.insertParagraph and ContentControl.placeholderText throws exception in Word Online

I am developing a Word add-in that utilizes ContentControl.insertParagraph and ContentControl.placeholderText. According to the documentation, these methods are provided by WordApi requirement set 1.1, which is supported in Office Online.

When I run the add-in in Word 2016 desktop client, everything works fine,
but when I run it in the Word Online , it fails with the following exceptions:

code:"NotAllowed"
errorLocation:"ContentControl.insertParagraph"
message:"The action isn’t supported in Word Online. Check the OfficeExtension.Error.debugInfo for more information."

code:"NotAllowed"
errorLocation:"ContentControl.placeholderText"
message:"The action isn’t supported in Word Online. Check the OfficeExtension.Error.debugInfo for more information."

my script code is:

$(function () {

    Office.initialize = function (reason) {

        // Only support Word 2016 or newer for now
        if (!Office.context.requirements.isSetSupported('WordApi', 1.1)) {
            return;
        }

        Word.run(function (context) {
	      // Load content controls in test document
	      var contentControls = context.document.contentControls;
              context.load(contentControls, 'id, items');
              return context.sync()
                   .then(function () {
                        //Update existing content control.
                        var control = contentControls.items[0];
                        //control.placeholderText = "Inserting paragraph..";
                        control.insertParagraph('Hello, ', Word.InsertLocation.start);
                        return context.sync()
                            .then(function () {
                                console.log('Success!');
                            })
                            .catch(function (error) {
                                console.log('Error: ' + JSON.stringify(error));
                                if (error instanceof OfficeExtension.Error) {
                                    console.log('Debug info: ' + JSON.stringify(error.debugInfo));
                                }
                            });
                    })
                    .catch(function (error) {
                        //Create new content control.
                        var range = context.document.getSelection();
                        var theRange = range.insertText(" ", "End");
                        var contentControl;
                        return context.sync()
			      .then(function () {
				     contentControl = theRange.insertContentControl();
				     //contentControl.placeholderText = "Inserting text..";
				     contentControl.insertParagraph('World..! ', Word.InsertLocation.start);
				     contentControl.load("id");
				     return context.sync();
		              })
                              .catch(function (error) {
                                    console.log('Error: ' + JSON.stringify(error));
                                    if (error instanceof OfficeExtension.Error) {
                                    console.log('Debug info: ' + JSON.stringify(error.debugInfo));
                                    }
                              });
                    });
          })
     };
});

I have commented the statement :-

"control.placeholderText = 'Inserting paragraph..'"

, becuase same exception is thrown for this statement as well.

Any input you could provide would be most appreciated! Thank you!

Missing information about using Visio JS API with "any external web page"

Hi,

At the end of the Visio JavaScript APIs announcement it states:

Custom solutions that you implement via the Visio JavaScript APIs will work against embedded Visio diagrams in SharePoint Online or any external web page.

However all the documentation I've found is only about embedding Visio diagrams into a SharePoint website.

So :

  • Was the functionality of working with any external web page never implemented ?
    or
  • The corresponding information is missing ?
    or
  • I've misunderstood the blog post and "any external web page" refers to some SharePoint external web page or something (I don't know SharePoint well) ?

Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

AttachHandler error

"OSF is not defined"

Fix:
Visio.run(function(ctx)...
should be
Visio.run(session, function(ctx)...

as per this issue report OfficeDev/office-js-docs#1375

Please make the documentation more verbose, for example where to call AddHandler()


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

CustomTab never appear

Hi
why my customtab never appear in my mac outlook 2016 client?

<ExtensionPoint xsi:type="MessageReadCommandSurface">
						<CustomTab id="myTab">
							<Group id="QuantrTab">
								<Label resid="customTabLabel" />
								<Control xsi:type="Button" id="msgReadOpenPaneButton">
									<Label resid="paneReadButtonLabel" />
									<Supertip>
										<Title resid="paneReadSuperTipTitle" />
										<Description resid="paneReadSuperTipDescription" />
									</Supertip>
									<Icon>
										<bt:Image size="16" resid="icon16" />
										<bt:Image size="32" resid="icon32" />
										<bt:Image size="80" resid="icon80" />
									</Icon>
									<Action xsi:type="ShowTaskpane">
										<SourceLocation resid="messageReadTaskPaneUrl" />
									</Action>
								</Control>
								<!-- Go to http://aka.ms/ButtonCommands to learn how to add more Controls: ExecuteFunction and Menu -->
							</Group>
							<Label resid="customTabLabel2" />
						</CustomTab>
					</ExtensionPoint>

thanks
Peter

Add-in activation rule

The Clients section describes the requirement set for the platform.

I have an Exchange 2016 On-Premises installation, and I set the Requirements element to 1.5.
Regarding the documentation my addin should not be activated in the Exchange 2016 OWA.
If I use the runtime check of the supported version, it says the 1.5 version supported.

Then I tried to use the REST API from my add-in like decribed here but it didn't worked (I got 405 Method Not Allowed).

But I cannot able to use the Exchange Server REST API because it is only supported with hybrid Exchange installation.

Why the add-in activated if I cannot use it properly?
Or at least the documentation should be extended to explain this exception.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Office.context.mailbox.addHandlerAsync usage?

I wish for my add-in to be notified when a message being composed in the outlook web app changes (recipients, message body, subject etc.).

I am unable to get events from Office.context.mailbox.addHandlerAsync. Am I using it correctly?

None of these seem to work.

Office.context.mailbox.addHandlerAsync(Office.EventType.ItemChanged, function(result) {
	console.log(result);
});
Office.context.mailbox.addHandlerAsync(Office.EventType.ItemChanged, function(result) {
	console.log(result);
}, { asyncContext: true },function(result) {
	console.log(result);
});
Office.context.mailbox.addHandlerAsync(Office.EventType.ItemChanged,
	function (eventArgs) {
		console.log(eventArgs);
	},
	function (result) {
		console.log(result);
	}
);

Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Incorrect parameters in addOverlay sample

There is an error in the sample.
Instead of
var overlayId=shape.view.addOverlay("Image", "Visio Online", "Center", "Center", 50, 50);
Tere must be

var overlayId=shape.view.addOverlay("Image", "Visio Online", "Center", "Middle",50,50);


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Mistaken code comments in BasicDataValidation and DateTimeDataValidation

Articles:
https://github.com/OfficeDev/office-js-docs/blob/ExcelJs_OpenSpec/reference/excel/basicdatavalidation.md

and

https://github.com/OfficeDev/office-js-docs/blob/ExcelJs_OpenSpec/reference/excel/datetimedatavalidation.md

Issue:
Both of these articles have misleading descriptions for the formula1 and formula2 properties. The following would be correct for BasicDataValidation:

  • formula1: Specifies the right-hand operand when the operator property is set to a binary operator such as GreaterThan. (The left-hand operand is the value the user tries to enter in the cell.) With the ternary operators Between and NotBetween, specifies the lower bound operand. Values can be numbers or Excel formulas (in quotation marks) such as "=A1" or "=SUM(A1,B2)". For example, setting formula1 to 10 and operator to GreaterThan means that valid data for the range must be greater than 10.

  • formula2: With the ternary operators Between and NotBetween, specifies the upper bound operand. Is not used with the binary operators, such as GreaterThan. Values can be numbers or Excel formulas (in quotation marks) such as "=A1" or "=SUM(A1,B2)".

For DateTimeDataValidation object, replace "numbers" in the two preceding bullets with "stringified ISO8606 datetimes (such as "2018-05-01-13-25")"

Mismatch in Title and description of page

Is this for the pivot table collection or for the fields collection for a pivot table? The title and description don't match.Is this for the pivot table collection or for the fields collection for a pivot table? The title and description don't match.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

diagnostics.hostname values are incorrect

The hostname field states that:
A string that can be one of the following values: Outlook, Mac Outlook, OutlookIOS, or OutlookWebApp.

This is not the case.

  • When running Outlook on a Mac, the value returned is Outlook, not Mac Outlook. This is has been the case since 1.0
  • Additionally, it can return OutlookAndroid.

I propose you change to:
A string that can be one of the following values: Outlook, OutlookAndroid, OutlookIOS, or OutlookWebApp.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Need more details of Office files

Hi Team,

For Cloud files (OD/SP) Office.FileProperties provides an URL in below format.
https://<tenant>.sharepoint.com/{sitepath}/{folder path}/filename.extension

In my scenario, I need complete drive item details on file which Add-In is running for cloud file scenario. Is there any way I can convert this file path to derive item id or drive item itself by calling some Microsoft Graph APIs or is there any js api which could do that for me.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Requirement set for Dialog API is incorrect.

The documentation says the requirement set for Dialog API is "Dialog", whereas it should be "DialogAPI".


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Wrong Add-in Types

PhoneSettings only applies to Mail Add-ins so can you please correct the documentation above

"Add-in type: Content, Task pane, Mail"


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Display New Message Form is blocked by browser

Hello,

the function Office.context.mailbox.displayNewMessageForm is blocked by browsers because it opens a new window. Allow Popups is a workaround.

Is there a way around it. Maybe an email compose window on the main page for example? Or maybe a functionality to detect whether popup popups are blocked.

In Outlook, how can I switch view from a task pane add-in to a module extension?

We're working with task pane add-ins and module extension add-ins in Outlook.

We need to be able to display a button in a task pane, that changes Outlook's view to a page in our module extension when clicked, passing information from the task pane's context to it.

Is this possible, and if so, how?


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

diagnostics.hostname values are incorrect

The hostname field states that:
A string that can be one of the following values: Outlook, Mac Outlook, OutlookIOS, or OutlookWebApp.

This is not the case.

  • When running Outlook on a Mac, the value returned is Outlook, not Mac Outlook. This is has been the case since 1.0
  • Additionally, it can return OutlookAndroid.

I propose you change to:
A string that can be one of the following values: Outlook, OutlookAndroid, OutlookIOS, or OutlookWebApp.

This was already brought up in issue #461 (resolved via #467) but I cannot see the changes on this page, which looks to be a new URL compared to when I added the original issues.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

WorksheetProtectionData

worksheet protection is not working in officejs Javascript library i'm using.
code:
let password = await passwordHandler();
passwordHelper(password);
await Excel.run(async (context) => {
let activeSheet = context.workbook.worksheets.getActiveWorksheet();
activeSheet.load("protection/protected");

await context.sync();

if (!activeSheet.protection.protected) {
    activeSheet.protection.protect(null, password);
}

});
throwing internal server error using with side loaded web adding.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

CoercionType.Matrix will not bypass "calculated columns" feature as suggested by the docs

Article:
Document.setSelectedDataAsync method

Issue:
Following text does not reflect the actual behavior of the API/Excel

NOTE: In Excel, if you specify formulas in the TableData object you pass for the data parameter, you might not get the results you expect due to the "calculated columns" feature of Excel, which automatically duplicates formulas within a column. To work around this when you want to write data that contains formulas to a selected table, try specifying the data as an array of arrays (instead of a TableData object), and specify the coercionType as Microsoft.Office.Matrix or "matrix".

This doesn't actually work: Calculated Columns feature applies when matrix or table coercionTypes are used. Only way to workaround this seems to be to write the cells individually with "text" coercionType.

hostname values are incorrect

The hostname field states that:
A string that can be one of the following values: Outlook, Mac Outlook, OutlookIOS, or OutlookWebApp.

This is not the case.

  • When running Outlook on a Mac, the value returned is Outlook, not Mac Outlook. This is has been the case since 1.0
  • Additionally, it can return OutlookAndroid.

I propose you change to:
A string that can be one of the following values: Outlook, OutlookAndroid, OutlookIOS, or OutlookWebApp.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

How to handle "computed columns" with addRowsAsync

Hi, I'm using the ExcelJs API with addRowsAsync() and deleteAllDataValuesAsync(). (reference)

If the user creates some "computed columns", which enlarge the size of the table (e.g.: a new column with the value of the first column + 1), when I want add new data to the table, how should I handle the "computed" column/s?

      let excelTable = currentWorksheet.tables.getItemOrNullObject(tableName)
      excelTable.rows.load("values")
      excelTable.columns.load("values")

      return context.sync().then(() => {
        if (excelTable.isNullObject) {
          excelTable = currentWorksheet.tables.add(tableRange, true)
          excelTable.name = tableName
          excelTable.getHeaderRowRange().values = [excelHeaders]

          return context.sync().then(() => {
            Office.context.document.bindings.addFromNamedItemAsync(
              tableName,
              Office.BindingType.Table,
              { id: tableName },
              function(result) {
                if (result.status === Office.AsyncResultStatus.Succeeded) {
                  Office.context.document.bindings.getByIdAsync(
                    tableName,
                    null,
                    (asyncResult: any) => {
                      var binding = asyncResult.value
                      binding.addRowsAsync(_excelData)
                    }
                  )
                } else {
                  Debug.error("Error:", result.error.message)
                }
              }
            )
          })
        } else {
          const tableRows = excelTable.rows.items.length
          const tableColumns = excelTable.columns.items.length
          const dataRows = _excelData.length
          const dataColumns = _excelData[0].length

          Office.context.document.bindings.getByIdAsync(
            tableName,
            null,
            (asyncResult: any) => {
              var binding = asyncResult.value
              binding.deleteAllDataValuesAsync()
              binding.addRowsAsync(_excelData)
            }
          )
        }

        excelTable.getRange().format.autofitColumns()
        excelTable.getRange().format.autofitRows()

        return context.sync()
      })

Using Excel for Windows, the new rows aren't added to the table.
Differenly happens if I use Excel Online: the rows are added and the computed column is correctly left "untouched".

Is it a bug of the API?
Can you help me?

Thanks in advance,
Andrea


Dettagli del documento

Non modificare questa sezione. È necessaria per i collegamenti relativi ai problemi tra docs.microsoft.com ➟ GitHub.

Error in code samples

The code samples for the find and findOrNullObject methods have errors. The 2nd parameter just repeats the names of the three properties instead of assigning actually possible values. The line should look like this:
const foundRange = searchRange.findOrNullObject($("#searchText").text(), {
completeMatch: false,
matchCase: false,
searchDirection: forward});


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Office.context.mailbox.item.location object not recognized correctly

Resource/room selected with Office.context.mailbox.item.location.setAsync is being treated differently of Outlook web and Microsoft Office Outlook selection. Using this code a simple text is being written at Office.context.mailbox.item.location, without references to resource (room) created in Admin Center 365. The outcome is that we can't see the scheduling of this resource/room. See: OfficeDev/office-js#453


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

issue with unprotect excel file protected with password using officejs javascript(web addin).

await Excel.run(async function(context) {

const sheet = context.workbook.worksheets.getActiveWorksheet();
// const workBook = context.workbook.
console.log(sheet.protection);
sheet.protection.unprotect("abc")
const range = sheet.getUsedRange();
range.load("values");
range.load("address");
return context.sync().then(function () {
  console.log(range.address);
})

}).catch(function(error) {

      console.log("Error: " + error);

});

Error
image

Link to doc for return types

Hi there, it would be awesome if this page had links to the documentation for the return types such as the Excel.WorksheetSingleClickedEventArgs type.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Is "complete" defined somewhere?

In just reading this page, it's not clear to what qualifies as a "complete" or "partial" match. e.g., Does "complete" mean that the search string must match the entire cell contents? Or is it more akin to a "whole word" requirement, in which case it would be helpful to know which characters constitute word components vs. word separators.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Not enough detail

I would love to use the JavaScript API for Office but there just isn't enough detail in these docs. I have to do too much guessing and hacking. I've used a lot of APIs. Microsoft has some good API documentation but this isn't it. Python.org has some excellent documentation. cppreference.com is some excellent documentation. The old Windows APIs are very well documented. JavaScript API for Office, not so much. The explanation of the property or method should tell me more than I could guess from the property name. Some of your tutorials are okay we just need more.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.