Office.From interface
Provides a method to get the from value of a message in an Outlook add-in.
Remarks
Minimum permission level: read item
Applicable Outlook mode: Compose
Important: This interface is supported in Outlook on Android and on iOS. For a sample scenario, see Implement event-based activation in Outlook mobile add-ins.
Methods
get |
Gets the from value of a message. The The from value of the item is provided as an EmailAddressDetails in the |
get |
Gets the from value of a message. The The from value of the item is provided as an EmailAddressDetails in the |
Method Details
getAsync(options, callback)
Gets the from value of a message.
The getAsync
method starts an asynchronous call to the Exchange server to get the from value of a message.
The from value of the item is provided as an EmailAddressDetails in the asyncResult.value
property.
getAsync(options: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult<EmailAddressDetails>) => 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<Office.EmailAddressDetails>) => 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. The value
property of the result is the item's from value, as an EmailAddressDetails
object.
Returns
void
Remarks
Minimum permission level: read item
Applicable Outlook mode: Compose
Important:
This method is supported in Outlook on Android and on iOS. For a sample scenario, see Implement event-based activation in Outlook mobile add-ins. To learn more about APIs supported in Outlook mobile, see Outlook JavaScript APIs supported in Outlook on mobile devices.
A
recipientType
property value isn't returned by thegetAsync
method. The email sender is always a user whose email address is on the Exchange server.
Examples
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/30-recipients-and-attendees/get-from-message-compose.yaml
Office.context.mailbox.item.from.getAsync(function(asyncResult) {
if (asyncResult.status === Office.AsyncResultStatus.Succeeded) {
const msgFrom = asyncResult.value;
console.log("Message from: " + msgFrom.displayName + " (" + msgFrom.emailAddress + ")");
} else {
console.error(asyncResult.error);
}
});
getAsync(callback)
Gets the from value of a message.
The getAsync
method starts an asynchronous call to the Exchange server to get the from value of a message.
The from value of the item is provided as an EmailAddressDetails in the asyncResult.value
property.
getAsync(callback?: (asyncResult: Office.AsyncResult<EmailAddressDetails>) => void): void;
Parameters
- callback
-
(asyncResult: Office.AsyncResult<Office.EmailAddressDetails>) => 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. The value
property of the result is the item's from value, as an EmailAddressDetails
object.
Returns
void
Remarks
Minimum permission level: read item
Applicable Outlook mode: Compose
Important:
This method is supported in Outlook on Android and on iOS. For a sample scenario, see Implement event-based activation in Outlook mobile add-ins. To learn more about APIs supported in Outlook mobile, see Outlook JavaScript APIs supported in Outlook on mobile devices.
A
recipientType
property value isn't returned by thegetAsync
method. The email sender is always a user whose email address is on the Exchange server.
Office Add-ins