Skip to content

Latest commit

 

History

History
317 lines (240 loc) · 13.2 KB

File metadata and controls

317 lines (240 loc) · 13.2 KB
title Create single-value extended property
description Create one or more single-value extended properties in a new or existing instance of a resource.
ms.localizationpriority medium
doc_type apiPageType
ms.subservice non-product-specific
author SuryaLashmiS
ms.date 04/05/2024

Create single-value extended property

Namespace: microsoft.graph

[!INCLUDE beta-disclaimer]

[!INCLUDE outlooktask-deprecate-sharedfeature]

Create one or more single-value extended properties in a new or existing instance of a resource.

The following user resources are supported:

The following group resources are supported:

For more information about when to use open extensions or extended properties, and how to specify extended properties, see Extended properties overview.

[!INCLUDE national-cloud-support]

Permissions

Depending on the resource you're creating the extended property in and the permission type (delegated or application) you request, the permission specified in the following table is the minimum required to call this API. To learn more, including how to choose permissions, see Permissions.

Supported resource Delegated (work or school account) Delegated (personal Microsoft account) Application
calendar Calendars.ReadWrite Calendars.ReadWrite Calendars.ReadWrite
contact Contacts.ReadWrite Contacts.ReadWrite Contacts.ReadWrite
contactFolder Contacts.ReadWrite Contacts.ReadWrite Contacts.ReadWrite
event Calendars.ReadWrite Calendars.ReadWrite Calendars.ReadWrite
group calendar Group.ReadWrite.All Not supported. Not supported.
group event Group.ReadWrite.All Not supported. Not supported.
group post Group.ReadWrite.All Not supported. Not supported.
mailFolder Mail.ReadWrite Mail.ReadWrite Mail.ReadWrite
message Mail.ReadWrite Mail.ReadWrite Mail.ReadWrite
Outlook task Tasks.ReadWrite Tasks.ReadWrite Not supported.
Outlook task folder Tasks.ReadWrite Tasks.ReadWrite Not supported.
todoTask Tasks.ReadWrite Not supported. Not supported.
todoTaskList Tasks.ReadWrite Not supported. Not supported.

HTTP request

You can create extended properties in a new or existing resource instance.

To create one or more extended properties in a new resource instance, use the same REST request as creating the instance, and include the properties of the new resource instance and extended property in the request body. Some resources support creation in more than one way. For more information on how to create these resource instances, see the corresponding topics for creating a message, mailFolder, event, calendar, contact, contactFolder, Outlook task, Outlook task folder, group event, group post, and todoTask.

The following is the syntax of the requests.

POST /me/messages
POST /users/{id|userPrincipalName}/messages
POST /me/mailFolders/{id}/messages

POST /me/mailFolders
POST /users/{id|userPrincipalName}/mailFolders

POST /me/events
POST /users/{id|userPrincipalName}/events

POST /me/calendars
POST /users/{id|userPrincipalName}/calendars

POST /me/contacts
POST /users/{id|userPrincipalName}/contacts

POST /me/contactFolders
POST /users/{id|userPrincipalName}/contactFolders

POST /me/outlook/tasks
POST /users/{id|userPrincipalName}/outlook/tasks
POST /me/outlook/taskFolders/{id}/tasks
POST /users/{id|userPrincipalName}/outlook/taskFolders/{id}/tasks
POST /me/outlook/taskGroups/{id}/taskFolders/{id}/tasks
POST /users/{id|userPrincipalName}/outlook/taskGroups/{id}/taskFolders/{id}/tasks

POST /me/outlook/taskFolders
POST /users/{id|userPrincipalName}/outlook/taskFolders
POST /me/outlook/taskGroups/{id}/taskFolders
POST /users/{id|userPrincipalName}/outlook/taskGroups/{id}/taskFolders

POST /me/todo/lists/{todoTaskListId}/tasks/{todoTaskId}?$expand=singleValueExtendedProperties($filter=id eq '{singleValueExtendedPropertyId}')
POST /me/todo/lists/{todoTaskListId}/tasks?$expand=singleValueExtendedProperties($filter=id eq '{singleValueExtendedPropertyId}')

POST /me/todo/lists?$expand=singleValueExtendedProperties($filter=id eq '{singleValueExtendedPropertyId}')

POST /groups/{id}/events

POST /groups/{id}/threads/{id}/posts/{id}/reply
POST /groups/{id}/conversations/{id}/threads/{id}/posts/{id}/reply
POST /groups/{id}/threads/{id}/reply
POST /groups/{id}/conversations/{id}/threads/{id}/reply
POST /groups/{id}/threads
POST /groups/{id}/conversations

[!INCLUDE me-apis-sign-in-note]

To create one or more extended properties in an existing resource instance, specify the instance in the request, and include the extended property in the request body.

Note You can't create an extended property in an existing group post.

PATCH /me/messages/{id}
PATCH /users/{id|userPrincipalName}/messages/{id}
PATCH /me/mailFolders/{id}/messages/{id}

PATCH /me/mailFolders/{id}
PATCH /users/{id|userPrincipalName}/mailFolders/{id}

PATCH /me/events/{id}
PATCH /users/{id|userPrincipalName}/events/{id}

PATCH /me/calendars/{id}
PATCH /users/{id|userPrincipalName}/calendars/{id}

