다음을 통해 공유


[DEPRECATED] Outlook Contacts REST API reference (beta)

Applies to: Exchange Online | Office 365 | Hotmail.com | Live.com | MSN.com | Outlook.com | Passport.com

Note

The beta version of the Outlook REST API is deprecated.

As announced on November 17, 2020, version 2.0 of the Outlook REST API has been deprecated. Consequently, the beta REST endpoint is also deprecated and will be fully decommissioned in November 2022. Migrate existing apps to use Microsoft Graph. See a comparison to start your migration.

The Outlook Contacts API provides access to a user's contacts and contact folders secured by Azure Active Directory on Office 365, and to similar data in Microsoft accounts specifically in these domains: Hotmail.com, Live.com, MSN.com, Outlook.com, and Passport.com.

Note

For simplicity of reference, the rest of this article uses Outlook.com to include these Microsoft account domains.

Not interested in the beta version of the API? In the table of contents on the left, go to the Office 365 REST API reference section and select the version you want.

All Contacts API operations

Contact operations

Contacts are stored in contact folders. You can get, create, change, and delete contacts.

Contact folder operations

Contact folders can contain contacts and other contact folders. You can get contact folders and create contacts in a contact folder.

Contact photo operations

Each contact can have an optional contact picture. You can get or set a photo for a contact.

See also

Using the Contacts REST API

Authentication

Like other Outlook REST API, for every request to the Contacts API, you should include a valid access token. Getting an access token requires you to have registered and identified your app, and obtained the appropriate authorization.

You can find out more about some streamlined registration and authorization options for you. Keep this in mind as you proceed with the specific operations in the Contacts API.

Version of API

The Contacts REST API is supported in all versions of the Outlook REST API. The functionality may differ depending on the specific version.

Target user

The Contacts API requests are always performed on behalf of the current user.

See Use the Outlook REST API for more information common to all subsets of the Outlook REST API.

Get contacts

You can get a contact collection or an individual contact from a contact folder.

Minimum required scope

One of the following:

Get a contact collection

Get all the contacts in the signed-in user's mailbox (.../me/contacts), or from the specified contact folder.

GET https://outlook.office.com/api/beta/me/contacts
GET https://outlook.office.com/api/beta/me/contactfolders/{contact_folder_id}/contacts
Required parameter Type Description
URL parameters
contact_folder_id string The contact folder ID, if you're getting contacts from a specific folder.

Note

By default, each contact in the response includes all its properties. Use $select to specify only those properties you need for best performance. The Id property is always returned. See OData query parameters for filtering, sorting, and paging parameters.

Sample request

GET https://outlook.office.com/api/beta/me/contacts?$select=EmailAddresses,GivenName,Surname

Sample response

Status code: 200

{
    "@odata.context": "https://outlook.office.com/api/beta/$metadata#Me/Contacts(EmailAddresses,GivenName,Surname)",
    "value": [
        {
            "@odata.id": "https://outlook.office.com/api/beta/Users('ddfcd489-628b-40d7-b48b-57002df800e5@1717622f-1d94-4d0c-9d74-709fad664b77')/Contacts('AAMkAGI2THk3AAA=')",
            "@odata.etag": "W/\"EQAAABYAAACd9nJ/tVysQos2hTfspaWRAAADTIa7\"",
            "Id": "AAMkAGI2THk3AAA=",
            "GivenName": "Rob",
            "Surname": "Young",
            "EmailAddresses": [
                {
                    "Name": "roby@a830edad9050849NDA1.onmicrosoft.com",
                    "Address": "roby@a830edad9050849NDA1.onmicrosoft.com"
                }
            ]
        },
        {
            "@odata.id": "https://outlook.office.com/api/beta/Users('ddfcd489-628b-40d7-b48b-57002df800e5@1717622f-1d94-4d0c-9d74-709fad664b77')/Contacts('AAMkAGI2THkzAAA=')",
            "@odata.etag": "W/\"EQAAABYAAACd9nJ/tVysQos2hTfspaWRAAADTIa3\"",
            "Id": "AAMkAGI2THkzAAA=",
            "GivenName": "Janet",
            "Surname": "Schorr",
            "EmailAddresses": [
                {
                    "Name": "janets@a830edad9050849NDA1.onmicrosoft.com",
                    "Address": "janets@a830edad9050849NDA1.onmicrosoft.com"
                }
            ]
        }
    ]
}

