Les API sous la version /beta dans Microsoft Graph sont susceptibles d’être modifiées. L’utilisation de ces API dans des applications de production n’est pas prise en charge. Pour déterminer si une API est disponible dans v1.0, utilisez le sélecteur Version .
Convertir un utilisateur authentifié en externe en utilisateur interne. L’utilisateur peut se connecter au locataire hôte en tant qu’utilisateur interne et accéder aux ressources en tant que membre. Pour plus d’informations sur cette conversion, consultez Convertir des utilisateurs externes en utilisateurs internes.
Dans les scénarios délégués avec des comptes professionnels ou scolaires, l’utilisateur connecté doit se voir attribuer un rôle Microsoft Entra pris en charge ou un rôle personnalisé avec une autorisation de rôle prise en charge.
Administrateur d’utilisateurs est le rôle le moins privilégié pris en charge pour cette opération.
Requête HTTP
POST /users/{usersId}/convertExternalToInternalMemberUser
Obligatoire pour les utilisateurs dont l’authentification est gérée dans le cloud.
userPrincipalName
String
Obligatoire pour que les utilisateurs du cloud modifient le userPrincipalName. Non obligatoire pour les utilisateurs synchronisés locaux, car leur userPrincipalName est géré localement.
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Users.Item.ConvertExternalToInternalMemberUser;
using Microsoft.Graph.Beta.Models;
var requestBody = new ConvertExternalToInternalMemberUserPostRequestBody
{
UserPrincipalName = "AdeleVance@contoso.com",
PasswordProfile = new PasswordProfile
{
Password = "Zdi087#2jhkahf",
ForceChangePasswordNextSignIn = true,
},
};
// To initialize your graphClient, see https://video2.skills-academy.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Users["{user-id}"].ConvertExternalToInternalMemberUser.PostAsync(requestBody);
// 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.NewConvertExternalToInternalMemberUserPostRequestBody()
userPrincipalName := "AdeleVance@contoso.com"
requestBody.SetUserPrincipalName(&userPrincipalName)
passwordProfile := graphmodels.NewPasswordProfile()
password := "Zdi087#2jhkahf"
passwordProfile.SetPassword(&password)
forceChangePasswordNextSignIn := true
passwordProfile.SetForceChangePasswordNextSignIn(&forceChangePasswordNextSignIn)
requestBody.SetPasswordProfile(passwordProfile)
// To initialize your graphClient, see https://video2.skills-academy.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
convertExternalToInternalMemberUser, err := graphClient.Users().ByUserId("user-id").ConvertExternalToInternalMemberUser().Post(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.convertexternaltointernalmemberuser.ConvertExternalToInternalMemberUserPostRequestBody convertExternalToInternalMemberUserPostRequestBody = new com.microsoft.graph.beta.users.item.convertexternaltointernalmemberuser.ConvertExternalToInternalMemberUserPostRequestBody();
convertExternalToInternalMemberUserPostRequestBody.setUserPrincipalName("AdeleVance@contoso.com");
PasswordProfile passwordProfile = new PasswordProfile();
passwordProfile.setPassword("Zdi087#2jhkahf");
passwordProfile.setForceChangePasswordNextSignIn(true);
convertExternalToInternalMemberUserPostRequestBody.setPasswordProfile(passwordProfile);
var result = graphClient.users().byUserId("{user-id}").convertExternalToInternalMemberUser().post(convertExternalToInternalMemberUserPostRequestBody);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Users\Item\ConvertExternalToInternalMemberUser\ConvertExternalToInternalMemberUserPostRequestBody;
use Microsoft\Graph\Beta\Generated\Models\PasswordProfile;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new ConvertExternalToInternalMemberUserPostRequestBody();
$requestBody->setUserPrincipalName('AdeleVance@contoso.com');
$passwordProfile = new PasswordProfile();
$passwordProfile->setPassword('Zdi087#2jhkahf');
$passwordProfile->setForceChangePasswordNextSignIn(true);
$requestBody->setPasswordProfile($passwordProfile);
$result = $graphServiceClient->users()->byUserId('user-id')->convertExternalToInternalMemberUser()->post($requestBody)->wait();
# 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.convert_external_to_internal_member_user.convert_external_to_internal_member_user_post_request_body import ConvertExternalToInternalMemberUserPostRequestBody
from msgraph_beta.generated.models.password_profile import PasswordProfile
# To initialize your graph_client, see https://video2.skills-academy.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = ConvertExternalToInternalMemberUserPostRequestBody(
user_principal_name = "AdeleVance@contoso.com",
password_profile = PasswordProfile(
password = "Zdi087#2jhkahf",
force_change_password_next_sign_in = True,
),
)
result = await graph_client.users.by_user_id('user-id').convert_external_to_internal_member_user.post(request_body)
Exemple 2 : Convertir un utilisateur cloud, modifier son adresse de messagerie et exiger la réinitialisation du mot de passe lors de la prochaine connexion
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Users.Item.ConvertExternalToInternalMemberUser;
using Microsoft.Graph.Beta.Models;
var requestBody = new ConvertExternalToInternalMemberUserPostRequestBody
{
UserPrincipalName = "AdeleVance@contoso.com",
PasswordProfile = new PasswordProfile
{
Password = "Zdi087#2jhkahf",
ForceChangePasswordNextSignIn = true,
},
Mail = "AdeleV@contoso.com",
};
// To initialize your graphClient, see https://video2.skills-academy.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Users["{user-id}"].ConvertExternalToInternalMemberUser.PostAsync(requestBody);
// 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.NewConvertExternalToInternalMemberUserPostRequestBody()
userPrincipalName := "AdeleVance@contoso.com"
requestBody.SetUserPrincipalName(&userPrincipalName)
passwordProfile := graphmodels.NewPasswordProfile()
password := "Zdi087#2jhkahf"
passwordProfile.SetPassword(&password)
forceChangePasswordNextSignIn := true
passwordProfile.SetForceChangePasswordNextSignIn(&forceChangePasswordNextSignIn)
requestBody.SetPasswordProfile(passwordProfile)
mail := "AdeleV@contoso.com"
requestBody.SetMail(&mail)
// To initialize your graphClient, see https://video2.skills-academy.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
convertExternalToInternalMemberUser, err := graphClient.Users().ByUserId("user-id").ConvertExternalToInternalMemberUser().Post(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.convertexternaltointernalmemberuser.ConvertExternalToInternalMemberUserPostRequestBody convertExternalToInternalMemberUserPostRequestBody = new com.microsoft.graph.beta.users.item.convertexternaltointernalmemberuser.ConvertExternalToInternalMemberUserPostRequestBody();
convertExternalToInternalMemberUserPostRequestBody.setUserPrincipalName("AdeleVance@contoso.com");
PasswordProfile passwordProfile = new PasswordProfile();
passwordProfile.setPassword("Zdi087#2jhkahf");
passwordProfile.setForceChangePasswordNextSignIn(true);
convertExternalToInternalMemberUserPostRequestBody.setPasswordProfile(passwordProfile);
convertExternalToInternalMemberUserPostRequestBody.setMail("AdeleV@contoso.com");
var result = graphClient.users().byUserId("{user-id}").convertExternalToInternalMemberUser().post(convertExternalToInternalMemberUserPostRequestBody);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Users\Item\ConvertExternalToInternalMemberUser\ConvertExternalToInternalMemberUserPostRequestBody;
use Microsoft\Graph\Beta\Generated\Models\PasswordProfile;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new ConvertExternalToInternalMemberUserPostRequestBody();
$requestBody->setUserPrincipalName('AdeleVance@contoso.com');
$passwordProfile = new PasswordProfile();
$passwordProfile->setPassword('Zdi087#2jhkahf');
$passwordProfile->setForceChangePasswordNextSignIn(true);
$requestBody->setPasswordProfile($passwordProfile);
$requestBody->setMail('AdeleV@contoso.com');
$result = $graphServiceClient->users()->byUserId('user-id')->convertExternalToInternalMemberUser()->post($requestBody)->wait();
# 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.convert_external_to_internal_member_user.convert_external_to_internal_member_user_post_request_body import ConvertExternalToInternalMemberUserPostRequestBody
from msgraph_beta.generated.models.password_profile import PasswordProfile
# To initialize your graph_client, see https://video2.skills-academy.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = ConvertExternalToInternalMemberUserPostRequestBody(
user_principal_name = "AdeleVance@contoso.com",
password_profile = PasswordProfile(
password = "Zdi087#2jhkahf",
force_change_password_next_sign_in = True,
),
mail = "AdeleV@contoso.com",
)
result = await graph_client.users.by_user_id('user-id').convert_external_to_internal_member_user.post(request_body)
POST https://graph.microsoft.com/beta/users/0b8cc234-ef87-4015-9785-cbb42000d41c/convertExternalToInternalMemberUser
// Code snippets are only available for the latest version. Current version is 5.x
// To initialize your graphClient, see https://video2.skills-academy.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Users["{user-id}"].ConvertExternalToInternalMemberUser.PostAsync(null);
// 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"
//other-imports
)
// To initialize your graphClient, see https://video2.skills-academy.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
convertExternalToInternalMemberUser, err := graphClient.Users().ByUserId("user-id").ConvertExternalToInternalMemberUser().Post(context.Background(), nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
var result = graphClient.users().byUserId("{user-id}").convertExternalToInternalMemberUser().post(null);
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
# To initialize your graph_client, see https://video2.skills-academy.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
result = await graph_client.users.by_user_id('user-id').convert_external_to_internal_member_user.post(None)