PATCH /me/contacts/{id}
PATCH /users/{id|userPrincipalName}/contacts/{id}

PATCH /me/contactFolders/{id}
PATCH /users/{id|userPrincipalName}/contactFolders/{id}

PATCH /me/outlook/tasks/{id}
PATCH /users/{id|userPrincipalName}/outlook/tasks/{id}
PATCH /me/outlook/taskFolders/{id}/tasks/{id}
PATCH /users/{id|userPrincipalName}/outlook/taskFolders/{id}/tasks/{id}
PATCH /me/outlook/taskGroups/{id}/taskFolders/{id}/tasks/{id}
PATCH /users/{id|userPrincipalName}/outlook/taskGroups/{id}/taskFolders/{id}/tasks/{id}

PATCH /me/outlook/taskFolders/{id}
PATCH /users/{id|userPrincipalName}/outlook/taskFolders/{id}
PATCH /me/outlook/taskGroups/{id}/taskFolders/{id}
PATCH /users/{id|userPrincipalName}/outlook/taskGroups/{id}/taskFolders/{id}

PATCH /me/todo/lists/{todoTaskListId}/tasks?$expand=singleValueExtendedProperties($filter=id eq '{singleValueExtendedPropertyId}')
PATCH /me/todo/lists/{todoTaskListId}/tasks/{todoTaskId}?$expand=singleValueExtendedProperties($filter=id eq '{singleValueExtendedPropertyId}')

PATCH /me/todo/lists/{todoTaskListId}?$expand=singleValueExtendedProperties($filter=id eq '{singleValueExtendedPropertyId}')

PATCH /groups/{id}/events/{id}

[!INCLUDE me-apis-sign-in-note]

Request headers

Name Value
Authorization Bearer {token}. Required. Learn more about authentication and authorization.
Content-Type application/json

Request body

Provide a JSON body of each singleValueLegacyExtendedProperty object in the singleValueExtendedProperties collection property of the resource instance.

Property Type Description
singleValueExtendedProperties singleValueLegacyExtendedProperty collection An array of one or more single-valued extended properties.
id String For each property in the singleValueExtendedProperties collection, specify this to identify the property. It must follow one of the supported formats. For more information, see Extended properties overview. Required.
value string For each property in the singleValueExtendedProperties collection, specify the property value. Required.

When creating an extended property in a new resource instance, in addition to the new singleValueExtendedProperties collection, provide a JSON representation of that resource instance (that is, a message, mailFolder, event, todoTask, etc.)

Response

Response code

An operation that successfully creates an extended property in a new resource instance returns a 201 Created response code. In the case of a new group post, depending on the method used, the operation returns either a 200 OK or a 202 Accepted response code.

In an existing resource instance, a successful create operation returns 200 OK.

Response body

When you create an extended property, the response includes only the new or existing instance but not the new extended property. To see the newly created extended property, get the instance expanded with the extended property.

When you create an extended property in a new group post by replying to a thread or post, the response includes only a response code but not the new post nor the extended property.

Examples

Request 1

The first example creates a new event and a single-value extended property in the same POST operation. Apart from the properties you'd normally include for a new event, the request body includes the singleValueExtendedProperties collection that contains one single-value extended property, and the following for the property:

  • id specifies the property type as String, the GUID, and the property named Fun.
  • value specifies Food as the value of the Fun property.
POST https://graph.microsoft.com/beta/me/events
Content-Type: application/json

{
  "subject": "Celebrate Thanksgiving",
  "body": {
    "contentType": "HTML",
    "content": "Let's get together!"
  },
  "start": {
      "dateTime": "2015-11-26T18:00:00",
      "timeZone": "Pacific Standard Time"
  },
  "end": {
      "dateTime": "2015-11-26T23:00:00",
      "timeZone": "Pacific Standard Time"
  },
  "attendees": [
    {
      "emailAddress": {
        "address": "Terrie@contoso.com",
        "name": "Terrie Barrera"
      },
      "type": "Required"
    }
  ],
  "singleValueExtendedProperties": [
     {
       "id":"String {66f5a359-4659-4830-9070-00040ec6ac6e} Name Fun",
       "value":"Food"
     }
  ]
}

Response 1

A successful response is indicated by an HTTP 201 Created response code, and includes the new event in the response body, similar to the response from creating just an event. The response doesn't include any newly created extended properties.

To see the newly created extended property, get the event expanded with the extended property.


Request 2

The second example creates one single-value extended property for the specified existing message. That extended property is the only element in the singleValueExtendedProperties array. The request body includes the following for the extended property:

  • id specifies the property type as String, the GUID, and the property named Color.
  • value specifies Green as the value of the Color property.
PATCH https://graph.microsoft.com/beta/me/messages('AAMkAGE1M2_bs88AACHsLqWAAA=')

Content-Type: application/json

{
  "singleValueExtendedProperties": [
      {
         "id":"String {66f5a359-4659-4830-9070-00047ec6ac6e} Name Color",
         "value":"Green"
      }
    ]
}

Response 2

A successful response is indicated by an HTTP 200 OK response code, and includes the specified message in the response body, similar to the response from updating a message. The response doesn't include the newly created extended property.

To see the newly created extended property, get the message expanded with the extended property.