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.
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)
EventListener.ReadWrite.All
Not available.
Delegated (personal Microsoft account)
Not supported.
Not supported.
Application
EventListener.ReadWrite.All
Not available.
Important
In delegated scenarios with work or school accounts, the signed-in user must be an owner or member of the group or be assigned a supported Microsoft Entra role or a custom role with a supported role permission. External ID User Flow Administrator is the least privileged role supported for this operation.
You can specify the following properties when creating an authenticationEventsFlow. You must include the @odata.type property with a value of the specific user flow type in the body. For example, "@odata.type": "#microsoft.graph.externalUsersSelfServiceSignupEventsFlow".
Property
Type
Description
displayName
String
Required. The display name for the events policy. Must be unique.
Optional. The conditions representing the context of the authentication request which is used to decide whether the events policy is invoked.
priority
Int32
Optional. The priority to use for each individual event of the events policy. If multiple competing listeners for an event have the same priority, one is chosen and an error is silently logged. Default is 500.
Required. The configuration for what to invoke when authentication methods are ready to be presented to the user. Must have at least one identity provider linked.
Optional. The configuration for what to invoke when attributes are ready to be collected from the user. To configure this property, you must specify both attributes and onAttributeCollectionPage > views objects.
Optional. The configuration for what to invoke during user creation.
Response
If successful, this method returns a 201 Created response code and a JSON representation of an authenticationEventsFlow object in the response body. An @odata.type property with the value of the specific user flow type created is included in the response body. For example, "@odata.type": "#microsoft.graph.externalUsersSelfServiceSignupEventsFlow".
Examples
Example 1: Create a basic External Identities sign-up and sign-in user flow in an external tenant
Request
The following example shows a request. In this example, you create a user flow named "Woodgrove User Flow" with the following configuration.
Allow sign up and sign in.
Allow users to create a local email with password account.
Collect the Display Name built-in attribute from the user.
Defines how the attributes to be collected will be displayed to the user.
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new ExternalUsersSelfServiceSignUpEventsFlow
{
OdataType = "#microsoft.graph.externalUsersSelfServiceSignUpEventsFlow",
DisplayName = "Woodgrove Drive User Flow",
OnAuthenticationMethodLoadStart = new OnAuthenticationMethodLoadStartExternalUsersSelfServiceSignUp
{
OdataType = "#microsoft.graph.onAuthenticationMethodLoadStartExternalUsersSelfServiceSignUp",
IdentityProviders = new List<IdentityProviderBase>
{
new IdentityProviderBase
{
Id = "EmailPassword-OAUTH",
},
},
},
OnInteractiveAuthFlowStart = new OnInteractiveAuthFlowStartExternalUsersSelfServiceSignUp
{
OdataType = "#microsoft.graph.onInteractiveAuthFlowStartExternalUsersSelfServiceSignUp",
IsSignUpAllowed = true,
},
OnAttributeCollection = new OnAttributeCollectionExternalUsersSelfServiceSignUp
{
OdataType = "#microsoft.graph.onAttributeCollectionExternalUsersSelfServiceSignUp",
Attributes = new List<IdentityUserFlowAttribute>
{
new IdentityUserFlowAttribute
{
Id = "email",
DisplayName = "Email Address",
Description = "Email address of the user",
UserFlowAttributeType = IdentityUserFlowAttributeType.BuiltIn,
DataType = IdentityUserFlowAttributeDataType.String,
},
new IdentityUserFlowAttribute
{
Id = "displayName",
DisplayName = "Display Name",
Description = "Display Name of the User.",
UserFlowAttributeType = IdentityUserFlowAttributeType.BuiltIn,
DataType = IdentityUserFlowAttributeDataType.String,
},
},
AttributeCollectionPage = new AuthenticationAttributeCollectionPage
{
Views = new List<AuthenticationAttributeCollectionPageViewConfiguration>
{
new AuthenticationAttributeCollectionPageViewConfiguration
{
Inputs = new List<AuthenticationAttributeCollectionInputConfiguration>
{
new AuthenticationAttributeCollectionInputConfiguration
{
Attribute = "email",
Label = "Email Address",
InputType = AuthenticationAttributeCollectionInputType.Text,
Hidden = true,
Editable = false,
WriteToDirectory = true,
Required = true,
ValidationRegEx = "^[a-zA-Z0-9.!#$%&’'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:.[a-zA-Z0-9-]+)*$",
},
new AuthenticationAttributeCollectionInputConfiguration
{
Attribute = "displayName",
Label = "Display Name",
InputType = AuthenticationAttributeCollectionInputType.Text,
Hidden = false,
Editable = true,
WriteToDirectory = true,
Required = false,
ValidationRegEx = "^[a-zA-Z_][0-9a-zA-Z_ ]*[0-9a-zA-Z_]+$",
},
},
},
},
},
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Identity.AuthenticationEventsFlows.PostAsync(requestBody);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
ExternalUsersSelfServiceSignUpEventsFlow authenticationEventsFlow = new ExternalUsersSelfServiceSignUpEventsFlow();
authenticationEventsFlow.setOdataType("#microsoft.graph.externalUsersSelfServiceSignUpEventsFlow");
authenticationEventsFlow.setDisplayName("Woodgrove Drive User Flow");
OnAuthenticationMethodLoadStartExternalUsersSelfServiceSignUp onAuthenticationMethodLoadStart = new OnAuthenticationMethodLoadStartExternalUsersSelfServiceSignUp();
onAuthenticationMethodLoadStart.setOdataType("#microsoft.graph.onAuthenticationMethodLoadStartExternalUsersSelfServiceSignUp");
LinkedList<IdentityProviderBase> identityProviders = new LinkedList<IdentityProviderBase>();
IdentityProviderBase identityProviderBase = new IdentityProviderBase();
identityProviderBase.setId("EmailPassword-OAUTH");
identityProviders.add(identityProviderBase);
onAuthenticationMethodLoadStart.setIdentityProviders(identityProviders);
authenticationEventsFlow.setOnAuthenticationMethodLoadStart(onAuthenticationMethodLoadStart);
OnInteractiveAuthFlowStartExternalUsersSelfServiceSignUp onInteractiveAuthFlowStart = new OnInteractiveAuthFlowStartExternalUsersSelfServiceSignUp();
onInteractiveAuthFlowStart.setOdataType("#microsoft.graph.onInteractiveAuthFlowStartExternalUsersSelfServiceSignUp");
onInteractiveAuthFlowStart.setIsSignUpAllowed(true);
authenticationEventsFlow.setOnInteractiveAuthFlowStart(onInteractiveAuthFlowStart);
OnAttributeCollectionExternalUsersSelfServiceSignUp onAttributeCollection = new OnAttributeCollectionExternalUsersSelfServiceSignUp();
onAttributeCollection.setOdataType("#microsoft.graph.onAttributeCollectionExternalUsersSelfServiceSignUp");
LinkedList<IdentityUserFlowAttribute> attributes = new LinkedList<IdentityUserFlowAttribute>();
IdentityUserFlowAttribute identityUserFlowAttribute = new IdentityUserFlowAttribute();
identityUserFlowAttribute.setId("email");
identityUserFlowAttribute.setDisplayName("Email Address");
identityUserFlowAttribute.setDescription("Email address of the user");
identityUserFlowAttribute.setUserFlowAttributeType(IdentityUserFlowAttributeType.BuiltIn);
identityUserFlowAttribute.setDataType(IdentityUserFlowAttributeDataType.String);
attributes.add(identityUserFlowAttribute);
IdentityUserFlowAttribute identityUserFlowAttribute1 = new IdentityUserFlowAttribute();
identityUserFlowAttribute1.setId("displayName");
identityUserFlowAttribute1.setDisplayName("Display Name");
identityUserFlowAttribute1.setDescription("Display Name of the User.");
identityUserFlowAttribute1.setUserFlowAttributeType(IdentityUserFlowAttributeType.BuiltIn);
identityUserFlowAttribute1.setDataType(IdentityUserFlowAttributeDataType.String);
attributes.add(identityUserFlowAttribute1);
onAttributeCollection.setAttributes(attributes);
AuthenticationAttributeCollectionPage attributeCollectionPage = new AuthenticationAttributeCollectionPage();
LinkedList<AuthenticationAttributeCollectionPageViewConfiguration> views = new LinkedList<AuthenticationAttributeCollectionPageViewConfiguration>();
AuthenticationAttributeCollectionPageViewConfiguration authenticationAttributeCollectionPageViewConfiguration = new AuthenticationAttributeCollectionPageViewConfiguration();
LinkedList<AuthenticationAttributeCollectionInputConfiguration> inputs = new LinkedList<AuthenticationAttributeCollectionInputConfiguration>();
AuthenticationAttributeCollectionInputConfiguration authenticationAttributeCollectionInputConfiguration = new AuthenticationAttributeCollectionInputConfiguration();
authenticationAttributeCollectionInputConfiguration.setAttribute("email");
authenticationAttributeCollectionInputConfiguration.setLabel("Email Address");
authenticationAttributeCollectionInputConfiguration.setInputType(AuthenticationAttributeCollectionInputType.Text);
authenticationAttributeCollectionInputConfiguration.setHidden(true);
authenticationAttributeCollectionInputConfiguration.setEditable(false);
authenticationAttributeCollectionInputConfiguration.setWriteToDirectory(true);
authenticationAttributeCollectionInputConfiguration.setRequired(true);
authenticationAttributeCollectionInputConfiguration.setValidationRegEx("^[a-zA-Z0-9.!#$%&’'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:.[a-zA-Z0-9-]+)*$");
inputs.add(authenticationAttributeCollectionInputConfiguration);
AuthenticationAttributeCollectionInputConfiguration authenticationAttributeCollectionInputConfiguration1 = new AuthenticationAttributeCollectionInputConfiguration();
authenticationAttributeCollectionInputConfiguration1.setAttribute("displayName");
authenticationAttributeCollectionInputConfiguration1.setLabel("Display Name");
authenticationAttributeCollectionInputConfiguration1.setInputType(AuthenticationAttributeCollectionInputType.Text);
authenticationAttributeCollectionInputConfiguration1.setHidden(false);
authenticationAttributeCollectionInputConfiguration1.setEditable(true);
authenticationAttributeCollectionInputConfiguration1.setWriteToDirectory(true);
authenticationAttributeCollectionInputConfiguration1.setRequired(false);
authenticationAttributeCollectionInputConfiguration1.setValidationRegEx("^[a-zA-Z_][0-9a-zA-Z_ ]*[0-9a-zA-Z_]+$");
inputs.add(authenticationAttributeCollectionInputConfiguration1);
authenticationAttributeCollectionPageViewConfiguration.setInputs(inputs);
views.add(authenticationAttributeCollectionPageViewConfiguration);
attributeCollectionPage.setViews(views);
onAttributeCollection.setAttributeCollectionPage(attributeCollectionPage);
authenticationEventsFlow.setOnAttributeCollection(onAttributeCollection);
AuthenticationEventsFlow result = graphClient.identity().authenticationEventsFlows().post(authenticationEventsFlow);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\ExternalUsersSelfServiceSignUpEventsFlow;
use Microsoft\Graph\Beta\Generated\Models\OnAuthenticationMethodLoadStartExternalUsersSelfServiceSignUp;
use Microsoft\Graph\Beta\Generated\Models\IdentityProviderBase;
use Microsoft\Graph\Beta\Generated\Models\OnInteractiveAuthFlowStartExternalUsersSelfServiceSignUp;
use Microsoft\Graph\Beta\Generated\Models\OnAttributeCollectionExternalUsersSelfServiceSignUp;
use Microsoft\Graph\Beta\Generated\Models\IdentityUserFlowAttribute;
use Microsoft\Graph\Beta\Generated\Models\IdentityUserFlowAttributeType;
use Microsoft\Graph\Beta\Generated\Models\IdentityUserFlowAttributeDataType;
use Microsoft\Graph\Beta\Generated\Models\AuthenticationAttributeCollectionPage;
use Microsoft\Graph\Beta\Generated\Models\AuthenticationAttributeCollectionPageViewConfiguration;
use Microsoft\Graph\Beta\Generated\Models\AuthenticationAttributeCollectionInputConfiguration;
use Microsoft\Graph\Beta\Generated\Models\AuthenticationAttributeCollectionInputType;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new ExternalUsersSelfServiceSignUpEventsFlow();
$requestBody->setOdataType('#microsoft.graph.externalUsersSelfServiceSignUpEventsFlow');
$requestBody->setDisplayName('Woodgrove Drive User Flow');
$onAuthenticationMethodLoadStart = new OnAuthenticationMethodLoadStartExternalUsersSelfServiceSignUp();
$onAuthenticationMethodLoadStart->setOdataType('#microsoft.graph.onAuthenticationMethodLoadStartExternalUsersSelfServiceSignUp');
$identityProvidersIdentityProviderBase1 = new IdentityProviderBase();
$identityProvidersIdentityProviderBase1->setId('EmailPassword-OAUTH');
$identityProvidersArray []= $identityProvidersIdentityProviderBase1;
$onAuthenticationMethodLoadStart->setIdentityProviders($identityProvidersArray);
$requestBody->setOnAuthenticationMethodLoadStart($onAuthenticationMethodLoadStart);
$onInteractiveAuthFlowStart = new OnInteractiveAuthFlowStartExternalUsersSelfServiceSignUp();
$onInteractiveAuthFlowStart->setOdataType('#microsoft.graph.onInteractiveAuthFlowStartExternalUsersSelfServiceSignUp');
$onInteractiveAuthFlowStart->setIsSignUpAllowed(true);
$requestBody->setOnInteractiveAuthFlowStart($onInteractiveAuthFlowStart);
$onAttributeCollection = new OnAttributeCollectionExternalUsersSelfServiceSignUp();
$onAttributeCollection->setOdataType('#microsoft.graph.onAttributeCollectionExternalUsersSelfServiceSignUp');
$attributesIdentityUserFlowAttribute1 = new IdentityUserFlowAttribute();
$attributesIdentityUserFlowAttribute1->setId('email');
$attributesIdentityUserFlowAttribute1->setDisplayName('Email Address');
$attributesIdentityUserFlowAttribute1->setDescription('Email address of the user');
$attributesIdentityUserFlowAttribute1->setUserFlowAttributeType(new IdentityUserFlowAttributeType('builtIn'));
$attributesIdentityUserFlowAttribute1->setDataType(new IdentityUserFlowAttributeDataType('string'));
$attributesArray []= $attributesIdentityUserFlowAttribute1;
$attributesIdentityUserFlowAttribute2 = new IdentityUserFlowAttribute();
$attributesIdentityUserFlowAttribute2->setId('displayName');
$attributesIdentityUserFlowAttribute2->setDisplayName('Display Name');
$attributesIdentityUserFlowAttribute2->setDescription('Display Name of the User.');
$attributesIdentityUserFlowAttribute2->setUserFlowAttributeType(new IdentityUserFlowAttributeType('builtIn'));
$attributesIdentityUserFlowAttribute2->setDataType(new IdentityUserFlowAttributeDataType('string'));
$attributesArray []= $attributesIdentityUserFlowAttribute2;
$onAttributeCollection->setAttributes($attributesArray);
$onAttributeCollectionAttributeCollectionPage = new AuthenticationAttributeCollectionPage();
$viewsAuthenticationAttributeCollectionPageViewConfiguration1 = new AuthenticationAttributeCollectionPageViewConfiguration();
$inputsAuthenticationAttributeCollectionInputConfiguration1 = new AuthenticationAttributeCollectionInputConfiguration();
$inputsAuthenticationAttributeCollectionInputConfiguration1->setAttribute('email');
$inputsAuthenticationAttributeCollectionInputConfiguration1->setLabel('Email Address');
$inputsAuthenticationAttributeCollectionInputConfiguration1->setInputType(new AuthenticationAttributeCollectionInputType('text'));
$inputsAuthenticationAttributeCollectionInputConfiguration1->setHidden(true);
$inputsAuthenticationAttributeCollectionInputConfiguration1->setEditable(false);
$inputsAuthenticationAttributeCollectionInputConfiguration1->setWriteToDirectory(true);
$inputsAuthenticationAttributeCollectionInputConfiguration1->setRequired(true);
$inputsAuthenticationAttributeCollectionInputConfiguration1->setValidationRegEx('^[a-zA-Z0-9.!#$%&’\'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:.[a-zA-Z0-9-]+)*$');
$inputsArray []= $inputsAuthenticationAttributeCollectionInputConfiguration1;
$inputsAuthenticationAttributeCollectionInputConfiguration2 = new AuthenticationAttributeCollectionInputConfiguration();
$inputsAuthenticationAttributeCollectionInputConfiguration2->setAttribute('displayName');
$inputsAuthenticationAttributeCollectionInputConfiguration2->setLabel('Display Name');
$inputsAuthenticationAttributeCollectionInputConfiguration2->setInputType(new AuthenticationAttributeCollectionInputType('text'));
$inputsAuthenticationAttributeCollectionInputConfiguration2->setHidden(false);
$inputsAuthenticationAttributeCollectionInputConfiguration2->setEditable(true);
$inputsAuthenticationAttributeCollectionInputConfiguration2->setWriteToDirectory(true);
$inputsAuthenticationAttributeCollectionInputConfiguration2->setRequired(false);
$inputsAuthenticationAttributeCollectionInputConfiguration2->setValidationRegEx('^[a-zA-Z_][0-9a-zA-Z_ ]*[0-9a-zA-Z_]+$');
$inputsArray []= $inputsAuthenticationAttributeCollectionInputConfiguration2;
$viewsAuthenticationAttributeCollectionPageViewConfiguration1->setInputs($inputsArray);
$viewsArray []= $viewsAuthenticationAttributeCollectionPageViewConfiguration1;
$onAttributeCollectionAttributeCollectionPage->setViews($viewsArray);
$onAttributeCollection->setAttributeCollectionPage($onAttributeCollectionAttributeCollectionPage);
$requestBody->setOnAttributeCollection($onAttributeCollection);
$result = $graphServiceClient->identity()->authenticationEventsFlows()->post($requestBody)->wait();
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.models.external_users_self_service_sign_up_events_flow import ExternalUsersSelfServiceSignUpEventsFlow
from msgraph_beta.generated.models.on_authentication_method_load_start_external_users_self_service_sign_up import OnAuthenticationMethodLoadStartExternalUsersSelfServiceSignUp
from msgraph_beta.generated.models.identity_provider_base import IdentityProviderBase
from msgraph_beta.generated.models.on_interactive_auth_flow_start_external_users_self_service_sign_up import OnInteractiveAuthFlowStartExternalUsersSelfServiceSignUp
from msgraph_beta.generated.models.on_attribute_collection_external_users_self_service_sign_up import OnAttributeCollectionExternalUsersSelfServiceSignUp
from msgraph_beta.generated.models.identity_user_flow_attribute import IdentityUserFlowAttribute
from msgraph_beta.generated.models.identity_user_flow_attribute_type import IdentityUserFlowAttributeType
from msgraph_beta.generated.models.identity_user_flow_attribute_data_type import IdentityUserFlowAttributeDataType
from msgraph_beta.generated.models.authentication_attribute_collection_page import AuthenticationAttributeCollectionPage
from msgraph_beta.generated.models.authentication_attribute_collection_page_view_configuration import AuthenticationAttributeCollectionPageViewConfiguration
from msgraph_beta.generated.models.authentication_attribute_collection_input_configuration import AuthenticationAttributeCollectionInputConfiguration
from msgraph_beta.generated.models.authentication_attribute_collection_input_type import AuthenticationAttributeCollectionInputType
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = ExternalUsersSelfServiceSignUpEventsFlow(
odata_type = "#microsoft.graph.externalUsersSelfServiceSignUpEventsFlow",
display_name = "Woodgrove Drive User Flow",
on_authentication_method_load_start = OnAuthenticationMethodLoadStartExternalUsersSelfServiceSignUp(
odata_type = "#microsoft.graph.onAuthenticationMethodLoadStartExternalUsersSelfServiceSignUp",
identity_providers = [
IdentityProviderBase(
id = "EmailPassword-OAUTH",
),
],
),
on_interactive_auth_flow_start = OnInteractiveAuthFlowStartExternalUsersSelfServiceSignUp(
odata_type = "#microsoft.graph.onInteractiveAuthFlowStartExternalUsersSelfServiceSignUp",
is_sign_up_allowed = True,
),
on_attribute_collection = OnAttributeCollectionExternalUsersSelfServiceSignUp(
odata_type = "#microsoft.graph.onAttributeCollectionExternalUsersSelfServiceSignUp",
attributes = [
IdentityUserFlowAttribute(
id = "email",
display_name = "Email Address",
description = "Email address of the user",
user_flow_attribute_type = IdentityUserFlowAttributeType.BuiltIn,
data_type = IdentityUserFlowAttributeDataType.String,
),
IdentityUserFlowAttribute(
id = "displayName",
display_name = "Display Name",
description = "Display Name of the User.",
user_flow_attribute_type = IdentityUserFlowAttributeType.BuiltIn,
data_type = IdentityUserFlowAttributeDataType.String,
),
],
attribute_collection_page = AuthenticationAttributeCollectionPage(
views = [
AuthenticationAttributeCollectionPageViewConfiguration(
inputs = [
AuthenticationAttributeCollectionInputConfiguration(
attribute = "email",
label = "Email Address",
input_type = AuthenticationAttributeCollectionInputType.Text,
hidden = True,
editable = False,
write_to_directory = True,
required = True,
validation_reg_ex = "^[a-zA-Z0-9.!#$%&’'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:.[a-zA-Z0-9-]+)*$",
),
AuthenticationAttributeCollectionInputConfiguration(
attribute = "displayName",
label = "Display Name",
input_type = AuthenticationAttributeCollectionInputType.Text,
hidden = False,
editable = True,
write_to_directory = True,
required = False,
validation_reg_ex = "^[a-zA-Z_][0-9a-zA-Z_ ]*[0-9a-zA-Z_]+$",
),
],
),
],
),
),
)
result = await graph_client.identity.authentication_events_flows.post(request_body)
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new ExternalUsersSelfServiceSignUpEventsFlow
{
OdataType = "#microsoft.graph.externalUsersSelfServiceSignUpEventsFlow",
DisplayName = "Woodgrove Drive User Flow",
Conditions = new AuthenticationConditions
{
Applications = new AuthenticationConditionsApplications
{
IncludeApplications = new List<AuthenticationConditionApplication>
{
new AuthenticationConditionApplication
{
AppId = "63856651-13d9-4784-9abf-20758d509e19",
},
},
},
},
OnAuthenticationMethodLoadStart = new OnAuthenticationMethodLoadStartExternalUsersSelfServiceSignUp
{
OdataType = "#microsoft.graph.onAuthenticationMethodLoadStartExternalUsersSelfServiceSignUp",
IdentityProviders = new List<IdentityProviderBase>
{
new IdentityProviderBase
{
Id = "EmailPassword-OAUTH",
},
},
},
OnInteractiveAuthFlowStart = new OnInteractiveAuthFlowStartExternalUsersSelfServiceSignUp
{
OdataType = "#microsoft.graph.onInteractiveAuthFlowStartExternalUsersSelfServiceSignUp",
IsSignUpAllowed = true,
},
OnAttributeCollection = new OnAttributeCollectionExternalUsersSelfServiceSignUp
{
OdataType = "#microsoft.graph.onAttributeCollectionExternalUsersSelfServiceSignUp",
Attributes = new List<IdentityUserFlowAttribute>
{
new IdentityUserFlowAttribute
{
Id = "email",
DisplayName = "Email Address",
Description = "Email address of the user",
UserFlowAttributeType = IdentityUserFlowAttributeType.BuiltIn,
DataType = IdentityUserFlowAttributeDataType.String,
},
new IdentityUserFlowAttribute
{
Id = "displayName",
DisplayName = "Display Name",
Description = "Display Name of the User.",
UserFlowAttributeType = IdentityUserFlowAttributeType.BuiltIn,
DataType = IdentityUserFlowAttributeDataType.String,
},
},
AttributeCollectionPage = new AuthenticationAttributeCollectionPage
{
Views = new List<AuthenticationAttributeCollectionPageViewConfiguration>
{
new AuthenticationAttributeCollectionPageViewConfiguration
{
Inputs = new List<AuthenticationAttributeCollectionInputConfiguration>
{
new AuthenticationAttributeCollectionInputConfiguration
{
Attribute = "email",
Label = "Email Address",
InputType = AuthenticationAttributeCollectionInputType.Text,
Hidden = true,
Editable = false,
WriteToDirectory = true,
Required = true,
ValidationRegEx = "^[a-zA-Z0-9.!#$%&’'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:.[a-zA-Z0-9-]+)*$",
},
new AuthenticationAttributeCollectionInputConfiguration
{
Attribute = "displayName",
Label = "Display Name",
InputType = AuthenticationAttributeCollectionInputType.Text,
Hidden = false,
Editable = true,
WriteToDirectory = true,
Required = false,
ValidationRegEx = "^[a-zA-Z_][0-9a-zA-Z_ ]*[0-9a-zA-Z_]+$",
},
},
},
},
},
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Identity.AuthenticationEventsFlows.PostAsync(requestBody);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
ExternalUsersSelfServiceSignUpEventsFlow authenticationEventsFlow = new ExternalUsersSelfServiceSignUpEventsFlow();
authenticationEventsFlow.setOdataType("#microsoft.graph.externalUsersSelfServiceSignUpEventsFlow");
authenticationEventsFlow.setDisplayName("Woodgrove Drive User Flow");
AuthenticationConditions conditions = new AuthenticationConditions();
AuthenticationConditionsApplications applications = new AuthenticationConditionsApplications();
LinkedList<AuthenticationConditionApplication> includeApplications = new LinkedList<AuthenticationConditionApplication>();
AuthenticationConditionApplication authenticationConditionApplication = new AuthenticationConditionApplication();
authenticationConditionApplication.setAppId("63856651-13d9-4784-9abf-20758d509e19");
includeApplications.add(authenticationConditionApplication);
applications.setIncludeApplications(includeApplications);
conditions.setApplications(applications);
authenticationEventsFlow.setConditions(conditions);
OnAuthenticationMethodLoadStartExternalUsersSelfServiceSignUp onAuthenticationMethodLoadStart = new OnAuthenticationMethodLoadStartExternalUsersSelfServiceSignUp();
onAuthenticationMethodLoadStart.setOdataType("#microsoft.graph.onAuthenticationMethodLoadStartExternalUsersSelfServiceSignUp");
LinkedList<IdentityProviderBase> identityProviders = new LinkedList<IdentityProviderBase>();
IdentityProviderBase identityProviderBase = new IdentityProviderBase();
identityProviderBase.setId("EmailPassword-OAUTH");
identityProviders.add(identityProviderBase);
onAuthenticationMethodLoadStart.setIdentityProviders(identityProviders);
authenticationEventsFlow.setOnAuthenticationMethodLoadStart(onAuthenticationMethodLoadStart);
OnInteractiveAuthFlowStartExternalUsersSelfServiceSignUp onInteractiveAuthFlowStart = new OnInteractiveAuthFlowStartExternalUsersSelfServiceSignUp();
onInteractiveAuthFlowStart.setOdataType("#microsoft.graph.onInteractiveAuthFlowStartExternalUsersSelfServiceSignUp");
onInteractiveAuthFlowStart.setIsSignUpAllowed(true);
authenticationEventsFlow.setOnInteractiveAuthFlowStart(onInteractiveAuthFlowStart);
OnAttributeCollectionExternalUsersSelfServiceSignUp onAttributeCollection = new OnAttributeCollectionExternalUsersSelfServiceSignUp();
onAttributeCollection.setOdataType("#microsoft.graph.onAttributeCollectionExternalUsersSelfServiceSignUp");
LinkedList<IdentityUserFlowAttribute> attributes = new LinkedList<IdentityUserFlowAttribute>();
IdentityUserFlowAttribute identityUserFlowAttribute = new IdentityUserFlowAttribute();
identityUserFlowAttribute.setId("email");
identityUserFlowAttribute.setDisplayName("Email Address");
identityUserFlowAttribute.setDescription("Email address of the user");
identityUserFlowAttribute.setUserFlowAttributeType(IdentityUserFlowAttributeType.BuiltIn);
identityUserFlowAttribute.setDataType(IdentityUserFlowAttributeDataType.String);
attributes.add(identityUserFlowAttribute);
IdentityUserFlowAttribute identityUserFlowAttribute1 = new IdentityUserFlowAttribute();
identityUserFlowAttribute1.setId("displayName");
identityUserFlowAttribute1.setDisplayName("Display Name");
identityUserFlowAttribute1.setDescription("Display Name of the User.");
identityUserFlowAttribute1.setUserFlowAttributeType(IdentityUserFlowAttributeType.BuiltIn);
identityUserFlowAttribute1.setDataType(IdentityUserFlowAttributeDataType.String);
attributes.add(identityUserFlowAttribute1);
onAttributeCollection.setAttributes(attributes);
AuthenticationAttributeCollectionPage attributeCollectionPage = new AuthenticationAttributeCollectionPage();
LinkedList<AuthenticationAttributeCollectionPageViewConfiguration> views = new LinkedList<AuthenticationAttributeCollectionPageViewConfiguration>();
AuthenticationAttributeCollectionPageViewConfiguration authenticationAttributeCollectionPageViewConfiguration = new AuthenticationAttributeCollectionPageViewConfiguration();
LinkedList<AuthenticationAttributeCollectionInputConfiguration> inputs = new LinkedList<AuthenticationAttributeCollectionInputConfiguration>();
AuthenticationAttributeCollectionInputConfiguration authenticationAttributeCollectionInputConfiguration = new AuthenticationAttributeCollectionInputConfiguration();
authenticationAttributeCollectionInputConfiguration.setAttribute("email");
authenticationAttributeCollectionInputConfiguration.setLabel("Email Address");
authenticationAttributeCollectionInputConfiguration.setInputType(AuthenticationAttributeCollectionInputType.Text);
authenticationAttributeCollectionInputConfiguration.setHidden(true);
authenticationAttributeCollectionInputConfiguration.setEditable(false);
authenticationAttributeCollectionInputConfiguration.setWriteToDirectory(true);
authenticationAttributeCollectionInputConfiguration.setRequired(true);
authenticationAttributeCollectionInputConfiguration.setValidationRegEx("^[a-zA-Z0-9.!#$%&’'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:.[a-zA-Z0-9-]+)*$");
inputs.add(authenticationAttributeCollectionInputConfiguration);
AuthenticationAttributeCollectionInputConfiguration authenticationAttributeCollectionInputConfiguration1 = new AuthenticationAttributeCollectionInputConfiguration();
authenticationAttributeCollectionInputConfiguration1.setAttribute("displayName");
authenticationAttributeCollectionInputConfiguration1.setLabel("Display Name");
authenticationAttributeCollectionInputConfiguration1.setInputType(AuthenticationAttributeCollectionInputType.Text);
authenticationAttributeCollectionInputConfiguration1.setHidden(false);
authenticationAttributeCollectionInputConfiguration1.setEditable(true);
authenticationAttributeCollectionInputConfiguration1.setWriteToDirectory(true);
authenticationAttributeCollectionInputConfiguration1.setRequired(false);
authenticationAttributeCollectionInputConfiguration1.setValidationRegEx("^[a-zA-Z_][0-9a-zA-Z_ ]*[0-9a-zA-Z_]+$");
inputs.add(authenticationAttributeCollectionInputConfiguration1);
authenticationAttributeCollectionPageViewConfiguration.setInputs(inputs);
views.add(authenticationAttributeCollectionPageViewConfiguration);
attributeCollectionPage.setViews(views);
onAttributeCollection.setAttributeCollectionPage(attributeCollectionPage);
authenticationEventsFlow.setOnAttributeCollection(onAttributeCollection);
AuthenticationEventsFlow result = graphClient.identity().authenticationEventsFlows().post(authenticationEventsFlow);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\ExternalUsersSelfServiceSignUpEventsFlow;
use Microsoft\Graph\Beta\Generated\Models\AuthenticationConditions;
use Microsoft\Graph\Beta\Generated\Models\AuthenticationConditionsApplications;
use Microsoft\Graph\Beta\Generated\Models\AuthenticationConditionApplication;
use Microsoft\Graph\Beta\Generated\Models\OnAuthenticationMethodLoadStartExternalUsersSelfServiceSignUp;
use Microsoft\Graph\Beta\Generated\Models\IdentityProviderBase;
use Microsoft\Graph\Beta\Generated\Models\OnInteractiveAuthFlowStartExternalUsersSelfServiceSignUp;
use Microsoft\Graph\Beta\Generated\Models\OnAttributeCollectionExternalUsersSelfServiceSignUp;
use Microsoft\Graph\Beta\Generated\Models\IdentityUserFlowAttribute;
use Microsoft\Graph\Beta\Generated\Models\IdentityUserFlowAttributeType;
use Microsoft\Graph\Beta\Generated\Models\IdentityUserFlowAttributeDataType;
use Microsoft\Graph\Beta\Generated\Models\AuthenticationAttributeCollectionPage;
use Microsoft\Graph\Beta\Generated\Models\AuthenticationAttributeCollectionPageViewConfiguration;
use Microsoft\Graph\Beta\Generated\Models\AuthenticationAttributeCollectionInputConfiguration;
use Microsoft\Graph\Beta\Generated\Models\AuthenticationAttributeCollectionInputType;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new ExternalUsersSelfServiceSignUpEventsFlow();
$requestBody->setOdataType('#microsoft.graph.externalUsersSelfServiceSignUpEventsFlow');
$requestBody->setDisplayName('Woodgrove Drive User Flow');
$conditions = new AuthenticationConditions();
$conditionsApplications = new AuthenticationConditionsApplications();
$includeApplicationsAuthenticationConditionApplication1 = new AuthenticationConditionApplication();
$includeApplicationsAuthenticationConditionApplication1->setAppId('63856651-13d9-4784-9abf-20758d509e19');
$includeApplicationsArray []= $includeApplicationsAuthenticationConditionApplication1;
$conditionsApplications->setIncludeApplications($includeApplicationsArray);
$conditions->setApplications($conditionsApplications);
$requestBody->setConditions($conditions);
$onAuthenticationMethodLoadStart = new OnAuthenticationMethodLoadStartExternalUsersSelfServiceSignUp();
$onAuthenticationMethodLoadStart->setOdataType('#microsoft.graph.onAuthenticationMethodLoadStartExternalUsersSelfServiceSignUp');
$identityProvidersIdentityProviderBase1 = new IdentityProviderBase();
$identityProvidersIdentityProviderBase1->setId('EmailPassword-OAUTH');
$identityProvidersArray []= $identityProvidersIdentityProviderBase1;
$onAuthenticationMethodLoadStart->setIdentityProviders($identityProvidersArray);
$requestBody->setOnAuthenticationMethodLoadStart($onAuthenticationMethodLoadStart);
$onInteractiveAuthFlowStart = new OnInteractiveAuthFlowStartExternalUsersSelfServiceSignUp();
$onInteractiveAuthFlowStart->setOdataType('#microsoft.graph.onInteractiveAuthFlowStartExternalUsersSelfServiceSignUp');
$onInteractiveAuthFlowStart->setIsSignUpAllowed(true);
$requestBody->setOnInteractiveAuthFlowStart($onInteractiveAuthFlowStart);
$onAttributeCollection = new OnAttributeCollectionExternalUsersSelfServiceSignUp();
$onAttributeCollection->setOdataType('#microsoft.graph.onAttributeCollectionExternalUsersSelfServiceSignUp');
$attributesIdentityUserFlowAttribute1 = new IdentityUserFlowAttribute();
$attributesIdentityUserFlowAttribute1->setId('email');
$attributesIdentityUserFlowAttribute1->setDisplayName('Email Address');
$attributesIdentityUserFlowAttribute1->setDescription('Email address of the user');
$attributesIdentityUserFlowAttribute1->setUserFlowAttributeType(new IdentityUserFlowAttributeType('builtIn'));
$attributesIdentityUserFlowAttribute1->setDataType(new IdentityUserFlowAttributeDataType('string'));
$attributesArray []= $attributesIdentityUserFlowAttribute1;
$attributesIdentityUserFlowAttribute2 = new IdentityUserFlowAttribute();
$attributesIdentityUserFlowAttribute2->setId('displayName');
$attributesIdentityUserFlowAttribute2->setDisplayName('Display Name');
$attributesIdentityUserFlowAttribute2->setDescription('Display Name of the User.');
$attributesIdentityUserFlowAttribute2->setUserFlowAttributeType(new IdentityUserFlowAttributeType('builtIn'));
$attributesIdentityUserFlowAttribute2->setDataType(new IdentityUserFlowAttributeDataType('string'));
$attributesArray []= $attributesIdentityUserFlowAttribute2;
$onAttributeCollection->setAttributes($attributesArray);
$onAttributeCollectionAttributeCollectionPage = new AuthenticationAttributeCollectionPage();
$viewsAuthenticationAttributeCollectionPageViewConfiguration1 = new AuthenticationAttributeCollectionPageViewConfiguration();
$inputsAuthenticationAttributeCollectionInputConfiguration1 = new AuthenticationAttributeCollectionInputConfiguration();
$inputsAuthenticationAttributeCollectionInputConfiguration1->setAttribute('email');
$inputsAuthenticationAttributeCollectionInputConfiguration1->setLabel('Email Address');
$inputsAuthenticationAttributeCollectionInputConfiguration1->setInputType(new AuthenticationAttributeCollectionInputType('text'));
$inputsAuthenticationAttributeCollectionInputConfiguration1->setHidden(true);
$inputsAuthenticationAttributeCollectionInputConfiguration1->setEditable(false);
$inputsAuthenticationAttributeCollectionInputConfiguration1->setWriteToDirectory(true);
$inputsAuthenticationAttributeCollectionInputConfiguration1->setRequired(true);
$inputsAuthenticationAttributeCollectionInputConfiguration1->setValidationRegEx('^[a-zA-Z0-9.!#$%&’\'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:.[a-zA-Z0-9-]+)*$');
$inputsArray []= $inputsAuthenticationAttributeCollectionInputConfiguration1;
$inputsAuthenticationAttributeCollectionInputConfiguration2 = new AuthenticationAttributeCollectionInputConfiguration();
$inputsAuthenticationAttributeCollectionInputConfiguration2->setAttribute('displayName');
$inputsAuthenticationAttributeCollectionInputConfiguration2->setLabel('Display Name');
$inputsAuthenticationAttributeCollectionInputConfiguration2->setInputType(new AuthenticationAttributeCollectionInputType('text'));
$inputsAuthenticationAttributeCollectionInputConfiguration2->setHidden(false);
$inputsAuthenticationAttributeCollectionInputConfiguration2->setEditable(true);
$inputsAuthenticationAttributeCollectionInputConfiguration2->setWriteToDirectory(true);
$inputsAuthenticationAttributeCollectionInputConfiguration2->setRequired(false);
$inputsAuthenticationAttributeCollectionInputConfiguration2->setValidationRegEx('^[a-zA-Z_][0-9a-zA-Z_ ]*[0-9a-zA-Z_]+$');
$inputsArray []= $inputsAuthenticationAttributeCollectionInputConfiguration2;
$viewsAuthenticationAttributeCollectionPageViewConfiguration1->setInputs($inputsArray);
$viewsArray []= $viewsAuthenticationAttributeCollectionPageViewConfiguration1;
$onAttributeCollectionAttributeCollectionPage->setViews($viewsArray);
$onAttributeCollection->setAttributeCollectionPage($onAttributeCollectionAttributeCollectionPage);
$requestBody->setOnAttributeCollection($onAttributeCollection);
$result = $graphServiceClient->identity()->authenticationEventsFlows()->post($requestBody)->wait();
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.models.external_users_self_service_sign_up_events_flow import ExternalUsersSelfServiceSignUpEventsFlow
from msgraph_beta.generated.models.authentication_conditions import AuthenticationConditions
from msgraph_beta.generated.models.authentication_conditions_applications import AuthenticationConditionsApplications
from msgraph_beta.generated.models.authentication_condition_application import AuthenticationConditionApplication
from msgraph_beta.generated.models.on_authentication_method_load_start_external_users_self_service_sign_up import OnAuthenticationMethodLoadStartExternalUsersSelfServiceSignUp
from msgraph_beta.generated.models.identity_provider_base import IdentityProviderBase
from msgraph_beta.generated.models.on_interactive_auth_flow_start_external_users_self_service_sign_up import OnInteractiveAuthFlowStartExternalUsersSelfServiceSignUp
from msgraph_beta.generated.models.on_attribute_collection_external_users_self_service_sign_up import OnAttributeCollectionExternalUsersSelfServiceSignUp
from msgraph_beta.generated.models.identity_user_flow_attribute import IdentityUserFlowAttribute
from msgraph_beta.generated.models.identity_user_flow_attribute_type import IdentityUserFlowAttributeType
from msgraph_beta.generated.models.identity_user_flow_attribute_data_type import IdentityUserFlowAttributeDataType
from msgraph_beta.generated.models.authentication_attribute_collection_page import AuthenticationAttributeCollectionPage
from msgraph_beta.generated.models.authentication_attribute_collection_page_view_configuration import AuthenticationAttributeCollectionPageViewConfiguration
from msgraph_beta.generated.models.authentication_attribute_collection_input_configuration import AuthenticationAttributeCollectionInputConfiguration
from msgraph_beta.generated.models.authentication_attribute_collection_input_type import AuthenticationAttributeCollectionInputType
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = ExternalUsersSelfServiceSignUpEventsFlow(
odata_type = "#microsoft.graph.externalUsersSelfServiceSignUpEventsFlow",
display_name = "Woodgrove Drive User Flow",
conditions = AuthenticationConditions(
applications = AuthenticationConditionsApplications(
include_applications = [
AuthenticationConditionApplication(
app_id = "63856651-13d9-4784-9abf-20758d509e19",
),
],
),
),
on_authentication_method_load_start = OnAuthenticationMethodLoadStartExternalUsersSelfServiceSignUp(
odata_type = "#microsoft.graph.onAuthenticationMethodLoadStartExternalUsersSelfServiceSignUp",
identity_providers = [
IdentityProviderBase(
id = "EmailPassword-OAUTH",
),
],
),
on_interactive_auth_flow_start = OnInteractiveAuthFlowStartExternalUsersSelfServiceSignUp(
odata_type = "#microsoft.graph.onInteractiveAuthFlowStartExternalUsersSelfServiceSignUp",
is_sign_up_allowed = True,
),
on_attribute_collection = OnAttributeCollectionExternalUsersSelfServiceSignUp(
odata_type = "#microsoft.graph.onAttributeCollectionExternalUsersSelfServiceSignUp",
attributes = [
IdentityUserFlowAttribute(
id = "email",
display_name = "Email Address",
description = "Email address of the user",
user_flow_attribute_type = IdentityUserFlowAttributeType.BuiltIn,
data_type = IdentityUserFlowAttributeDataType.String,
),
IdentityUserFlowAttribute(
id = "displayName",
display_name = "Display Name",
description = "Display Name of the User.",
user_flow_attribute_type = IdentityUserFlowAttributeType.BuiltIn,
data_type = IdentityUserFlowAttributeDataType.String,
),
],
attribute_collection_page = AuthenticationAttributeCollectionPage(
views = [
AuthenticationAttributeCollectionPageViewConfiguration(
inputs = [
AuthenticationAttributeCollectionInputConfiguration(
attribute = "email",
label = "Email Address",
input_type = AuthenticationAttributeCollectionInputType.Text,
hidden = True,
editable = False,
write_to_directory = True,
required = True,
validation_reg_ex = "^[a-zA-Z0-9.!#$%&’'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:.[a-zA-Z0-9-]+)*$",
),
AuthenticationAttributeCollectionInputConfiguration(
attribute = "displayName",
label = "Display Name",
input_type = AuthenticationAttributeCollectionInputType.Text,
hidden = False,
editable = True,
write_to_directory = True,
required = False,
validation_reg_ex = "^[a-zA-Z_][0-9a-zA-Z_ ]*[0-9a-zA-Z_]+$",
),
],
),
],
),
),
)
result = await graph_client.identity.authentication_events_flows.post(request_body)
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new ExternalUsersSelfServiceSignUpEventsFlow
{
OdataType = "#microsoft.graph.externalUsersSelfServiceSignUpEventsFlow",
DisplayName = "Woodgrove User Flow 2",
OnAuthenticationMethodLoadStart = new OnAuthenticationMethodLoadStartExternalUsersSelfServiceSignUp
{
OdataType = "#microsoft.graph.onAuthenticationMethodLoadStartExternalUsersSelfServiceSignUp",
IdentityProviders = new List<IdentityProviderBase>
{
new IdentityProviderBase
{
Id = "EmailPassword-OAUTH",
},
new IdentityProviderBase
{
Id = "Google-OAUTH",
},
new IdentityProviderBase
{
Id = "Facebook-OAUTH",
},
},
},
OnInteractiveAuthFlowStart = new OnInteractiveAuthFlowStartExternalUsersSelfServiceSignUp
{
OdataType = "#microsoft.graph.onInteractiveAuthFlowStartExternalUsersSelfServiceSignUp",
IsSignUpAllowed = true,
},
OnAttributeCollection = new OnAttributeCollectionExternalUsersSelfServiceSignUp
{
OdataType = "#microsoft.graph.onAttributeCollectionExternalUsersSelfServiceSignUp",
Attributes = new List<IdentityUserFlowAttribute>
{
new IdentityUserFlowAttribute
{
Id = "email",
DisplayName = "Email Address",
Description = "Email address of the user",
UserFlowAttributeType = IdentityUserFlowAttributeType.BuiltIn,
DataType = IdentityUserFlowAttributeDataType.String,
},
new IdentityUserFlowAttribute
{
Id = "displayName",
DisplayName = "Display Name",
Description = "Display Name of the User.",
UserFlowAttributeType = IdentityUserFlowAttributeType.BuiltIn,
DataType = IdentityUserFlowAttributeDataType.String,
},
new IdentityUserFlowAttribute
{
Id = "extension_6ea3bc85aec24b1c92ff4a117afb6621_Favoritecolor",
DisplayName = "Favorite color",
Description = "what is your favorite color",
UserFlowAttributeType = IdentityUserFlowAttributeType.Custom,
DataType = IdentityUserFlowAttributeDataType.String,
},
},
AttributeCollectionPage = new AuthenticationAttributeCollectionPage
{
Views = new List<AuthenticationAttributeCollectionPageViewConfiguration>
{
new AuthenticationAttributeCollectionPageViewConfiguration
{
Inputs = new List<AuthenticationAttributeCollectionInputConfiguration>
{
new AuthenticationAttributeCollectionInputConfiguration
{
Attribute = "email",
Label = "Email Address",
InputType = AuthenticationAttributeCollectionInputType.Text,
Hidden = true,
Editable = false,
WriteToDirectory = true,
Required = true,
ValidationRegEx = "^[a-zA-Z0-9.!#$%&’'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:.[a-zA-Z0-9-]+)*$",
},
new AuthenticationAttributeCollectionInputConfiguration
{
Attribute = "displayName",
Label = "Display Name",
InputType = AuthenticationAttributeCollectionInputType.Text,
Hidden = false,
Editable = true,
WriteToDirectory = true,
Required = false,
ValidationRegEx = "^[a-zA-Z_][0-9a-zA-Z_ ]*[0-9a-zA-Z_]+$",
},
new AuthenticationAttributeCollectionInputConfiguration
{
Attribute = "extension_6ea3bc85aec24b1c92ff4a117afb6621_Favoritecolor",
Label = "Favorite color",
InputType = AuthenticationAttributeCollectionInputType.Text,
Hidden = false,
Editable = true,
WriteToDirectory = true,
Required = false,
ValidationRegEx = "^[a-zA-Z_][0-9a-zA-Z_ ]*[0-9a-zA-Z_]+$",
},
},
},
},
},
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Identity.AuthenticationEventsFlows.PostAsync(requestBody);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
ExternalUsersSelfServiceSignUpEventsFlow authenticationEventsFlow = new ExternalUsersSelfServiceSignUpEventsFlow();
authenticationEventsFlow.setOdataType("#microsoft.graph.externalUsersSelfServiceSignUpEventsFlow");
authenticationEventsFlow.setDisplayName("Woodgrove User Flow 2");
OnAuthenticationMethodLoadStartExternalUsersSelfServiceSignUp onAuthenticationMethodLoadStart = new OnAuthenticationMethodLoadStartExternalUsersSelfServiceSignUp();
onAuthenticationMethodLoadStart.setOdataType("#microsoft.graph.onAuthenticationMethodLoadStartExternalUsersSelfServiceSignUp");
LinkedList<IdentityProviderBase> identityProviders = new LinkedList<IdentityProviderBase>();
IdentityProviderBase identityProviderBase = new IdentityProviderBase();
identityProviderBase.setId("EmailPassword-OAUTH");
identityProviders.add(identityProviderBase);
IdentityProviderBase identityProviderBase1 = new IdentityProviderBase();
identityProviderBase1.setId("Google-OAUTH");
identityProviders.add(identityProviderBase1);
IdentityProviderBase identityProviderBase2 = new IdentityProviderBase();
identityProviderBase2.setId("Facebook-OAUTH");
identityProviders.add(identityProviderBase2);
onAuthenticationMethodLoadStart.setIdentityProviders(identityProviders);
authenticationEventsFlow.setOnAuthenticationMethodLoadStart(onAuthenticationMethodLoadStart);
OnInteractiveAuthFlowStartExternalUsersSelfServiceSignUp onInteractiveAuthFlowStart = new OnInteractiveAuthFlowStartExternalUsersSelfServiceSignUp();
onInteractiveAuthFlowStart.setOdataType("#microsoft.graph.onInteractiveAuthFlowStartExternalUsersSelfServiceSignUp");
onInteractiveAuthFlowStart.setIsSignUpAllowed(true);
authenticationEventsFlow.setOnInteractiveAuthFlowStart(onInteractiveAuthFlowStart);
OnAttributeCollectionExternalUsersSelfServiceSignUp onAttributeCollection = new OnAttributeCollectionExternalUsersSelfServiceSignUp();
onAttributeCollection.setOdataType("#microsoft.graph.onAttributeCollectionExternalUsersSelfServiceSignUp");
LinkedList<IdentityUserFlowAttribute> attributes = new LinkedList<IdentityUserFlowAttribute>();
IdentityUserFlowAttribute identityUserFlowAttribute = new IdentityUserFlowAttribute();
identityUserFlowAttribute.setId("email");
identityUserFlowAttribute.setDisplayName("Email Address");
identityUserFlowAttribute.setDescription("Email address of the user");
identityUserFlowAttribute.setUserFlowAttributeType(IdentityUserFlowAttributeType.BuiltIn);
identityUserFlowAttribute.setDataType(IdentityUserFlowAttributeDataType.String);
attributes.add(identityUserFlowAttribute);
IdentityUserFlowAttribute identityUserFlowAttribute1 = new IdentityUserFlowAttribute();
identityUserFlowAttribute1.setId("displayName");
identityUserFlowAttribute1.setDisplayName("Display Name");
identityUserFlowAttribute1.setDescription("Display Name of the User.");
identityUserFlowAttribute1.setUserFlowAttributeType(IdentityUserFlowAttributeType.BuiltIn);
identityUserFlowAttribute1.setDataType(IdentityUserFlowAttributeDataType.String);
attributes.add(identityUserFlowAttribute1);
IdentityUserFlowAttribute identityUserFlowAttribute2 = new IdentityUserFlowAttribute();
identityUserFlowAttribute2.setId("extension_6ea3bc85aec24b1c92ff4a117afb6621_Favoritecolor");
identityUserFlowAttribute2.setDisplayName("Favorite color");
identityUserFlowAttribute2.setDescription("what is your favorite color");
identityUserFlowAttribute2.setUserFlowAttributeType(IdentityUserFlowAttributeType.Custom);
identityUserFlowAttribute2.setDataType(IdentityUserFlowAttributeDataType.String);
attributes.add(identityUserFlowAttribute2);
onAttributeCollection.setAttributes(attributes);
AuthenticationAttributeCollectionPage attributeCollectionPage = new AuthenticationAttributeCollectionPage();
LinkedList<AuthenticationAttributeCollectionPageViewConfiguration> views = new LinkedList<AuthenticationAttributeCollectionPageViewConfiguration>();
AuthenticationAttributeCollectionPageViewConfiguration authenticationAttributeCollectionPageViewConfiguration = new AuthenticationAttributeCollectionPageViewConfiguration();
LinkedList<AuthenticationAttributeCollectionInputConfiguration> inputs = new LinkedList<AuthenticationAttributeCollectionInputConfiguration>();
AuthenticationAttributeCollectionInputConfiguration authenticationAttributeCollectionInputConfiguration = new AuthenticationAttributeCollectionInputConfiguration();
authenticationAttributeCollectionInputConfiguration.setAttribute("email");
authenticationAttributeCollectionInputConfiguration.setLabel("Email Address");
authenticationAttributeCollectionInputConfiguration.setInputType(AuthenticationAttributeCollectionInputType.Text);
authenticationAttributeCollectionInputConfiguration.setHidden(true);
authenticationAttributeCollectionInputConfiguration.setEditable(false);
authenticationAttributeCollectionInputConfiguration.setWriteToDirectory(true);
authenticationAttributeCollectionInputConfiguration.setRequired(true);
authenticationAttributeCollectionInputConfiguration.setValidationRegEx("^[a-zA-Z0-9.!#$%&’'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:.[a-zA-Z0-9-]+)*$");
inputs.add(authenticationAttributeCollectionInputConfiguration);
AuthenticationAttributeCollectionInputConfiguration authenticationAttributeCollectionInputConfiguration1 = new AuthenticationAttributeCollectionInputConfiguration();
authenticationAttributeCollectionInputConfiguration1.setAttribute("displayName");
authenticationAttributeCollectionInputConfiguration1.setLabel("Display Name");
authenticationAttributeCollectionInputConfiguration1.setInputType(AuthenticationAttributeCollectionInputType.Text);
authenticationAttributeCollectionInputConfiguration1.setHidden(false);
authenticationAttributeCollectionInputConfiguration1.setEditable(true);
authenticationAttributeCollectionInputConfiguration1.setWriteToDirectory(true);
authenticationAttributeCollectionInputConfiguration1.setRequired(false);
authenticationAttributeCollectionInputConfiguration1.setValidationRegEx("^[a-zA-Z_][0-9a-zA-Z_ ]*[0-9a-zA-Z_]+$");
inputs.add(authenticationAttributeCollectionInputConfiguration1);
AuthenticationAttributeCollectionInputConfiguration authenticationAttributeCollectionInputConfiguration2 = new AuthenticationAttributeCollectionInputConfiguration();
authenticationAttributeCollectionInputConfiguration2.setAttribute("extension_6ea3bc85aec24b1c92ff4a117afb6621_Favoritecolor");
authenticationAttributeCollectionInputConfiguration2.setLabel("Favorite color");
authenticationAttributeCollectionInputConfiguration2.setInputType(AuthenticationAttributeCollectionInputType.Text);
authenticationAttributeCollectionInputConfiguration2.setHidden(false);
authenticationAttributeCollectionInputConfiguration2.setEditable(true);
authenticationAttributeCollectionInputConfiguration2.setWriteToDirectory(true);
authenticationAttributeCollectionInputConfiguration2.setRequired(false);
authenticationAttributeCollectionInputConfiguration2.setValidationRegEx("^[a-zA-Z_][0-9a-zA-Z_ ]*[0-9a-zA-Z_]+$");
inputs.add(authenticationAttributeCollectionInputConfiguration2);
authenticationAttributeCollectionPageViewConfiguration.setInputs(inputs);
views.add(authenticationAttributeCollectionPageViewConfiguration);
attributeCollectionPage.setViews(views);
onAttributeCollection.setAttributeCollectionPage(attributeCollectionPage);
authenticationEventsFlow.setOnAttributeCollection(onAttributeCollection);
AuthenticationEventsFlow result = graphClient.identity().authenticationEventsFlows().post(authenticationEventsFlow);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\ExternalUsersSelfServiceSignUpEventsFlow;
use Microsoft\Graph\Beta\Generated\Models\OnAuthenticationMethodLoadStartExternalUsersSelfServiceSignUp;
use Microsoft\Graph\Beta\Generated\Models\IdentityProviderBase;
use Microsoft\Graph\Beta\Generated\Models\OnInteractiveAuthFlowStartExternalUsersSelfServiceSignUp;
use Microsoft\Graph\Beta\Generated\Models\OnAttributeCollectionExternalUsersSelfServiceSignUp;
use Microsoft\Graph\Beta\Generated\Models\IdentityUserFlowAttribute;
use Microsoft\Graph\Beta\Generated\Models\IdentityUserFlowAttributeType;
use Microsoft\Graph\Beta\Generated\Models\IdentityUserFlowAttributeDataType;
use Microsoft\Graph\Beta\Generated\Models\AuthenticationAttributeCollectionPage;
use Microsoft\Graph\Beta\Generated\Models\AuthenticationAttributeCollectionPageViewConfiguration;
use Microsoft\Graph\Beta\Generated\Models\AuthenticationAttributeCollectionInputConfiguration;
use Microsoft\Graph\Beta\Generated\Models\AuthenticationAttributeCollectionInputType;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new ExternalUsersSelfServiceSignUpEventsFlow();
$requestBody->setOdataType('#microsoft.graph.externalUsersSelfServiceSignUpEventsFlow');
$requestBody->setDisplayName('Woodgrove User Flow 2');
$onAuthenticationMethodLoadStart = new OnAuthenticationMethodLoadStartExternalUsersSelfServiceSignUp();
$onAuthenticationMethodLoadStart->setOdataType('#microsoft.graph.onAuthenticationMethodLoadStartExternalUsersSelfServiceSignUp');
$identityProvidersIdentityProviderBase1 = new IdentityProviderBase();
$identityProvidersIdentityProviderBase1->setId('EmailPassword-OAUTH');
$identityProvidersArray []= $identityProvidersIdentityProviderBase1;
$identityProvidersIdentityProviderBase2 = new IdentityProviderBase();
$identityProvidersIdentityProviderBase2->setId('Google-OAUTH');
$identityProvidersArray []= $identityProvidersIdentityProviderBase2;
$identityProvidersIdentityProviderBase3 = new IdentityProviderBase();
$identityProvidersIdentityProviderBase3->setId('Facebook-OAUTH');
$identityProvidersArray []= $identityProvidersIdentityProviderBase3;
$onAuthenticationMethodLoadStart->setIdentityProviders($identityProvidersArray);
$requestBody->setOnAuthenticationMethodLoadStart($onAuthenticationMethodLoadStart);
$onInteractiveAuthFlowStart = new OnInteractiveAuthFlowStartExternalUsersSelfServiceSignUp();
$onInteractiveAuthFlowStart->setOdataType('#microsoft.graph.onInteractiveAuthFlowStartExternalUsersSelfServiceSignUp');
$onInteractiveAuthFlowStart->setIsSignUpAllowed(true);
$requestBody->setOnInteractiveAuthFlowStart($onInteractiveAuthFlowStart);
$onAttributeCollection = new OnAttributeCollectionExternalUsersSelfServiceSignUp();
$onAttributeCollection->setOdataType('#microsoft.graph.onAttributeCollectionExternalUsersSelfServiceSignUp');
$attributesIdentityUserFlowAttribute1 = new IdentityUserFlowAttribute();
$attributesIdentityUserFlowAttribute1->setId('email');
$attributesIdentityUserFlowAttribute1->setDisplayName('Email Address');
$attributesIdentityUserFlowAttribute1->setDescription('Email address of the user');
$attributesIdentityUserFlowAttribute1->setUserFlowAttributeType(new IdentityUserFlowAttributeType('builtIn'));
$attributesIdentityUserFlowAttribute1->setDataType(new IdentityUserFlowAttributeDataType('string'));
$attributesArray []= $attributesIdentityUserFlowAttribute1;
$attributesIdentityUserFlowAttribute2 = new IdentityUserFlowAttribute();
$attributesIdentityUserFlowAttribute2->setId('displayName');
$attributesIdentityUserFlowAttribute2->setDisplayName('Display Name');
$attributesIdentityUserFlowAttribute2->setDescription('Display Name of the User.');
$attributesIdentityUserFlowAttribute2->setUserFlowAttributeType(new IdentityUserFlowAttributeType('builtIn'));
$attributesIdentityUserFlowAttribute2->setDataType(new IdentityUserFlowAttributeDataType('string'));
$attributesArray []= $attributesIdentityUserFlowAttribute2;
$attributesIdentityUserFlowAttribute3 = new IdentityUserFlowAttribute();
$attributesIdentityUserFlowAttribute3->setId('extension_6ea3bc85aec24b1c92ff4a117afb6621_Favoritecolor');
$attributesIdentityUserFlowAttribute3->setDisplayName('Favorite color');
$attributesIdentityUserFlowAttribute3->setDescription('what is your favorite color');
$attributesIdentityUserFlowAttribute3->setUserFlowAttributeType(new IdentityUserFlowAttributeType('custom'));
$attributesIdentityUserFlowAttribute3->setDataType(new IdentityUserFlowAttributeDataType('string'));
$attributesArray []= $attributesIdentityUserFlowAttribute3;
$onAttributeCollection->setAttributes($attributesArray);
$onAttributeCollectionAttributeCollectionPage = new AuthenticationAttributeCollectionPage();
$viewsAuthenticationAttributeCollectionPageViewConfiguration1 = new AuthenticationAttributeCollectionPageViewConfiguration();
$inputsAuthenticationAttributeCollectionInputConfiguration1 = new AuthenticationAttributeCollectionInputConfiguration();
$inputsAuthenticationAttributeCollectionInputConfiguration1->setAttribute('email');
$inputsAuthenticationAttributeCollectionInputConfiguration1->setLabel('Email Address');
$inputsAuthenticationAttributeCollectionInputConfiguration1->setInputType(new AuthenticationAttributeCollectionInputType('text'));
$inputsAuthenticationAttributeCollectionInputConfiguration1->setHidden(true);
$inputsAuthenticationAttributeCollectionInputConfiguration1->setEditable(false);
$inputsAuthenticationAttributeCollectionInputConfiguration1->setWriteToDirectory(true);
$inputsAuthenticationAttributeCollectionInputConfiguration1->setRequired(true);
$inputsAuthenticationAttributeCollectionInputConfiguration1->setValidationRegEx('^[a-zA-Z0-9.!#$%&’\'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:.[a-zA-Z0-9-]+)*$');
$inputsArray []= $inputsAuthenticationAttributeCollectionInputConfiguration1;
$inputsAuthenticationAttributeCollectionInputConfiguration2 = new AuthenticationAttributeCollectionInputConfiguration();
$inputsAuthenticationAttributeCollectionInputConfiguration2->setAttribute('displayName');
$inputsAuthenticationAttributeCollectionInputConfiguration2->setLabel('Display Name');
$inputsAuthenticationAttributeCollectionInputConfiguration2->setInputType(new AuthenticationAttributeCollectionInputType('text'));
$inputsAuthenticationAttributeCollectionInputConfiguration2->setHidden(false);
$inputsAuthenticationAttributeCollectionInputConfiguration2->setEditable(true);
$inputsAuthenticationAttributeCollectionInputConfiguration2->setWriteToDirectory(true);
$inputsAuthenticationAttributeCollectionInputConfiguration2->setRequired(false);
$inputsAuthenticationAttributeCollectionInputConfiguration2->setValidationRegEx('^[a-zA-Z_][0-9a-zA-Z_ ]*[0-9a-zA-Z_]+$');
$inputsArray []= $inputsAuthenticationAttributeCollectionInputConfiguration2;
$inputsAuthenticationAttributeCollectionInputConfiguration3 = new AuthenticationAttributeCollectionInputConfiguration();
$inputsAuthenticationAttributeCollectionInputConfiguration3->setAttribute('extension_6ea3bc85aec24b1c92ff4a117afb6621_Favoritecolor');
$inputsAuthenticationAttributeCollectionInputConfiguration3->setLabel('Favorite color');
$inputsAuthenticationAttributeCollectionInputConfiguration3->setInputType(new AuthenticationAttributeCollectionInputType('text'));
$inputsAuthenticationAttributeCollectionInputConfiguration3->setHidden(false);
$inputsAuthenticationAttributeCollectionInputConfiguration3->setEditable(true);
$inputsAuthenticationAttributeCollectionInputConfiguration3->setWriteToDirectory(true);
$inputsAuthenticationAttributeCollectionInputConfiguration3->setRequired(false);
$inputsAuthenticationAttributeCollectionInputConfiguration3->setValidationRegEx('^[a-zA-Z_][0-9a-zA-Z_ ]*[0-9a-zA-Z_]+$');
$inputsArray []= $inputsAuthenticationAttributeCollectionInputConfiguration3;
$viewsAuthenticationAttributeCollectionPageViewConfiguration1->setInputs($inputsArray);
$viewsArray []= $viewsAuthenticationAttributeCollectionPageViewConfiguration1;
$onAttributeCollectionAttributeCollectionPage->setViews($viewsArray);
$onAttributeCollection->setAttributeCollectionPage($onAttributeCollectionAttributeCollectionPage);
$requestBody->setOnAttributeCollection($onAttributeCollection);
$result = $graphServiceClient->identity()->authenticationEventsFlows()->post($requestBody)->wait();
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.models.external_users_self_service_sign_up_events_flow import ExternalUsersSelfServiceSignUpEventsFlow
from msgraph_beta.generated.models.on_authentication_method_load_start_external_users_self_service_sign_up import OnAuthenticationMethodLoadStartExternalUsersSelfServiceSignUp
from msgraph_beta.generated.models.identity_provider_base import IdentityProviderBase
from msgraph_beta.generated.models.on_interactive_auth_flow_start_external_users_self_service_sign_up import OnInteractiveAuthFlowStartExternalUsersSelfServiceSignUp
from msgraph_beta.generated.models.on_attribute_collection_external_users_self_service_sign_up import OnAttributeCollectionExternalUsersSelfServiceSignUp
from msgraph_beta.generated.models.identity_user_flow_attribute import IdentityUserFlowAttribute
from msgraph_beta.generated.models.identity_user_flow_attribute_type import IdentityUserFlowAttributeType
from msgraph_beta.generated.models.identity_user_flow_attribute_data_type import IdentityUserFlowAttributeDataType
from msgraph_beta.generated.models.authentication_attribute_collection_page import AuthenticationAttributeCollectionPage
from msgraph_beta.generated.models.authentication_attribute_collection_page_view_configuration import AuthenticationAttributeCollectionPageViewConfiguration
from msgraph_beta.generated.models.authentication_attribute_collection_input_configuration import AuthenticationAttributeCollectionInputConfiguration
from msgraph_beta.generated.models.authentication_attribute_collection_input_type import AuthenticationAttributeCollectionInputType
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = ExternalUsersSelfServiceSignUpEventsFlow(
odata_type = "#microsoft.graph.externalUsersSelfServiceSignUpEventsFlow",
display_name = "Woodgrove User Flow 2",
on_authentication_method_load_start = OnAuthenticationMethodLoadStartExternalUsersSelfServiceSignUp(
odata_type = "#microsoft.graph.onAuthenticationMethodLoadStartExternalUsersSelfServiceSignUp",
identity_providers = [
IdentityProviderBase(
id = "EmailPassword-OAUTH",
),
IdentityProviderBase(
id = "Google-OAUTH",
),
IdentityProviderBase(
id = "Facebook-OAUTH",
),
],
),
on_interactive_auth_flow_start = OnInteractiveAuthFlowStartExternalUsersSelfServiceSignUp(
odata_type = "#microsoft.graph.onInteractiveAuthFlowStartExternalUsersSelfServiceSignUp",
is_sign_up_allowed = True,
),
on_attribute_collection = OnAttributeCollectionExternalUsersSelfServiceSignUp(
odata_type = "#microsoft.graph.onAttributeCollectionExternalUsersSelfServiceSignUp",
attributes = [
IdentityUserFlowAttribute(
id = "email",
display_name = "Email Address",
description = "Email address of the user",
user_flow_attribute_type = IdentityUserFlowAttributeType.BuiltIn,
data_type = IdentityUserFlowAttributeDataType.String,
),
IdentityUserFlowAttribute(
id = "displayName",
display_name = "Display Name",
description = "Display Name of the User.",
user_flow_attribute_type = IdentityUserFlowAttributeType.BuiltIn,
data_type = IdentityUserFlowAttributeDataType.String,
),
IdentityUserFlowAttribute(
id = "extension_6ea3bc85aec24b1c92ff4a117afb6621_Favoritecolor",
display_name = "Favorite color",
description = "what is your favorite color",
user_flow_attribute_type = IdentityUserFlowAttributeType.Custom,
data_type = IdentityUserFlowAttributeDataType.String,
),
],
attribute_collection_page = AuthenticationAttributeCollectionPage(
views = [
AuthenticationAttributeCollectionPageViewConfiguration(
inputs = [
AuthenticationAttributeCollectionInputConfiguration(
attribute = "email",
label = "Email Address",
input_type = AuthenticationAttributeCollectionInputType.Text,
hidden = True,
editable = False,
write_to_directory = True,
required = True,
validation_reg_ex = "^[a-zA-Z0-9.!#$%&’'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:.[a-zA-Z0-9-]+)*$",
),
AuthenticationAttributeCollectionInputConfiguration(
attribute = "displayName",
label = "Display Name",
input_type = AuthenticationAttributeCollectionInputType.Text,
hidden = False,
editable = True,
write_to_directory = True,
required = False,
validation_reg_ex = "^[a-zA-Z_][0-9a-zA-Z_ ]*[0-9a-zA-Z_]+$",
),
AuthenticationAttributeCollectionInputConfiguration(
attribute = "extension_6ea3bc85aec24b1c92ff4a117afb6621_Favoritecolor",
label = "Favorite color",
input_type = AuthenticationAttributeCollectionInputType.Text,
hidden = False,
editable = True,
write_to_directory = True,
required = False,
validation_reg_ex = "^[a-zA-Z_][0-9a-zA-Z_ ]*[0-9a-zA-Z_]+$",
),
],
),
],
),
),
)
result = await graph_client.identity.authentication_events_flows.post(request_body)
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.