Enumerations
You can specify an enumerated value by using either its fully qualified enumeration name ( Office.CoercionType.Text) or its corresponding text value ( "text"). For example, the following method call uses enumeration names:
Office.context.document.getSelectedDataAsync(Office.CoercionType.Text, {valueFormat:Office.ValueFormat.Unformatted, filterType:Office.FilterType.All},
function (result) {
if (result.status === Office.AsyncResultStatus.Success)
var dataValue = result.value; // Get selected data.
write('Selected data is ' + dataValue);
else {
var err = result.error;
write(err.name + ": " + err.message);
}
});
// Function that writes to a div with id='message' on the page.
function write(message){
document.getElementById('message').innerText += message;
}
Here's the same call using the enumeration text values:
Office.context.document.getSelectedDataAsync("text", {valueFormat:"unformatted", filterType:"all"},
function (result) {
if (result.status === "success")
var dataValue = result.value; // Get selected data.
write('Selected data is ' + dataValue);
else {
var err = result.error;
write(err.name + ": " + err.message);
}
});
Reference
| Name | Definition |
|---|---|
| ActiveView | Specifies the state of the active view of the document, for example, whether the user can edit the document. |
| AsyncResultStatus | Specifies the result of an asynchronous call. |
| AttachmentType | Specifies the type of an attachment to an email message or meeting request. Outlook 2013 does not support this enumeration. |
| BindingType | Specifies the type of the binding object that should be returned. |
| BodyType | Specifies the text type for the body of an appointment or message. |
| CoercionType | Specifies how to coerce data returned or set by the invoked method. |
| CustomXMLNodeType | Specifies the node type. |
| DocumentMode | Specifies whether the document in associated application is read-only or read-write. |
| EntityType | Specifies an entity's type. |
| EventType | Specifies the kind of event that was raised. |
| FileType | Specifies the format in which to return the document. |
| FilterType | Specifies whether filtering from the host application is applied when the data is retrieved. |
| GoToType | Specifies the type of place or object to navigate to. |
| HostType | pecifies the host Office application in which the add-in is running. |
| InitializationReason | Specifies whether the add-in was just inserted or was already contained in the document. |
| ItemType | Specifies an item's type. |
| notificationMessageType | Specifies the notification message for an appointment or message. |
| PlatformType | Specifies the OS or other platform on which the Office host application is running. |
| ProjectProjectFields | Specifies the project fields that are available as a parameter for the getProjectFieldAsync method. |
| ProjectResourceFields | Specifies the resource fields that are available as a parameter for the getResourceFieldAsync method. |
| ProjectTaskFields | Specifies the task fields that are available as a parameter for the getTaskFieldAsync method. |
| ProjectViewTypes | Specifies the types of views that the getSelectedViewAsync method can recognize. |
| RecipientType | Specifies the type of recipient for an appointment. |
| ResponseType | Specifies the response to a meeting invitation. |
| SelectionMode | Specifies whether to select (highlight) the location to navigate to (when using the Document.goToByIdAsync method). |
| SourceProperty | Specifies the source of the data returned by the invoked method. |
| Table | Specifies enumerated values for the cells: property in the cellFormat parameter of table formatting methods. |
| ValueFormat | Specifies whether values, such as numbers and dates, returned by the invoked method are returned with their formatting applied. |
Support details
Support for each enumeration differs across Office host applications. See the "Support details" section of each enumerations's topic for host support information.
For more information about Office host application and server requirements, see Requirements for running Office Add-ins.
| Add-in types | Content, task pane, Outlook |
| Library | Office.js |
| Namespace | Office |