Office.MailboxEnums.AttachmentType enum

指定附件的类型。

注解

[ API set: Mailbox 1.1 ]

适用的 Outlook 模式:Compose或读取

示例

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/outlook/40-attachments/attachments-compose.yaml

Office.context.mailbox.item.getAttachmentsAsync((result) => {
  if (result.status === Office.AsyncResultStatus.Failed) {
    console.error(result.error.message);
    return;
  }

  if (result.value.length > 0) {
    for (let i = 0; i < result.value.length; i++) {
      const attachment = result.value[i];
      let attachmentType;
      switch (attachment.attachmentType) {
        case Office.MailboxEnums.AttachmentType.Cloud:
          attachmentType = "Attachment is stored in a cloud location";
          break;
        case Office.MailboxEnums.AttachmentType.File:
          attachmentType = "Attachment is a file";
          break;
        case Office.MailboxEnums.AttachmentType.Item:
          attachmentType = "Attachment is an Exchange item";
          break;
      }
      console.log(
        "ID: " +
          attachment.id +
          "\n" +
          "Type: " +
          attachmentType +
          "\n" +
          "Name: " +
          attachment.name +
          "\n" +
          "Size: " +
          attachment.size +
          "\n" +
          "isInline: " +
          attachment.isInline
      );
    }
  } else {
    console.log("No attachments on this message.");
  }
});

字段

Base64 = "base64"

附件是 Base64 编码的文件。

重要提示base64附件类型仅受 displayReplyAllFormdisplayReplyAllFormAsyncdisplayReplyFormdisplayReplyFormAsync 方法的支持。

[ API set: Mailbox 1.15 ]

Cloud = "cloud"

附件存储在云位置(如 OneDrive)中。

重要提示:在读取模式下, id 附件的 AttachmentDetails 对象的 属性包含文件的 URL。 从要求集 1.8 开始,url附件的 AttachmentDetailsCompose 对象中包含的 属性包含Compose模式下文件的 URL。

cloud、、displayNewMessageFormAsyncdisplayReplyFormdisplayReplyAllFormAsyncdisplayReplyAllForm、 和 displayReplyFormAsync 方法不支持displayNewMessageForm附件类型。

File = "file"

附件是一个文件。

Item = "item"

附件是一个 Exchange 项目。