Note
Access to this page requires authorization. You can try signing in or .
Access to this page requires authorization. You can try .
Office.AsyncContextOptions interface
- Package:
- office
Provides an option for preserving context data of any type, unchanged, for use in a callback.
Remarks
Used by
- Office.AppointmentCompose: addFileAttachmentAsync, addFileAttachmentFromBase64Async, addHandlerAsync, addItemAttachmentAsync, disableClientSignatureAsync, getAttachmentContentAsync, getAttachmentsAsync, getInitializationContextAsync, getItemIdAsync, getSelectedDataAsync, getSharedPropertiesAsync, isClientSignatureEnabledAsync, removeAttachmentAsync, removeHandlerAsync, saveAsync, sendAsync, setSelectedDataAsync
- Office.AppointmentRead: addHandlerAsync, displayReplyAllFormAsync, displayReplyFormAsync, getAttachmentContentAsync, getInitializationContextAsync, getSharedPropertiesAsync, removeHandlerAsync
- Office.Binding: addHandlerAsync
- Office.Bindings: getAllAsync, getByIdAsync, releaseByIdAsync
- Office.Body: appendOnSendAsync, getAsync, getTypeAsync, prependAsync, prependOnSendAsync, setAsync, setSelectedDataAsync, setSignatureAsync
- Office.Categories: addAsync, getAsync, removeAsync
- Office.CustomXmlNode: getNodesAsync, getNodeValueAsync, getTextAsync, getXmlAsync, setNodeValueAsync, setTextAsync, setXmlAsync
- Office.CustomXmlPart: addHandlerAsync, deleteAsync, getNodesAsync, getXmlAsync
- Office.CustomXmlParts: addAsync, getByIdAsync, getByNamespaceAsync
- Office.CustomXmlPrefixMappings: addNamespaceAsync, getNamespaceAsync, getPrefixAsync
- Office.DelayDeliveryTime: getAsync, setAsync
- Office.DevicePermission: requestPermissionsAsync
- Office.DisplayedBody: setAsync
- Office.DisplayedSubject: setAsync
- Office.Document: addHandlerAsync, getActiveViewAsync, getFilePropertiesAsync, getMaxResourceIndexAsync, getMaxTaskIndexAsync, getProjectFieldAsync, getResourceByIndexAsync, getResourceFieldAsync, getSelectedResourceAsync, getSelectedTaskAsync, getSelectedViewAsync, getTaskAsync, getTaskByIndexAsync, getTaskFieldAsync, getWSSUrlAsync, setResourceFieldAsync, setTaskFieldAsync
- Office.EnhancedLocation: addAsync, getAsync, removeAsync
- Office.Ews: getTokenStatusAsync
- Office.From: getAsync
- Office.InternetHeaders: getAsync, removeAsync, setAsync
- Office.IsAllDayEvent: getAsync, setAsync
- Office.LoadedMessageCompose: getAttachmentContentAsync, getAttachmentsAsync, getComposeTypeAsync, getConversationIndexAsync, getInitializationContextAsync, getItemClassAsync, getItemIdAsync, getSharedPropertiesAsync, isClientSignatureEnabledAsync, saveAsync, unloadAsync
- Office.LoadedMessageRead: displayReplyAllFormAsync, displayReplyFormAsync, getAllInternetHeadersAsync, getAsFileAsync, getAttachmentContentAsync, getInitializationContextAsync, getSharedPropertiesAsync, unloadAsync
- Office.Location: getAsync, setAsync
- Office.Mailbox: addHandlerAsync, displayAppointmentFormAsync, displayMessageFormAsync, displayNewAppointmentFormAsync, displayNewMessageFormAsync, getCallbackTokenAsync, getSelectedItemsAsync, loadItemByIdAsync, removeHandlerAsync
- Office.MasterCategories: addAsync, getAsync, removeAsync
- Office.MessageCompose: addFileAttachmentAsync, addFileAttachmentFromBase64Async, addHandlerAsync, addItemAttachmentAsync, closeAsync, disableClientSignatureAsync, getAttachmentContentAsync, getAttachmentsAsync, getComposeTypeAsync, getConversationIndexAsync, getInitializationContextAsync, getItemClassAsync, getItemIdAsync, getSelectedDataAsync, getSharedPropertiesAsync, isClientSignatureEnabledAsync, removeAttachmentAsync, removeHandlerAsync, saveAsync, sendAsync, setSelectedDataAsync
- Office.MessageRead: addHandlerAsync, displayReplyAllFormAsync, displayReplyFormAsync, getAllInternetHeadersAsync, getAsFileAsync, getAttachmentContentAsync, getInitializationContextAsync, getSharedPropertiesAsync, removeHandlerAsync
- Office.NotificationMessages: addAsync, getAllAsync, removeAsync, replaceAsync
- Office.Organizer: getAsync
- Office.Recipients: addAsync, getAsync, setAsync
- Office.Recurrence: getAsync, setAsync
- Office.ReplyFormData: options
- Office.Sensitivity: getAsync, setAsync
- Office.SensitivityLabel: getAsync, setAsync
- Office.SensitivityLabelsCatalog: getAsync, getIsEnabledAsync
- Office.SessionData: clearAsync, removeAsync, setAsync
- Office.Settings: addHandlerAsync
- Office.Subject: getAsync, setAsync
- Office.TableBinding: addColumnsAsync, addRowsAsync, clearFormatsAsync, deleteAllDataValuesAsync, getFormatsAsync, setFormatsAsync, setTableOptionsAsync
- Office.Time: getAsync, setAsync
- Office.UI: addHandlerAsync
Examples
// The following example gets the attachment contents of the
// current mail item being composed in Outlook.
function getAttachmentContentCompose() {
const item = Office.context.mailbox.item;
const options: Office.AsyncContextOptions = { asyncContext: { currentItem: item } };
item.getAttachmentsAsync(options, callback);
function callback(result) {
if (result.status === Office.AsyncResultStatus.Failed) {
console.log(result.error.message);
return;
}
if (result.value.length <= 0) {
console.log("Mail item has no attachments.");
return;
}
const currentItem = result.asyncContext.currentItem;
for (let i = 0; i < result.value.length; i++) {
currentItem.getAttachmentContentAsync(result.value[i].id, (asyncResult) => {
if (asyncResult.status === Office.AsyncResultStatus.Failed) {
console.log(asyncResult.error.message);
return;
}
console.log(asyncResult.value.content);
});
}
}
}
Properties
| asyncContext | A user-defined item of any type that is returned, unchanged, in the |
Property Details
asyncContext
A user-defined item of any type that is returned, unchanged, in the asyncContext property of the AsyncResult object that is passed to a callback.
asyncContext?: any
Property Value
any
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.
Office Add-ins
Feedback
Was this page helpful?
