Office.SessionData interface
Provides methods to manage an item's session data.
Session data is specific to a single mail item. It isn't shared among multiple items even if the same add-in is used to set or retrieve data.
Remarks
[Api set: Mailbox 1.11]
Minimum permission level: read item
Applicable Outlook mode: Compose
Important: In Outlook clients that support Mailbox 1.15 or earlier, the entire SessionData object for each mail item is limited to 50,000 characters per add-in. In clients that support Mailbox 1.16 or later, the character limit per add-in is 2,621,440 characters.
Methods
| clear |
Clears all session data key-value pairs. |
| clear |
Clears all session data key-value pairs. |
| get |
Gets all session data key-value pairs. |
| get |
Gets the session data value of the specified key. |
| remove |
Removes a session data key-value pair. |
| remove |
Removes a session data key-value pair. |
| set |
Sets a session data key-value pair. |
| set |
Sets a session data key-value pair. |
Method Details
clearAsync(options, callback)
Clears all session data key-value pairs.
clearAsync(options: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult<void>) => 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<void>) => void
Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an Office.AsyncResult object.
Returns
void
Remarks
[Api set: Mailbox 1.11]
Minimum permission level: read/write item
Applicable Outlook mode: Compose
clearAsync(callback)
Clears all session data key-value pairs.
clearAsync(callback?: (asyncResult: Office.AsyncResult<void>) => void): void;
Parameters
- callback
-
(asyncResult: Office.AsyncResult<void>) => void
Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an Office.AsyncResult object.
Returns
void
Remarks
[Api set: Mailbox 1.11]
Minimum permission level: read/write item
Applicable Outlook mode: Compose
getAllAsync(callback)
Gets all session data key-value pairs.
getAllAsync(callback: (asyncResult: Office.AsyncResult<object>) => void): void;
Parameters
- callback
-
(asyncResult: Office.AsyncResult<object>) => void
When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an Office.AsyncResult object.
Returns
void
Remarks
[Api set: Mailbox 1.11]
Minimum permission level: read/write item
Applicable Outlook mode: Compose
getAsync(name, callback)
Gets the session data value of the specified key.
getAsync(name: string, callback: (asyncResult: Office.AsyncResult<string>) => void): void;
Parameters
- name
-
string
The session data key.
- 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.
Returns
void
Remarks
[Api set: Mailbox 1.11]
Minimum permission level: read item
Applicable Outlook mode: Compose
removeAsync(name, options, callback)
Removes a session data key-value pair.
removeAsync(name: string, options: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult<void>) => void): void;
Parameters
- name
-
string
The session data key.
- 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, asyncResult, which is an Office.AsyncResult object.
Returns
void
Remarks
[Api set: Mailbox 1.11]
Minimum permission level: read/write item
Applicable Outlook mode: Compose
removeAsync(name, callback)
Removes a session data key-value pair.
removeAsync(name: string, callback?: (asyncResult: Office.AsyncResult<void>) => void): void;
Parameters
- name
-
string
The session data key.
- callback
-
(asyncResult: Office.AsyncResult<void>) => void
Optional. When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an Office.AsyncResult object.
Returns
void
Remarks
[Api set: Mailbox 1.11]
Minimum permission level: read/write item
Applicable Outlook mode: Compose
setAsync(name, value, options, callback)
Sets a session data key-value pair.
setAsync(name: string, value: string, options: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult<void>) => void): void;
Parameters
- name
-
string
The session data key.
- value
-
string
The session data value as a string.
- 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.
Returns
void
Remarks
[Api set: Mailbox 1.11]
Minimum permission level: read item
Applicable Outlook mode: Compose
Important: In Outlook clients that support Mailbox 1.15 or earlier, the entire SessionData object for each mail item is limited to 50,000 characters per add-in. In clients that support Mailbox 1.16 or later, the character limit per add-in is 2,621,440 characters.
setAsync(name, value, callback)
Sets a session data key-value pair.
setAsync(name: string, value: string, callback?: (asyncResult: Office.AsyncResult<void>) => void): void;
Parameters
- name
-
string
The session data key.
- value
-
string
The session data value as a string.
- 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.
Returns
void
Remarks
[Api set: Mailbox 1.11]
Minimum permission level: read item
Applicable Outlook mode: Compose
Important: In Outlook clients that support Mailbox 1.15 or earlier, the entire SessionData object for each mail item is limited to 50,000 characters per add-in. In clients that support Mailbox 1.16 or later, the character limit per add-in is 2,621,440 characters.