openTypeExtension 资源类型(开放扩展)openTypeExtension resource type (open extensions)

命名空间:microsoft.graphNamespace: microsoft.graph

借助开放扩展(旧称为“Office 365 数据扩展”),可以直接将泛型属性轻松添加到 Microsoft Graph 中的资源。Open extensions (formerly known as Office 365 data extensions) provide an easy way to directly add untyped properties to a resource in Microsoft Graph.

开放扩展由 openTypeExtension 资源表示。Open extensions are represented by the openTypeExtension resource. 添加到资源的所有开放扩展都会显示在派生自 extension 抽象类型的 extensions 导航属性中。Any open extension added to a resource shows up in the extensions navigation property, which is derived from the extension abstract type. 每个扩展都有 extensionName 属性(这是所有扩展的预定义唯一可写属性)和自定义数据。Each extension has an extensionName property which is the only pre-defined, writable property for all extensions, along with your custom data.

一种有助于确保扩展名称唯一性的方法是,使用反向域名系统 (DNS) 格式,此格式依赖_用户自己的域_。例如,Com.Contoso.ContactInfoOne way to help make sure extension names are unique is to use a reverse domain name system (DNS) format that is dependent on your own domain, for example, Com.Contoso.ContactInfo. 请勿在扩展名称中使用 Microsoft 域(Com.MicrosoftCom.OnMicrosoft)。Do not use the Microsoft domain (Com.Microsoft or Com.OnMicrosoft) in an extension name.

开放扩展示例:使用开放扩展向用户添加自定义数据Open extension example: Add custom data to users using open extensions

一般可用性(GA: /v1.0 和 /beta)或预览版 (/beta) 对应版本中的以下资源支持开放扩展。Open extensions are supported by the following resources in the corresponding versions - general availability (GA: /v1.0 and /beta) or preview (/beta).

资源Resource 版本Version
管理单元Administrative unit 仅供预览Preview only
日历事件Calendar event GAGA
日历事件Group calendar event GAGA
组对话线程帖子Group conversation thread post GAGA
设备device GAGA
group GAGA
邮件message GAGA
组织organization GAGA
个人联系人Personal contact GAGA
用户user GAGA

Outlook 特定注意事项Outlook-specific considerations

Outlook 资源(事件、邮件或个人联系人)上存在每个开放扩展均存储在 MAPI 命名属性中。Each open extension present on an Outlook resource (event, message, or personal contact) is stored in a MAPI named property. 为 Outlook 创建开放扩展时,请考虑 MAPI 命名属性为用户邮箱中的有限资源。When you create open extensions for Outlook, consider that MAPI named properties are a finite resource in a user's mailbox. 当用户的命名属性配额用尽后,无法再为该用户创建任何其他命名属性。When a user's named property quota is exhausted, you can't create any more named properties for that user. 这可能会导致依赖命名属性工作的客户端中出现异常行为。This can result in unexpected behavior from clients that rely on named properties to function.

在 Outlook 资源中创建开放扩展时,请遵循以下指导原则:Apply the following guidelines when you create open extensions on Outlook resources:

  • 创建所需的最少数量的扩展。Create the minimum number of extensions required. 大多数应用程序只需要一个扩展。Most applications should require no more than one extension. 扩展未设定定义的属性或结构,因此,可以在一个扩展中存储多个值。Extensions have no set defined properties or structure, so you can store multiple values in a single extension.
  • 避免以可变方式命名扩展,如基于用户输入等。Avoid naming extensions in a variable manner (such as based on user input, etc.). 每次使用用户邮箱中先前未使用过的新名称创建开放扩展时,将会创建新的 MAP 命名属性。Each time an open extension is created with a new name that has not been used in a user's mailbox before, a new MAPI named property is created. 删除扩展不会删除命名属性。Removing the extension does not remove the named property.

使用开放扩展(针对 Outlook 资源)或扩展属性Use open extensions (for Outlook resources) or extended properties

开放扩展是大部分涉及存储和访问自定义数据的应用场景的推荐解决方案。Open extensions are the recommended solution for most scenarios involving storing and accessing custom data. 不过,如果需要访问尚未通过 Microsoft Graph API 元数据公开的 Outlook MAPI 属性的自定义数据,则可以使用扩展属性及其 REST APIIf, however, you need to access custom data for Outlook MAPI properties that are not already exposed through the Microsoft Graph API metadata, you can use extended properties and its REST API. 若要确认元数据公开了哪些属性,请访问$metadataYou can verify which properties the metadata exposes at$metadata.

JSON 表示形式JSON representation

下面是资源的 JSON 表示形式。Here is a JSON representation of the resource.

  "extensionName": "string",
  "id": "string (identifier)"


属性Property 类型Type 说明Description
extensionNameextensionName StringString 开放类型开放扩展的唯一文本标识符。必需。A unique text identifier for an open type open extension. Required.
idid StringString 连接具有 extensionName 扩展类型的完全限定的标识符 。只读。A fully qualified identifier that concatenates the extension type with the extensionName. Read-only.




方法Method 返回类型Return Type 说明Description
创建Create openTypeExtension(在现有资源实例中),或包含 openTypeExtension 对象的新 contacteventmessageopenTypeExtension (in an existing resource instance), or a new contact, event, or message that contains an openTypeExtension object 在现有的或新的资源实例中创建 openTypeExtension 对象。Create an openTypeExtension object in an existing or new resource instance.
获取Get openTypeExtensionopenTypeExtension 读取 openTypeExtension 对象的属性和关系。Read properties and relationships of openTypeExtension object.
更新Update openTypeExtensionopenTypeExtension 更新 openTypeExtension 对象。Update openTypeExtension object.
删除Delete None 删除 openTypeExtension 对象。Delete openTypeExtension object.