Office.Recurrence interface

Recurrence 对象提供获取和设置约会重复周期模式的方法,但仅获取会议请求的重复周期模式。 它将具有一个字典,其中包含以下键seriesTime:、recurrenceTyperecurrencePropertiesrecurrenceTimeZone可选) (。

注解

API 集:邮箱 1.7

最低权限级别读取项目

适用的 Outlook 模式:Compose 或 Read

状态

状态 可编辑? 可见?
预约组织者 - Compose 系列 是, (setAsync) 是, (getAsync)
约会组织者 - Compose 实例 无 (setAsync 返回错误) 是, (getAsync)
预约与会者 - 阅读系列 无 (setAsync 不可用) 是 (item.recurrence)
约会与会者 - 读取实例 无 (setAsync 不可用) 是 (item.recurrence)
会议请求 - 阅读系列 无 (setAsync 不可用) 是 (item.recurrence)
会议请求 - 读取实例 无 (setAsync 不可用) 是 (item.recurrence)

使用方

属性

recurrenceProperties

获取或设置定期约会系列的属性。

recurrenceTimeZone

获取或设置定期约会系列的属性。

recurrenceType

获取或设置定期约会系列的类型。

seriesTime

SeriesTime 对象使你能够管理定期约会系列的开始和结束日期以及实例的通常开始和结束时间。 此对象不在 UTC 时间中。 而是在值指定的 recurrenceTimeZone 时区中设置或默认为项目的时区。

方法

getAsync(options, callback)

返回约会系列的当前定期对象。

此方法返回约会系列的整个 Recurrence 对象。

getAsync(callback)

返回约会系列的当前定期对象。

此方法返回约会系列的整个 Recurrence 对象。

setAsync(recurrencePattern, options, callback)

设置约会系列的重复周期模式。

setAsync(recurrencePattern, callback)

设置约会系列的重复周期模式。

属性详细信息

recurrenceProperties

获取或设置定期约会系列的属性。

recurrenceProperties?: RecurrenceProperties;

属性值

注解

API 集:邮箱 1.7

最低权限级别读取项目

适用的 Outlook 模式:Compose 或 Read

recurrenceTimeZone

获取或设置定期约会系列的属性。

recurrenceTimeZone?: RecurrenceTimeZone;

属性值

注解

API 集:邮箱 1.7

最低权限级别读取项目

适用的 Outlook 模式:Compose 或 Read

recurrenceType

获取或设置定期约会系列的类型。

recurrenceType: MailboxEnums.RecurrenceType | string;

属性值

注解

API 集:邮箱 1.7

最低权限级别读取项目

适用的 Outlook 模式:Compose 或 Read

seriesTime

SeriesTime 对象使你能够管理定期约会系列的开始和结束日期以及实例的通常开始和结束时间。 此对象不在 UTC 时间中。 而是在值指定的 recurrenceTimeZone 时区中设置或默认为项目的时区。

seriesTime: SeriesTime;

属性值

注解

API 集:邮箱 1.7

最低权限级别读取项目

适用的 Outlook 模式:Compose 或 Read

方法详细信息

getAsync(options, callback)

返回约会系列的当前定期对象。

此方法返回约会系列的整个 Recurrence 对象。

getAsync(options: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult<Recurrence>) => void): void;

参数

options
Office.AsyncContextOptions

包含以下一个或多个属性的对象文本:- asyncContext:开发人员可以在回调函数中提供他们希望访问的任何对象。

callback

(asyncResult: Office.AsyncResult<Office.Recurrence>) => void

可选。 当该方法完成时,将使用单个参数(一个对象)asyncResultOffice.AsyncResult调用传入参数的callback函数。 value结果的属性是一个Recurrence对象。

返回

void

注解

API 集:邮箱 1.7

最低权限级别读取项目

适用的 Outlook 模式:Compose

示例

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/50-recurrence/get-set-recurrence-appointment-organizer.yaml

Office.context.mailbox.item.recurrence.getAsync(function(asyncResult) {
  if (asyncResult.status === Office.AsyncResultStatus.Succeeded) {
    const recurrence = asyncResult.value;
    if (recurrence === null) {
      console.log("This is a single appointment.");
    } else {
      console.log(`Recurrence pattern: ${JSON.stringify(recurrence)}`);
    }
  } else {
    console.error(asyncResult.error);
  }
});

