Create extensionProperty

Namespace: microsoft.graph

Important

APIs under the /beta version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported.

Create a new extensionProperty definition. You can use this operation to add a custom property value to the targeted object type defined in the extensionProperty, using standard creation and update requests to the target object.

Permissions

One of the following permissions is required to call this API. To learn more, including how to choose permissions, see Permissions.

Permission type Permissions (from least to most privileged)
Delegated (work or school account) Application.ReadWrite.All, Directory.ReadWrite.All, Directory.AccessAsUser.All
Delegated (personal Microsoft account) Not supported.
Application Application.ReadWrite.OwnedBy, Application.ReadWrite.All, Directory.ReadWrite.All

HTTP request

POST /applications/{id}/extensionProperties

Request headers

Name Description
Authorization Bearer {token}. Required.
Content-Type application/json. Required.

Request body

In the request body, provide an extensionProperty object with the following properties.

Property Type Description
dataType String Specifies the data type of the value the extension property can hold. Following values are supported. Not nullable.
  • Binary - 256 bytes maximum
  • Boolean
  • DateTime - Must be specified in ISO 8601 format. Will be stored in UTC.
  • Integer - 32-bit value.
  • LargeInteger - 64-bit value.
  • String - 256 characters maximum
name String Name of the extension property. Not nullable.
targetObjects String collection Following values are supported. Not nullable.
  • User
  • Group
  • Organization
  • Device
  • Application

Response

If successful, this method returns 201, Created response code and a new extensionProperty object in the response body.

Examples

Request

The following is an example of the request.

POST https://graph.microsoft.com/beta/applications/{id}/extensionProperties
Content-type: application/json

{
    "name": "extensionName",
    "dataType": "string",
    "targetObjects": [
    	"Application"
    ]
}

Response

If successful, this method returns a 201 Created response code and an extensionProperty object in the response body.

HTTP/1.1 201 Created
Content-type: application/json

{
    "id": "a2c459db-f5dc-4328-ae9b-118e88d04d19",
    "deletedDateTime": null,
    "appDisplayName": "Display name",
    "name": "extension_b3efaf8f68a44275abcff28ef86b2ee3_extensionName",
    "dataType": "String",
    "isSyncedFromOnPremises": false,
    "targetObjects": [
    	"Application"
    ]
}