Office.Subject interface
Provides methods to get and set the subject of an appointment or message in an Outlook add-in.
Remarks
Minimum permission level: read item
Applicable Outlook mode: Compose
Methods
get |
Gets the subject of an appointment or message. The |
get |
Gets the subject of an appointment or message. The |
set |
Sets the subject of an appointment or message. The |
set |
Sets the subject of an appointment or message. The |
Method Details
getAsync(options, callback)
Gets the subject of an appointment or message.
The getAsync
method starts an asynchronous call to the Exchange server to get the subject of an appointment or message.
getAsync(options: Office.AsyncContextOptions, callback: (asyncResult: Office.AsyncResult<string>) => void): void;
Parameters
- options
- Office.AsyncContextOptions
An object literal that contains one or more of the following properties:- asyncContext
: Developers can provide any object they wish to access in the callback function.
- callback
-
(asyncResult: Office.AsyncResult<string>) => void
When the method completes, the function passed in the callback
parameter is called with a single parameter of type Office.AsyncResult
. The value
property of the result is the subject of the item.
Returns
void
Remarks
Minimum permission level: read item
Applicable Outlook mode: Compose
getAsync(callback)
Gets the subject of an appointment or message.
The getAsync
method starts an asynchronous call to the Exchange server to get the subject of an appointment or message.
getAsync(callback: (asyncResult: Office.AsyncResult<string>) => void): void;
Parameters
- callback
-
(asyncResult: Office.AsyncResult<string>) => void
When the method completes, the function passed in the callback
parameter is called with a single parameter of type Office.AsyncResult
. The value
property of the result is the subject of the item.
Returns
void
Remarks
Minimum permission level: read item
Applicable Outlook mode: Compose
Examples
Office.context.mailbox.item.subject.getAsync(callback);
function callback(asyncResult) {
const subject = asyncResult.value;
}
setAsync(subject, options, callback)
Sets the subject of an appointment or message.
The setAsync
method starts an asynchronous call to the Exchange server to set the subject of an appointment or message. Setting the subject overwrites the current subject, but leaves any prefixes, such as "Fwd:" or "Re:" in place.
setAsync(subject: string, options: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult<void>) => void): void;
Parameters
- subject
-
string
The subject of the appointment or message. The string is limited to 255 characters.
- options
- Office.AsyncContextOptions
An object literal that contains one or more of the following properties:- asyncContext
: Developers can provide any object they wish to access in the callback function.
- callback
-
(asyncResult: Office.AsyncResult<void>) => void
Optional. When the method completes, the function passed in the callback
parameter is called with a single parameter of type Office.AsyncResult
. If setting the subject fails, the asyncResult.error
property will contain an error code.
Returns
void
Remarks
Minimum permission level: read item
Applicable Outlook mode: Compose
Important: In Outlook on Android and on iOS, this method isn't supported in the Message Compose mode. Only the Appointment Organizer mode is supported. For more information on supported APIs in Outlook mobile, see Outlook JavaScript APIs supported in Outlook on mobile devices.
Errors:
DataExceedsMaximumSize
: The subject parameter is longer than 255 characters.
Examples
Office.context.mailbox.item.subject.setAsync("New subject!", function (asyncResult) {
if (asyncResult.status === "failed") {
console.log("Action failed with error: " + asyncResult.error.message);
}
});
setAsync(subject, callback)
Sets the subject of an appointment or message.
The setAsync
method starts an asynchronous call to the Exchange server to set the subject of an appointment or message. Setting the subject overwrites the current subject, but leaves any prefixes, such as "Fwd:" or "Re:" in place.
setAsync(subject: string, callback?: (asyncResult: Office.AsyncResult<void>) => void): void;
Parameters
- subject
-
string
The subject of the appointment or message. The string is limited to 255 characters.
- callback
-
(asyncResult: Office.AsyncResult<void>) => void
Optional. When the method completes, the function passed in the callback
parameter is called with a single parameter of type Office.AsyncResult
. If setting the subject fails, the asyncResult.error
property will contain an error code.
Returns
void
Remarks
Minimum permission level: read item
Applicable Outlook mode: Compose
Important: In Outlook on Android and on iOS, this method isn't supported in the Message Compose mode. Only the Appointment Organizer mode is supported. For more information on supported APIs in Outlook mobile, see Outlook JavaScript APIs supported in Outlook on mobile devices.
Errors:
DataExceedsMaximumSize
: The subject parameter is longer than 255 characters.
Office Add-ins