Office.EnhancedLocation interface

表示约会上的位置集。

注解

[ API set: Mailbox 1.8 ]

最低权限级别读取项

适用的 Outlook 模式:Compose或读取

重要提示:若要在不支持邮箱要求集 1.8 的 Outlook 客户端中管理约会的位置,请改用 Office.Location API。 有关为方案选择正确位置 API 的指导,请参阅在 Outlook 中撰写任命时获取或设置位置

方法

addAsync(locationIdentifiers, options, callback)

将 添加到与约会关联的位置集。

addAsync(locationIdentifiers, callback)

将 添加到与约会关联的位置集。

getAsync(options, callback)

获取与约会关联的位置集。

getAsync(callback)

获取与约会关联的位置集。

removeAsync(locationIdentifiers, options, callback)

删除与约会关联的位置集。

如果有多个位置具有相同的名称,即使 中 locationIdentifiers只指定了一个位置,也会删除所有匹配的位置。

removeAsync(locationIdentifiers, callback)

删除与约会关联的位置集。

如果有多个位置具有相同的名称,即使 中 locationIdentifiers只指定了一个位置,也会删除所有匹配的位置。

方法详细信息

addAsync(locationIdentifiers, options, callback)

将 添加到与约会关联的位置集。

addAsync(locationIdentifiers: LocationIdentifier[], options: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult<void>) => void): void;

参数

locationIdentifiers

Office.LocationIdentifier[]

要添加到当前位置列表的位置。

options
Office.AsyncContextOptions

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

callback

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

可选。 方法完成后,使用单个参数 asyncResult(即 Office.AsyncResult 对象)调用在 参数中callback传递的函数。 status检查 的 asyncResult 属性以确定调用是否成功。

返回

void

注解

[ API set: Mailbox 1.8 ]

最低权限级别读/写项

适用的 Outlook 模式:Compose

错误

  • InvalidFormatError :指定的数据对象的格式无效。

示例

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/90-other-item-apis/get-add-remove-enhancedlocation-appointment.yaml

const locations = [
  {
    id: "Contoso",
    type: Office.MailboxEnums.LocationType.Custom
  },
  {
    id: "room500@test.com",
    type: Office.MailboxEnums.LocationType.Room
  }
];
Office.context.mailbox.item.enhancedLocation.addAsync(locations, (result) => {
  if (result.status === Office.AsyncResultStatus.Succeeded) {
    console.log(`Successfully added locations ${JSON.stringify(locations)}`);
  } else {
    console.error(`Failed to add locations. Error message: ${result.error.message}`);
  }
});

addAsync(locationIdentifiers, callback)

将 添加到与约会关联的位置集。

addAsync(locationIdentifiers: LocationIdentifier[], callback?: (asyncResult: Office.AsyncResult<void>) => void): void;

参数

locationIdentifiers

Office.LocationIdentifier[]

要添加到当前位置列表的位置。

callback

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

可选。 方法完成后,使用单个参数 asyncResult(即 Office.AsyncResult 对象)调用在 参数中callback传递的函数。 status检查 的 asyncResult 属性以确定调用是否成功。

返回

void

注解

[ API set: Mailbox 1.8 ]

最低权限级别读/写项

适用的 Outlook 模式:Compose

错误

  • InvalidFormatError :指定的数据对象的格式无效。

getAsync(options, callback)

获取与约会关联的位置集。

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

参数

options
Office.AsyncContextOptions

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

callback

(asyncResult: Office.AsyncResult<Office.LocationDetails[]>) => void

可选。 方法完成后,使用单个参数 asyncResult(即 Office.AsyncResult 对象)调用在 参数中callback传递的函数。 在 属性中asyncResult.value返回表示约会位置的 对象的数组Office.LocationDetails

返回

void

注解

[ API set: Mailbox 1.8 ]

最低权限级别读取项

适用的 Outlook 模式:Compose或读取