Response type

The requested contact collection.

Get a contact

Minimum required scope

One of the following:

Get a contact by using the contact ID.

GET https://outlook.office.com/api/beta/me/contacts/{contact_id}
Required parameter Type Description
URL parameters
contact_id string The contact ID.

Response type

The requested contact.

Sample request

GET https://outlook.office.com/api/beta/me/contacts/AAMkADlkAAAMRFUEAAA=

Sample response

Status code: 200

{
    "@odata.context":"https://outlook.office365.com/api/beta/$metadata#Me/Contacts/$entity",
    "@odata.id":"https://outlook.office365.com/api/beta/Users('af183ae6-7efa-41e4-aa87-fe8790598625@9ac5b33f-49cf-45f7-9ef1-b581dce364d8')/Contacts('AAMkADlkAAAMRFUEAAA=')",
    "@odata.etag":"W/\"EQAAABYAAADDii8zlkFETIcBiRn8yAbgAAAMRdhl\"",
    "Id":"AAMkADlkAAAMRFUEAAA=",
    "CreatedDateTime":"2016-07-16T06:43:15Z",
    "LastModifiedDateTime":"2016-07-16T06:43:15Z",
    "ChangeKey":"EQAAABYAAADDii8zlkFETIcBiRn8yAbgAAAMRdhl",
    "Categories":[
    ],
    "ParentFolderId":"AAMkADlk8yAbgAAAAAAEkAAA=",
    "Birthday":null,
    "FileAs":"",
    "DisplayName":"Garret Vargas",
    "GivenName":"Garret",
    "Initials":null,
    "MiddleName":null,
    "NickName":null,
    "Surname":"Vargas",
    "Title":null,
    "YomiGivenName":null,
    "YomiSurname":null,
    "YomiCompanyName":null,
    "Generation":null,
    "EmailAddresses":[
        {
            "Name":"Garret Vargas",
            "Address":"GarretV@contoso.onmicrosoft.com"
        }
    ],
    "Websites":[
    ],
    "ImAddresses":[
        "sip:garretv@contoso.onmicrosoft.com"
    ],
    "JobTitle":"CVP Operations",
    "CompanyName":"",
    "Department":"Operations",
    "OfficeLocation":"36/2121",
    "Profession":null,
    "AssistantName":null,
    "Manager":null,
    "Phones":[
        {
            "Type":"Home",
            "Number":""
        },
        {
            "Type":"Business",
            "Number":"+1 206 555 0105"
        },
        {
            "Type":"Mobile",
            "Number":""
        }
    ],
    "PostalAddresses":[
        {
            "Type":"Business",
            "City":"Seattle"
        }
    ],
    "SpouseName":null,
    "PersonalNotes":null,
    "Children":[
    ],
    "Gender":null,
    "IsFavorite":null,
    "Flag":{
        "FlagStatus":"NotFlagged"
    }
}

Note

By default, the response includes all the properties of the contact. Use $select to specify only those properties you need for best performance. The Id property is always returned. See OData query parameters for filtering, sorting, and paging parameters.

The following example shows how to use $select to specify returning only the EmailAddresses, GivenName, and Surname properties of the contact in the response.

Sample request

GET https://outlook.office.com/api/beta/me/contacts/AAMkAGI2THk0AAA=?$select=EmailAddresses,GivenName,Surname

Sample response

Status code: 200

