Office.CoercionTypeOptions interface
データ形式のオプションを提供します。
注釈
使用元
- Office.AppointmentCompose: setSelectedDataAsync
- Office.Body: appendOnSendAsync、 prependAsync、 prependOnSendAsync、 setAsync、 setSelectedDataAsync、 setSignatureAsync
- Office.DisplayedBody: setAsync
- Office.MessageCompose: setSelectedDataAsync
例
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/20-item-body/append-text-on-send.yaml
// This snippet appends text to the end of the message or appointment's body once it's sent.
const text = (document.getElementById("text-field") as HTMLInputElement).value;
// It's recommended to call getTypeAsync and pass its returned value to the options.coercionType parameter of the appendOnSendAsync call.
Office.context.mailbox.item.body.getTypeAsync((asyncResult) => {
if (asyncResult.status === Office.AsyncResultStatus.Failed) {
console.log("Action failed with error: " + asyncResult.error.message);
return;
}
const bodyFormat = asyncResult.value;
Office.context.mailbox.item.body.appendOnSendAsync(text, { coercionType: bodyFormat }, (asyncResult) => {
if (asyncResult.status === Office.AsyncResultStatus.Failed) {
console.log("Action failed with error: " + asyncResult.error.message);
return;
}
console.log(`"${text}" will be appended to the body once the message or appointment is sent. Send the mail item to test this feature.`);
});
});
プロパティ
| coercion |
目的のデータ形式。 |