Office.MailboxEnums.DelegatePermissions enum

此位掩码表示委托对共享文件夹的权限。

注解

[ API set: Mailbox 1.8 ]

适用的 Outlook 模式:撰写或阅读

示例

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/65-delegates-and-shared-folders/get-shared-properties.yaml

if (!Office.context.mailbox.item.getSharedPropertiesAsync) {
  console.error("Try this sample on an appointment from a shared folder.");
  return;
}

Office.context.mailbox.getCallbackTokenAsync({ isRest: true }, function(result) {
  if (result.status === Office.AsyncResultStatus.Succeeded && result.value !== "") {
    Office.context.mailbox.item.getSharedPropertiesAsync(
      {
        // Pass auth token along.
        asyncContext: result.value
      },
      function(result2) {
        let sharedProperties = result2.value;
        let delegatePermissions = sharedProperties.delegatePermissions;

        // Determine if user has the appropriate permission to do the operation.
        if ((delegatePermissions & Office.MailboxEnums.DelegatePermissions.Read) != 0) {
          const ewsId = Office.context.mailbox.item.itemId;
          const restId = Office.context.mailbox.convertToRestId(ewsId, Office.MailboxEnums.RestVersion.v2_0);
          let rest_url =
            sharedProperties.targetRestUrl + "/v2.0/users/" + sharedProperties.targetMailbox + "/events/" + restId;

          $.ajax({
            url: rest_url,
            dataType: "json",
            headers: { Authorization: "Bearer " + result2.asyncContext }
          })
            .done(function(response) {
              console.log(response);
            })
            .fail(function(error) {
              console.error(error);
            });
        }
      }
    );
  }
});

字段

Read = 1

委托具有读取项的权限。

Write = 2

委托有权创建和写入项。

DeleteOwn = 4

委托仅有权删除他们创建的项。

DeleteAll = 8

委托有权删除任何项目。

EditOwn = 16

委托仅有权编辑他们创建的项。

EditAll = 32

委托有权编辑任何项目。