{
    "@odata.context": "https://outlook.office.com/api/beta/$metadata#Me/Contacts(EmailAddresses,GivenName,Surname)/$entity",
    "@odata.id": "https://outlook.office.com/api/beta/Users('af183ae6-7efa-41e4-aa87-fe8790598625@9ac5b33f-49cf-45f7-9ef1-b581dce364d8')/Contacts('AAMkADlkAAAMRFUEAAA=')",
    "@odata.etag": "W/\"EQAAABYAAACd9nJ/tVysQos2hTfspaWRAAADTIa4\"",
    "Id": "AAMkADlkAAAMRFUEAAA=",
    "GivenName": "Garth",
    "Surname": "Vargas",
    "EmailAddresses": [
       {
            "Name":"Garret Vargas",
            "Address":"GarretV@contoso.onmicrosoft.com"
        }
    ]
}

Synchronize contacts and contact folders

You can synchronize your local list of contacts with the contacts on the server. Contacts synchronization is a per-folder operation, for example you can synchronize all of the contacts in your root Contacts folder. If you have additonal Contacts folders, you need to synchronize each folder individually.

Synchronization only supports full synchronization; all contacts in the specified folder are returned with each request.

Synchronizing a contacts folder typically requires two or more GET requests. You make the GET request much like the way you get contacts, except that you add the following request headers.

  • You must specify the Prefer: odata.track-changes header in all of your sync requests.

  • You may specify the Prefer: odata.maxpages={n} header to set the maximum number of contacts returned in each request.

    The second and subsequent GET requests differ from the first GET request by including either a deltaToken or a skipToken received in a previous response.

    The initial response to a sync request always returns a deltaToken. You should always make a second GET request using the deltaToken to determine if there are any additional contacts. The second request will return additional contacts and either a skipToken if there are more contacts available, or a deltaToken if the last contact was sent.

Minimum required scope

One of the following:

GET https://outlook.office.com/api/beta/me/Contacts
GET https://outlook.office.com/api/beta/me/ContactFolders/{folderName}
Required parameter Type Description
Header parameters
Prefer odata.track-changes Indicates that the request is a synchronization request.
Prefer odata.maxpagesize Sets the number of contacts returned in each response.
URL parameter
folderName string The name of the folder to synchronize.
odata.deltaLink String The token that indicates the last time that the folder was synchronized.
odata.skiptoken String The token that indicates that there are more messages to download.

Response type

A collection containing the requested contacts and a deltaToken that you use to request additional pages of contact data from server and to request an incremental synchronization. If the number of contacts returned is more than the value specified in the odata.maxpagesize header the response will be returned in multiple pages.

The response will include a Preference-Applied: odata-trackchanges header. If you attempt to sync a resource that is not supported, this header will not be returned in the response. Check for this header before processing the response to avoid errors.

Note

By default, the response includes all of the properties of the specified contacts. Use $select to specify only the properties that your need for best performance. The Id property is always returned. Do not use $filter, $orderby, $search or $top as they are not supported for synchronizing contacts or contact folders. See OData query parameters for further details.

Examples

Inital request for a full synchronization:

GET https://outlook.office.com/api/beta/Me/Contacts

Include the following headers:

  • Prefer: odata.track-changes
  • Prefer: odata.maxpagesize=100

Second request to the server after a full synchronization request:

https://outlook.office.com/api/beta/Me/Contacts/?%24deltatoken=169ca50467d34d9fb8adb664961b9836

Include the following headers:

  • Prefer: odata.track-changes
  • Prefer: odata.maxpagesize=100

Second response from the server with additional pages available:

Header

Preference-Applied: odata.track-changes

Body

@odata.deltaLink=https://outlook.office.com/api/beta/me/Contacts/messages/?%24skiptoken=169ca50467d34d9fb8adb664961b9836

Payload messages


Second or subsequent response from the server when all contacts have been sent:

Header

Preference-Applied: odata.track-changes

Body

@odata.deltaLink=https://outlook.office.com/api/beta/me/Contacts/?%24deltatoken=169ca50467d34d9fb8adb664961b9836

Payload messages


Request to server when additional pages are available:

https://outlook.office.com/api/beta/Me/Contacts/?%24skiptoken=169ca50467d34d9fb8adb664961b9836

Include the following headers:

  • Prefer: odata.track-changes
  • Prefer: odata.maxpagesize=100

