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. To determine whether an API is available in v1.0, use the Version selector.
Translate identifiers of Outlook-related resources between formats.
This API is available in the following national cloud deployments.
Global service |
US Government L4 |
US Government L5 (DOD) |
China operated by 21Vianet |
✅ |
❌ |
❌ |
✅ |
Permissions
Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions only if your app requires it. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.
Permission type |
Least privileged permissions |
Higher privileged permissions |
Delegated (work or school account) |
User.ReadBasic.All |
User.Read, User.Read.All, User.ReadWrite, User.ReadWrite.All |
Delegated (personal Microsoft account) |
User.Read |
User.ReadWrite |
Application |
Not supported. |
Not supported. |
HTTP request
POST /me/translateExchangeIds
POST /users/{id|userPrincipalName}/translateExchangeIds
Request body
Parameter |
Type |
Description |
inputIds |
String collection |
A collection of identifiers to convert. All identifiers in the collection MUST have the same source ID type, and MUST be for items in the same mailbox. Maximum size of this collection is 1000 strings. |
sourceIdType |
exchangeIdFormat |
The ID type of the identifiers in the InputIds parameter. |
targetIdType |
exchangeIdFormat |
The requested ID type to convert to. |
Member |
Description |
entryId |
The binary entry ID format used by MAPI clients. |
ewsId |
The ID format used by Exchange Web Services clients. |
immutableEntryId |
The binary MAPI-compatible immutable ID format. |
restId |
The default ID format used by Microsoft Graph. |
restImmutableEntryId |
The immutable ID format used by Microsoft Graph. |
The binary formats (entryId
and immutableEntryId
) are URL-safe base64 encoded. URL-safeness is implemented by modifying the base64 encoding of the binary data in the following way:
- Replace
+
with -
- Replace
/
with _
- Remove any trailing padding characters (
=
)
- Add an integer to the end of the string indicating how many padding characters were in the original (
0
, 1
, or 2
)
Response
If successful, this method returns 200 OK
response code and a convertIdResult collection in the response body.
Example
The following example shows how to convert multiple identifiers from the normal REST API format (restId
) to the REST immutable format (restImmutableEntryId
).
Request
Here is the example request.
POST https://graph.microsoft.com/beta/me/translateExchangeIds
Content-Type: application/json
{
"inputIds" : [
"{rest-formatted-id-1}",
"{rest-formatted-id-2}"
],
"sourceIdType": "restId",
"targetIdType": "restImmutableEntryId"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Me.TranslateExchangeIds;
using Microsoft.Graph.Beta.Models;
var requestBody = new TranslateExchangeIdsPostRequestBody
{
InputIds = new List<string>
{
"{rest-formatted-id-1}",
"{rest-formatted-id-2}",
},
SourceIdType = ExchangeIdFormat.RestId,
TargetIdType = ExchangeIdFormat.RestImmutableEntryId,
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Me.TranslateExchangeIds.PostAsTranslateExchangeIdsPostResponseAsync(requestBody);
mgc-beta users translate-exchange-ids post --user-id {user-id} --body '{\
"inputIds" : [\
"{rest-formatted-id-1}",\
"{rest-formatted-id-2}"\
],\
"sourceIdType": "restId",\
"targetIdType": "restImmutableEntryId"\
}\
'
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
graphusers "github.com/microsoftgraph/msgraph-beta-sdk-go/users"
graphmodels "github.com/microsoftgraph/msgraph-beta-sdk-go/models"
//other-imports
)
requestBody := graphusers.NewItemTranslateExchangeIdsPostRequestBody()
inputIds := []string {
"{rest-formatted-id-1}",
"{rest-formatted-id-2}",
}
requestBody.SetInputIds(inputIds)
sourceIdType := graphmodels.RESTID_EXCHANGEIDFORMAT
requestBody.SetSourceIdType(&sourceIdType)
targetIdType := graphmodels.RESTIMMUTABLEENTRYID_EXCHANGEIDFORMAT
requestBody.SetTargetIdType(&targetIdType)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
translateExchangeIds, err := graphClient.Me().TranslateExchangeIds().PostAsTranslateExchangeIdsPostResponse(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
com.microsoft.graph.beta.users.item.translateexchangeids.TranslateExchangeIdsPostRequestBody translateExchangeIdsPostRequestBody = new com.microsoft.graph.beta.users.item.translateexchangeids.TranslateExchangeIdsPostRequestBody();
LinkedList<String> inputIds = new LinkedList<String>();
inputIds.add("{rest-formatted-id-1}");
inputIds.add("{rest-formatted-id-2}");
translateExchangeIdsPostRequestBody.setInputIds(inputIds);
translateExchangeIdsPostRequestBody.setSourceIdType(ExchangeIdFormat.RestId);
translateExchangeIdsPostRequestBody.setTargetIdType(ExchangeIdFormat.RestImmutableEntryId);
var result = graphClient.me().translateExchangeIds().post(translateExchangeIdsPostRequestBody);
const options = {
authProvider,
};
const client = Client.init(options);
const convertIdResult = {
inputIds: [
'{rest-formatted-id-1}',
'{rest-formatted-id-2}'
],
sourceIdType: 'restId',
targetIdType: 'restImmutableEntryId'
};
await client.api('/me/translateExchangeIds')
.version('beta')
.post(convertIdResult);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Users\Item\TranslateExchangeIds\TranslateExchangeIdsPostRequestBody;
use Microsoft\Graph\Beta\Generated\Models\ExchangeIdFormat;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new TranslateExchangeIdsPostRequestBody();
$requestBody->setInputIds(['{rest-formatted-id-1}', '{rest-formatted-id-2}', ]);
$requestBody->setSourceIdType(new ExchangeIdFormat('restId'));
$requestBody->setTargetIdType(new ExchangeIdFormat('restImmutableEntryId'));
$result = $graphServiceClient->me()->translateExchangeIds()->post($requestBody)->wait();
Import-Module Microsoft.Graph.Beta.Users.Actions
$params = @{
inputIds = @(
'{rest-formatted-id-1}'
'{rest-formatted-id-2}'
)
sourceIdType = "restId"
targetIdType = "restImmutableEntryId"
}
# A UPN can also be used as -UserId.
Invoke-MgBetaTranslateUserExchangeId -UserId $userId -BodyParameter $params
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.users.item.translate_exchange_ids.translate_exchange_ids_post_request_body import TranslateExchangeIdsPostRequestBody
from msgraph_beta.generated.models.exchange_id_format import ExchangeIdFormat
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = TranslateExchangeIdsPostRequestBody(
input_ids = [
"{rest-formatted-id-1}",
"{rest-formatted-id-2}",
],
source_id_type = ExchangeIdFormat.RestId,
target_id_type = ExchangeIdFormat.RestImmutableEntryId,
)
result = await graph_client.me.translate_exchange_ids.post(request_body)
Response
Here is the example response
HTTP/1.1 200 OK
Content-type: application/json
{
"value": [
{
"sourceId": "{rest-formatted-id-1}",
"targetId": "{rest-immutable-formatted-id-1}"
},
{
"sourceId": "{rest-formatted-id-2}",
"targetId": "{rest-immutable-formatted-id-2}"
}
]
}