Office.DelayDeliveryTime interface   
通过 DelayDeliveryTime 对象,可以管理邮件的延迟传递日期和时间。
方法
| get | 获取邮件的传递日期和时间。 | 
| get | 获取邮件的传递日期和时间。 | 
| set | 设置邮件的传递日期和时间。 | 
| set | 设置邮件的传递日期和时间。 | 
方法详细信息
		getAsync(options, callback)
	 
	获取邮件的传递日期和时间。
getAsync(options: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult<Date | 0>) => void): void;参数
- options
- Office.AsyncContextOptions
包含以下一个或多个属性的对象文本:- asyncContext:开发人员可以在回调函数中提供他们想要访问的任何对象。
- callback
- 
				(asyncResult: Office.AsyncResult<Date | 0>) => void 
可选。 方法完成后,使用单个参数 asyncResult(即 Office.AsyncResult 对象)调用在 参数中callback传递的函数。 在 属性中 asyncResult.value 返回邮件的传递日期和时间。 如果尚未对邮件设置传递日期, 0 则改为返回 。
返回
void
注解
最低权限级别: 读取项
适用的 Outlook 模式:Compose
		getAsync(callback)
	 
	获取邮件的传递日期和时间。
getAsync(callback?: (asyncResult: Office.AsyncResult<Date | 0>) => void): void;参数
- callback
- 
				(asyncResult: Office.AsyncResult<Date | 0>) => void 
可选。 方法完成后,使用单个参数 asyncResult(即 Office.AsyncResult 对象)调用在 参数中callback传递的函数。 在 属性中 asyncResult.value 返回邮件的传递日期和时间。 如果尚未对邮件设置传递日期, 0 则改为返回 。
返回
void
注解
最低权限级别: 读取项
适用的 Outlook 模式:Compose
示例
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/90-other-item-apis/delay-message-delivery.yaml
// This snippet gets the delivery date and time of a message.
Office.context.mailbox.item.delayDeliveryTime.getAsync((asyncResult) => {
  if (asyncResult.status === Office.AsyncResultStatus.Failed) {
    console.log(asyncResult.error.message);
    return;
  }
  const deliveryDate = asyncResult.value;
  if (deliveryDate === 0) {
    console.log("Your message will be delivered immediately when you select Send.");
  } else {
    const date = new Date(deliveryDate);
    console.log(`Message delivery date and time: ${date.toString()}`);
  }
});
		setAsync(datetime, options, callback)
	 
	设置邮件的传递日期和时间。
setAsync(datetime: Date, options: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult<void>) => void): void;参数
- datetime
- 
				Date 
应发送消息的未来日期和时间。
- options
- Office.AsyncContextOptions
包含以下一个或多个属性的对象文本:- asyncContext:开发人员可以在回调函数中提供他们想要访问的任何对象。
- callback
- 
				(asyncResult: Office.AsyncResult<void>) => void 
可选。 方法完成后,使用单个参数 asyncResult(即 Office.AsyncResult 对象)调用在 参数中callback传递的函数。 
              asyncResult.error 属性中将提供遇到的所有错误。
返回
void
注解
最低权限级别: 读/写项
适用的 Outlook 模式:Compose
重要说明:
- 当 用于计划消息的传递时 - item.delayDeliveryTime.setAsync,将在服务器上处理延迟。 这样即使 Outlook 客户端未运行,也可以发送邮件。 在经典 Outlook on Windows 中,邮件不会显示在 “发件箱” 文件夹中,因此在选择“ 发送”后,你将无法编辑邮件或取消邮件传递。 只能查看“ 已发送邮件 ”文件夹中的邮件。 在 Outlook 网页版、Mac 和新的 Outlook on Windows 中,邮件将出现在“草稿”文件夹中,直到计划的传递时间。 虽然邮件位于 “草稿” 文件夹中,但你可以在邮件发送前对其进行编辑。 若要了解详细信息,请参阅 管理邮件的传递日期和时间。
- 当前 - setAsync使用- loadItemByIdAsync方法加载的消息不支持 方法。 有关详细信息,请参阅 在多条消息上激活 Outlook 加载项。
错误:
- 
              InvalidFormatError- 指定的数据对象的格式无效。
		setAsync(datetime, callback)
	 
	设置邮件的传递日期和时间。
setAsync(datetime: Date, callback?: (asyncResult: Office.AsyncResult<void>) => void): void;参数
- datetime
- 
				Date 
应发送消息的未来日期和时间。
- callback
- 
				(asyncResult: Office.AsyncResult<void>) => void 
可选。 方法完成后,使用单个参数 asyncResult(即 Office.AsyncResult 对象)调用在 参数中callback传递的函数。 
              asyncResult.error 属性中将提供遇到的所有错误。
返回
void
注解
最低权限级别: 读/写项
适用的 Outlook 模式:Compose
重要说明:
- 当 用于计划消息的传递时 - item.delayDeliveryTime.setAsync,将在服务器上处理延迟。 这样即使 Outlook 客户端未运行,也可以发送邮件。 在经典 Outlook on Windows 中,邮件不会显示在 “发件箱” 文件夹中,因此在选择“ 发送”后,你将无法编辑邮件或取消邮件传递。 只能查看“ 已发送邮件 ”文件夹中的邮件。 在 Outlook 网页版、Mac 和新的 Outlook on Windows 中,邮件将出现在“草稿”文件夹中,直到计划的传递时间。 虽然邮件位于 “草稿” 文件夹中,但你可以在邮件发送前对其进行编辑。 若要了解详细信息,请参阅 管理邮件的传递日期和时间。
- 当前 - setAsync使用- loadItemByIdAsync方法加载的消息不支持 方法。 有关详细信息,请参阅 在多条消息上激活 Outlook 加载项。
错误:
- 
              InvalidFormatError- 指定的数据对象的格式无效。
示例
// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/90-other-item-apis/delay-message-delivery.yaml
function setDeliveryDate(minutes) {
  // This snippet sets the delivery date and time of a message.
  const currentTime = new Date().getTime();
  const milliseconds = totalDelay * 60000;
  const timeDelay = new Date(currentTime + milliseconds);
  Office.context.mailbox.item.delayDeliveryTime.setAsync(timeDelay, (asyncResult) => {
    if (asyncResult.status === Office.AsyncResultStatus.Failed) {
      console.log(asyncResult.error.message);
      return;
    }
    if (minutes === 1440) {
      console.log(`Delayed delivery by an additional one day.`);
    } else {
      console.log(`Delayed delivery by an additional ${minutes} minutes.`);
    }
  });
}