Create contacts

Create a contact in the specified Contacts folder.

Create a contact

Create a contact

Minimum required scope

One of the following:

Add a contact to the root Contacts folder or to the contacts endpoint of another contact folder.

POST https://outlook.office.com/api/beta/me/contacts
POST https://outlook.office.com/api/beta/me/contactfolders/{contact_folder_id}/contacts
Required parameter Type Description
URL parameters
contact_folder_id string The contact folder ID, if you're creating a contact in a specific contact folder.
Body parameters
GivenName string The given name of the contact.

Specify the GivenName parameter and any writable contact properties in the request body.

Sample request

POST https://outlook.office.com/api/beta/me/contacts
Content-Type: application/json

{
  "GivenName": "Pavel",
  "Surname": "Bansky",
  "EmailAddresses": [
    {
      "Address": "pavelb@contoso.onmicrosoft.com",
      "Name": "Pavel Bansky"
    }
  ],
  "Phones": [
    {
      "Type": "Business",
      "Number": "+1 732 555 0102"
    }
  ]
}

Sample response

Status code: 201

{
  "@odata.context":"https://outlook.office365.com/api/beta/$metadata#Me/Contacts/$entity",
  "@odata.id":"https://outlook.office365.com/api/beta/Users('af183ae6-7efa-41e4-aa87-fe8790598625@9ac5b33f-49cf-45f7-9ef1-b581dce364d8')/Contacts('AAMkADlkAAARKMK7AAA=')",
  "@odata.etag":"W/\"EQAAABYAAADDii8zlkFETIcBiRn8yAbgAAARKpia\"",
  "Id":"AAMkADlkAAARKMK7AAA=",
  "CreatedDateTime":"2016-07-20T23:59:37Z",
  "LastModifiedDateTime":"2016-07-20T23:59:38Z",
  "ChangeKey":"EQAAABYAAADDii8zlkFETIcBiRn8yAbgAAARKpia",
  "Categories":[
  ],
  "ParentFolderId":"AAMkADlk8yAbgAAAAAAEOAAA=",
  "Birthday":null,
  "FileAs":"",
  "DisplayName":"Pavel Bansky",
  "GivenName":"Pavel",
  "Initials":null,
  "MiddleName":null,
  "NickName":null,
  "Surname":"Bansky",
  "Title":null,
  "YomiGivenName":null,
  "YomiSurname":null,
  "YomiCompanyName":null,
  "Generation":null,
  "EmailAddresses":[
    {
      "Name":"Pavel Bansky",
      "Address":"pavelb@contoso.onmicrosoft.com"
    }
  ],
  "Websites":[
  ],
  "ImAddresses":[
  ],
  "JobTitle":null,
  "CompanyName":null,
  "Department":null,
  "OfficeLocation":null,
  "Profession":null,
  "AssistantName":null,
  "Manager":null,
  "Phones":[
    {
      "Type":"Business",
      "Number":"+1 732 555 0102"
    }
  ],
  "PostalAddresses":[
  ],
  "SpouseName":null,
  "PersonalNotes":null,
  "Children":[
  ],
  "Gender":null,
  "IsFavorite":null,
  "Flag":{
    "FlagStatus":"NotFlagged"
  }
}

Response type

The new contact.

Update contacts

Change a contact's properties.

Update a contact

Minimum required scope

One of the following:

Specify any writable contact properties in the request body. Only the properties that you specify are changed.

PATCH https://outlook.office.com/api/beta/me/contacts/{contact_id}
Required parameter Type Description
URL parameters
contact_id string The contact ID.

Sample request

The following example sets the contact postal address and a follow up flag.

Note

When the Flag.FlagStatus is set to Flagged, a Flag.CompletedDate cannot be set.

PATCH https://outlook.office.com/api/beta/me/contacts/AAMkADlkAAARKMK7AAA=
Content-Type: application/json