重要说明

  • 方法getAsync不返回已添加到约会的“位置”字段的个人联系人组

  • 如果使用 添加 Office.context.mailbox.item.location.setAsync位置,则其位置类型为 Office.MailboxEnums.LocationType.Custom

示例

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/90-other-item-apis/get-add-remove-enhancedlocation-appointment.yaml

Office.context.mailbox.item.enhancedLocation.getAsync((result) => {
  if (result.status !== Office.AsyncResultStatus.Succeeded) {
    console.error(`Failed to get locations. Error message: ${result.error.message}`);
    return;
  }
  const places = result.value;
  if (places && places.length > 0) {
    result.value.forEach(function(place) {
      console.log(`Location: ${place.displayName} (type: ${place.locationIdentifier.type})`);
      if (place.locationIdentifier.type === Office.MailboxEnums.LocationType.Room) {
        console.log("Email address: " + place.emailAddress);
      }
    });
  } else {
    console.log("There are no locations.");
  }
});

getAsync(callback)

获取与约会关联的位置集。

getAsync(callback?: (asyncResult: Office.AsyncResult<LocationDetails[]>) => void): void;

参数

callback

(asyncResult: Office.AsyncResult<Office.LocationDetails[]>) => void

可选。 方法完成后,使用单个参数 asyncResult(即 Office.AsyncResult 对象)调用在 参数中callback传递的函数。 在 属性中asyncResult.value返回表示约会位置的 对象的数组Office.LocationDetails

返回

void

注解

[ API set: Mailbox 1.8 ]

最低权限级别读取项

适用的 Outlook 模式:Compose或读取

重要说明

  • 方法getAsync不返回已添加到约会的“位置”字段的个人联系人组

  • 如果使用 添加 Office.context.mailbox.item.location.setAsync位置,则其位置类型为 Office.MailboxEnums.LocationType.Custom

removeAsync(locationIdentifiers, options, callback)

删除与约会关联的位置集。

如果有多个位置具有相同的名称,即使 中 locationIdentifiers只指定了一个位置,也会删除所有匹配的位置。

removeAsync(locationIdentifiers: LocationIdentifier[], options: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult<void>) => void): void;

参数

locationIdentifiers

Office.LocationIdentifier[]

要从当前位置列表中删除的位置。

options
Office.AsyncContextOptions

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

callback

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

可选。 方法完成后,使用单个参数 asyncResult(即 Office.AsyncResult 对象)调用在 参数中callback传递的函数。 status检查 的 asyncResult 属性以确定调用是否成功。

返回

void

注解

[ API set: Mailbox 1.8 ]

最低权限级别读/写项

适用的 Outlook 模式:Compose

示例

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/90-other-item-apis/get-add-remove-enhancedlocation-appointment.yaml

const locations = [
  {
    id: "Contoso",
    type: Office.MailboxEnums.LocationType.Custom
  },
  {
    id: "room500@test.com",
    type: Office.MailboxEnums.LocationType.Room
  }
];
Office.context.mailbox.item.enhancedLocation.removeAsync(locations, (result) => {
  if (result.status === Office.AsyncResultStatus.Succeeded) {
    console.log(`Successfully removed locations ${JSON.stringify(locations)}`);
  } else {
    console.error(`Failed to remove locations. Error message: ${result.error.message}`);
  }
});

removeAsync(locationIdentifiers, callback)

删除与约会关联的位置集。

如果有多个位置具有相同的名称,即使 中 locationIdentifiers只指定了一个位置,也会删除所有匹配的位置。

removeAsync(locationIdentifiers: LocationIdentifier[], callback?: (asyncResult: Office.AsyncResult<void>) => void): void;

参数

locationIdentifiers

Office.LocationIdentifier[]

要从当前位置列表中删除的位置。

callback

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

可选。 方法完成后,使用单个参数 asyncResult(即 Office.AsyncResult 对象)调用在 参数中callback传递的函数。 status检查 的 asyncResult 属性以确定调用是否成功。

返回

void

注解

[ API set: Mailbox 1.8 ]

最低权限级别读/写项

适用的 Outlook 模式:Compose