getAsync(callback)

返回约会系列的当前定期对象。

此方法返回约会系列的整个 Recurrence 对象。

getAsync(callback?: (asyncResult: Office.AsyncResult<Recurrence>) => void): void;

参数

callback

(asyncResult: Office.AsyncResult<Office.Recurrence>) => void

可选。 当该方法完成时,将使用单个参数(一个对象)asyncResultOffice.AsyncResult调用传入参数的callback函数。 value结果的属性是一个Recurrence对象。

返回

void

注解

API 集:邮箱 1.7

最低权限级别读取项目

适用的 Outlook 模式:Compose

setAsync(recurrencePattern, options, callback)

设置约会系列的重复周期模式。

setAsync(recurrencePattern: Recurrence, options: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult<void>) => void): void;

参数

recurrencePattern
Office.Recurrence

定期对象。

options
Office.AsyncContextOptions

包含以下一个或多个属性的对象文本:- asyncContext:开发人员可以在回调函数中提供他们希望访问的任何对象。

callback

(asyncResult: Office.AsyncResult<void>) => void

可选。 当该方法完成时,将使用单个参数(一个对象)asyncResultOffice.AsyncResult调用传入参数的callback函数。

返回

void

注解

API 集:邮箱 1.7

最低权限级别读取/写入项目

适用的 Outlook 模式:Compose

重要说明

  • setAsync 仅适用于系列项目,不适用于实例项目。

  • 当前使用该loadItemByIdAsync方法加载的消息不支持此setAsync方法。 有关详细信息,请参阅 在多封邮件上激活 Outlook 加载项。

错误

  • InvalidEndTime :约会结束时间早于其开始时间。

示例

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/50-recurrence/get-set-recurrence-appointment-organizer.yaml

// Important: Can only set the recurrence pattern of an appointment series.

const currentDate = new Date();
let seriesTimeObject: Office.SeriesTime;
// Set series start date to tomorrow.
seriesTimeObject.setStartDate(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDay() + 1);
// Set series end date to one year from now.
seriesTimeObject.setEndDate(currentDate.getFullYear() + 1, currentDate.getMonth() + 1, currentDate.getDay());
// Set start time to 1:30 PM.
seriesTimeObject.setStartTime(13, 30);
// Set duration to 30 minutes.
seriesTimeObject.setDuration(30);

const pattern = {
  seriesTime: seriesTimeObject,
  recurrenceType: Office.MailboxEnums.RecurrenceType.Yearly,
  recurrenceProperties: {
    interval: 1,
    dayOfWeek: Office.MailboxEnums.Days.Tue,
    weekNumber: Office.MailboxEnums.WeekNumber.Second,
    month: Office.MailboxEnums.Month.Sep
  },
  recurrenceTimeZone: { name: Office.MailboxEnums.RecurrenceTimeZone.PacificStandardTime }
};

Office.context.mailbox.item.recurrence.setAsync(pattern as any, (asyncResult) => {
  if (asyncResult.status !== Office.AsyncResultStatus.Succeeded) {
    console.error(`Failed to set recurrence. Error: ${asyncResult.error.message}`);
    return;
  }
  console.log(`Succeeded in setting recurrence pattern ${JSON.stringify(pattern)}`);
});

setAsync(recurrencePattern, callback)

设置约会系列的重复周期模式。

setAsync(recurrencePattern: Recurrence, callback?: (asyncResult: Office.AsyncResult<void>) => void): void;

参数

recurrencePattern
Office.Recurrence

定期对象。

callback

(asyncResult: Office.AsyncResult<void>) => void

可选。 当该方法完成时,将使用单个参数(一个对象)asyncResultOffice.AsyncResult调用传入参数的callback函数。

返回

void

注解

API 集:邮箱 1.7

最低权限级别读取/写入项目

适用的 Outlook 模式:Compose

重要说明

  • setAsync 仅适用于系列项目,不适用于实例项目。

  • 当前使用该loadItemByIdAsync方法加载的消息不支持此setAsync方法。 有关详细信息,请参阅 在多封邮件上激活 Outlook 加载项。

错误

  • InvalidEndTime :约会结束时间早于其开始时间。