{
  "PostalAddresses": [
    {
      "Type": "Business",
      "Street": "Some street",
      "City": "Seattle",
      "State": "WA",
      "PostalCode": "98121"
    }
  ],
  "Birthday": "1974-07-22",
  "Flag": {
    "FlagStatus": "Flagged",
       "DueDateTime": {
            "DateTime": "2017-12-22T08:00:00.0000000",
            "TimeZone": "UTC"
        },
        "StartDateTime": {
            "DateTime": "2017-12-18T08:00:00.0000000",
            "TimeZone": "UTC"
        }
    }
}

Sample response

Status code: 200

{
  "@odata.context":"https://outlook.office365.com/api/beta/$metadata#Me/Contacts/$entity",
  "@odata.id":"https://outlook.office365.com/api/beta/Users('af183ae6-7efa-41e4-aa87-fe8790598625@9ac5b33f-49cf-45f7-9ef1-b581dce364d8')/Contacts('AAMkADlkAAARKMK7AAA=')",
  "@odata.etag":"W/\"EQAAABYAAADDii8zlkFETIcBiRn8yAbgAAARKpia\"",
  "Id":"AAMkADlkAAARKMK7AAA=",
  "CreatedDateTime":"2016-07-20T23:59:37Z",
  "LastModifiedDateTime":"2016-07-20T23:59:38Z",
  "ChangeKey":"EQAAABYAAADDii8zlkFETIcBiRn8yAbgAAARKpia",
  "Categories":[
  ],
  "ParentFolderId":"AAMkADlk8yAbgAAAAAAEOAAA=",
  "Birthday":"1974-07-22T00:00:00Z",
  "FileAs":"",
  "DisplayName":"Pavel Bansky",
  "GivenName":"Pavel",
  "Initials":null,
  "MiddleName":null,
  "NickName":null,
  "Surname":"Bansky",
  "Title":null,
  "YomiGivenName":null,
  "YomiSurname":null,
  "YomiCompanyName":null,
  "Generation":null,
  "EmailAddresses":[
    {
      "Name":"Pavel Bansky",
      "Address":"pavelb@contoso.onmicrosoft.com"
    }
  ],
  "Websites":[
  ],
  "ImAddresses":[
  ],
  "JobTitle":null,
  "CompanyName":null,
  "Department":null,
  "OfficeLocation":null,
  "Profession":null,
  "AssistantName":null,
  "Manager":null,
  "Phones":[
    {
      "Type":"Business",
      "Number":"+1 732 555 0102"
    }
  ],
  "PostalAddresses":[
    {
      "Type": "Business",
      "Street": "Some street",
      "City": "Seattle",
      "State": "WA",
      "PostalCode": "98121"
    }
  ],
  "SpouseName":null,
  "PersonalNotes":null,
  "Children":[
  ],
  "Gender":null,
  "IsFavorite":null,
  "Flag": {
        "FlagStatus": "Flagged",
        "DueDateTime": {
            "DateTime": "2017-12-22T08:00:00.0000000",
            "TimeZone": "UTC"
        },
        "StartDateTime": {
            "DateTime": "2017-12-18T08:00:00.0000000",
            "TimeZone": "UTC"
        }
  }
}

Sample request

The following example sets a previously flagged contact to Complete.

PATCH https://outlook.office.com/api/beta/me/contacts/AAMkADlkAAARKMK7AAA=
Content-Type: application/json

{
  "Flag": {
    "CompletedDateTime":{
      "DateTime": "2018-02-05T18:00:00",
      "TimeZone": "Pacific Standard Time"
    },
    "FlagStatus": "Complete"
  }
}

Sample response

Status code: 200

