Espace de noms: microsoft.graph
Traduit les identificateurs des ressources Outlook entre les formats.
Cette API est disponible dans les déploiements de cloud national suivants.
| Service global |
Gouvernement des États-Unis L4 |
Us Government L5 (DOD) |
Chine gérée par 21Vianet |
| ✅ |
❌ |
❌ |
✅ |
Autorisations
Choisissez l’autorisation ou les autorisations marquées comme moins privilégiées pour cette API. Utilisez une autorisation ou des autorisations privilégiées plus élevées uniquement si votre application en a besoin. Pour plus d’informations sur les autorisations déléguées et d’application, consultez Types d’autorisations. Pour en savoir plus sur ces autorisations, consultez les informations de référence sur les autorisations.
| Type d’autorisation |
Autorisations avec privilèges minimum |
Autorisations privilégiées plus élevées |
| Déléguée (compte professionnel ou scolaire) |
User.ReadBasic.All |
AgentIdUser.ReadWrite.All, AgentIdUser.ReadWrite.IdentityParentedBy, User.Read, User.Read.All, User.ReadWrite, User.ReadWrite.All |
| Déléguée (compte Microsoft personnel) |
User.Read |
User.ReadWrite |
| Application |
Non prise en charge. |
Non prise en charge. |
Requête HTTP
POST /me/translateExchangeIds
POST /users/{id|userPrincipalName}/translateExchangeIds
Corps de la demande
| Paramètre |
Type |
Description |
| inputIds |
Collection de chaînes |
Collection d’identificateurs à convertir. Tous les identificateurs de la collection DOIVENT avoir le même type d’ID source et doivent être pour les éléments de la même boîte aux lettres. La taille maximale de cette collection est de 1 000 chaînes. |
| sourceIdType |
exchangeIdFormat |
Type d’ID des identificateurs dans le InputIds paramètre . |
| targetIdType |
exchangeIdFormat |
Type d’ID demandé vers lequel effectuer la conversion. |
| Member |
Description |
| entryId |
Format d’ID d’entrée binaire utilisé par les clients MAPI. |
| ewsId |
Format d’ID utilisé par les clients des services Web Exchange. |
| immutableEntryId |
Format d’ID immuable compatible MAPI binaire. |
| restId |
Format d’ID par défaut utilisé par Microsoft Graph. |
| restImmutableEntryId |
Format d’ID immuable utilisé par Microsoft Graph. |
Les formats binaires (entryId et immutableEntryId) sont codés en base64 sécurisé par URL. La sécurité des URL est implémentée en modifiant l’encodage base64 des données binaires de la manière suivante :
- Remplacer
+ par -
- Remplacer
/ par _
- Supprimer les caractères de remplissage de fin (
=)
- Ajoutez un entier à la fin de la chaîne indiquant le nombre de caractères de remplissage dans l’original (
0, 1, ou 2)
Réponse
Si elle réussit, cette méthode renvoie 200 OK le code de réponse et une collection convertIdResult dans le corps de la réponse.
Exemple
L’exemple suivant montre comment convertir plusieurs identificateurs du format normal de l’API REST (restId) au format immuable REST (restImmutableEntryId).
Demande
Voici l’exemple de demande.
POST https://graph.microsoft.com/v1.0/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.Me.TranslateExchangeIds;
using Microsoft.Graph.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);
Pour plus d’informations sur la façon d'ajouter le Kit de développement logiciel (SDK) à votre projet et créer une instance authProvider, consultez la documentation du Kit de développement logiciel (SDK).
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphusers "github.com/microsoftgraph/msgraph-sdk-go/users"
graphmodels "github.com/microsoftgraph/msgraph-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)
Pour plus d’informations sur la façon d'ajouter le Kit de développement logiciel (SDK) à votre projet et créer une instance authProvider, consultez la documentation du Kit de développement logiciel (SDK).
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
com.microsoft.graph.users.item.translateexchangeids.TranslateExchangeIdsPostRequestBody translateExchangeIdsPostRequestBody = new com.microsoft.graph.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);
Pour plus d’informations sur la façon d'ajouter le Kit de développement logiciel (SDK) à votre projet et créer une instance authProvider, consultez la documentation du Kit de développement logiciel (SDK).
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Users\Item\TranslateExchangeIds\TranslateExchangeIdsPostRequestBody;
use Microsoft\Graph\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();
Pour plus d’informations sur la façon d'ajouter le Kit de développement logiciel (SDK) à votre projet et créer une instance authProvider, consultez la documentation du Kit de développement logiciel (SDK).
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.users.item.translate_exchange_ids.translate_exchange_ids_post_request_body import TranslateExchangeIdsPostRequestBody
from msgraph.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)
Pour plus d’informations sur la façon d'ajouter le Kit de développement logiciel (SDK) à votre projet et créer une instance authProvider, consultez la documentation du Kit de développement logiciel (SDK).
Réponse
Voici l’exemple de réponse
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}"
}
]
}