{
  "@odata.context":"https://outlook.office365.com/api/beta/$metadata#Me/Contacts/$entity",
  "@odata.id":"https://outlook.office365.com/api/beta/Users('af183ae6-7efa-41e4-aa87-fe8790598625@9ac5b33f-49cf-45f7-9ef1-b581dce364d8')/Contacts('AAMkADlkAAARKMK7AAA=')",
  "@odata.etag":"W/\"EQAAABYAAADDii8zlkFETIcBiRn8yAbgAAARKpia\"",
  "Id":"AAMkADlkAAARKMK7AAA=",
  "CreatedDateTime":"2016-07-20T23:59:37Z",
  "LastModifiedDateTime":"2016-07-20T23:59:38Z",
  "ChangeKey":"EQAAABYAAABmngqUDhbeSLkRkXbBznTvAAEw/xwn",
  "Categories":[
  ],
  "ParentFolderId":"AAMkADlk8yAbgAAAAAAEOAAA=",
  "Birthday":"1974-07-22T00:00:00Z",
  "FileAs":"",
  "DisplayName":"Pavel Bansky",
  "GivenName":"Pavel",
  "Initials":null,
  "MiddleName":null,
  "NickName":null,
  "Surname":"Bansky",
  "Title":null,
  "YomiGivenName":null,
  "YomiSurname":null,
  "YomiCompanyName":null,
  "Generation":null,
  "EmailAddresses":[
    {
      "Name":"Pavel Bansky",
      "Address":"pavelb@contoso.onmicrosoft.com"
    }
  ],
  "Websites":[
  ],
  "ImAddresses":[
  ],
  "JobTitle":null,
  "CompanyName":null,
  "Department":null,
  "OfficeLocation":null,
  "Profession":null,
  "AssistantName":null,
  "Manager":null,
  "Phones":[
    {
      "Type":"Business",
      "Number":"+1 732 555 0102"
    }
  ],
  "PostalAddresses":[
    {
      "Type": "Business",
      "Street": "Some street",
      "City": "Seattle",
      "State": "WA",
      "PostalCode": "98121"
    }
  ],
  "SpouseName":null,
  "PersonalNotes":null,
  "Children":[
  ],
  "Gender":null,
  "IsFavorite":null,
  "Flag": {
    "FlagStatus": "Complete",
    "CompletedDateTime": {
        "DateTime": "2018-02-06T00:00:00.0000000",
        "TimeZone": "UTC"
    }
  }
}

Response type

The updated contact.

Delete contacts

Delete a contact. Deleted contents might not be recoverable.

To learn more, see Deleting items by using EWS in Exchange.

Delete a contact

Minimum required scope

One of the following:

DELETE https://outlook.office.com/api/beta/me/contacts/{contact_id}
Required parameter Type Description
URL parameters
contact_id string The contact ID.

Sample request

DELETE https://outlook.office.com/api/beta/me/contacts/AAMkAGE0Myy2hAAA=

Sample response

Status code: 204

Get contact folders

You can get a contact folder collection or get a contact folder.

Get a contact folder collection

Minimum required scope

One of the following:

Get all the contact folders in the signed-in user's mailbox (.../me/contactfolders), or under the specified contact folder.

GET https://outlook.office.com/api/beta/me/contactfolders
GET https://outlook.office.com/api/beta/me/contactfolders/{contact_folder_id}/childfolders

Note

See OData query parameters for filtering, sorting, and paging parameters.

Required parameter Type Description
URL parameters
contact_folder_id string The contact folder ID, if you're getting contact folders from a specific contact folder.

Sample request

GET https://outlook.office.com/api/beta/me/contactfolders

Sample response

Status code: 200

{
    "@odata.context": "https://outlook.office.com/api/beta/$metadata#Me/ContactFolders",
    "value": [
        {
            "@odata.id": "https://outlook.office.com/api/beta/Users('ddfcd489-628b-40d7-b48b-57002df800e5@1717622f-1d94-4d0c-9d74-709fad664b77')/ContactFolders('AAMkAGI2TKI5AAA=')",
            "Id": "AAMkAGI2TKI5AAA=",
            "ParentFolderId": "AAMkAGI2AAEOAAA=",
            "DisplayName": "Finance",
            "WellKnownName": null
        },
        {
            "@odata.id": "https://outlook.office.com/api/beta/Users('ddfcd489-628b-40d7-b48b-57002df800e5@1717622f-1d94-4d0c-9d74-709fad664b77')/ContactFolders('AQMkADA1MTgAAAA==')",
            "Id": "AQMkADA1MTgAAAA==",
            "ParentFolderId": "AAMkAGI2AAEOAAA=",
            "DisplayName": "Contacts",
            "WellKnownName": "contacts"
        }
    ]
}

Response type

The requested contact folder collection.

Get a contact folder

Minimum required scope

One of the following:

Get a contact folder by using the contact folder ID.

GET https://outlook.office.com/api/beta/me/contactfolders/{contact_folder_id}

Note

See OData query parameters for filtering, sorting, and paging parameters.

Required parameter Type Description
URL parameters
contact_folder_id string The contact folder ID.

Sample request

GET https://outlook.office.com/api/beta/me/contactfolders/AAMkAGI2TKI5AAA=

Sample response

Status code: 200

{
    "@odata.context": "https://outlook.office.com/api/beta/$metadata#Me/ContactFolders/$entity",
    "@odata.id": "https://outlook.office.com/api/beta/Users('ddfcd489-628b-40d7-b48b-57002df800e5@1717622f-1d94-4d0c-9d74-709fad664b77')/ContactFolders('AAMkAGI2TKI5AAA=')",
    "Id": "AAMkAGI2TKI5AAA=",
    "ParentFolderId": "AAMkAGI2AAEOAAA=",
    "DisplayName": "Finance",
    "WellKnownName": null
}

Response type

The requested contact folder.

Get contact photo and metadata

Get contact photo

Minimum required scope

One of the following:

Get the photo of the specified signed-in user's contact.

GET https://outlook.office.com/api/beta/me/contacts('{contact_id}')/photo/$value
Required parameter Type Description
URL parameters
contact_id string The ID specifying the particular contact of the signed-in user's.

Sample request

GET https://outlook.office.com/api/beta/me/contacts('AAMkAGE1M2IyNGNm===')/photo/$value
Content-Type: image/jpg

Response data

Contains the binary data of the requested photo. The HTTP response code is 200.

The operation returns HTTP 404 if the contact does not already have a contact photo on Exchange Online.

Get contact photo metadata

Minimum required scope

One of the following:

Get the metadata of a contact photo, which includes the content type, width and height in pixels.

GET https://outlook.office.com/api/beta/me/contacts('{contact_id}')/photo
Required parameter Type Description
URL parameters
contact_id string The ID specifying the particular contact of the signed-in user's.

Sample request

GET https://outlook.office.com/api/beta/me/contacts('AAMkAGE1M2IyNGNm')/photo

Sample response data

A successful request returns HTTP 200.

{
    "@odata.context": "https://outlook.office.com/api/beta/$metadata#Me/Contacts('AAMkAGE1M2IyNGNm')/photo/$entity",
    "@odata.id": "https://outlook.office.com/api/beta/Users('ddfcd489-b826-40d7-b48b-57002df800e5@1717622f-49d1-4d0c-9d74-709fad664b77')/contacts('AAMkAGE1M2IyNGNm')/photo",
    "@odata.readLink": "https://outlook.office.com/api/beta/Users('ddfcd489-b826-40d7-b48b-57002df800e5@1717622f-49d1-4d0c-9d74-709fad664b77')/contacts('AAMkAGE1M2IyNGNm')/photo",
    "@odata.mediaContentType": "image/jpeg",
    "Id": "103X77",
    "Width": 103,
    "Height": 77
}

Set contact photo

Minimum required scope

One of the following:

Assign a photo to the specified signed-in user's contact. The photo should be in binary. It replaces any existing photo for that contact.

Use only PUT for this operation in the beta version.

PUT https://outlook.office.com/api/beta/me/contacts('{contact_id}')/photo/$value
Required parameter Type Description
URL parameters
contact_id string The ID specifying the particular contact of the signed-in user's.

Sample request

PUT https://outlook.office.com/api/beta/me/contacts('AAMkAGE1M2IyNGNm===')/photo/$value
Content-Type: image/jpeg

Include the binary data of the photo in the request body.

Response data

A successful request returns HTTP 200.

Next steps

Whether you're ready to start building an app or just want to learn more, we've got you covered.

Or, learn more about using the Office 365 platform: