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.
Create a new authenticationEventListener object. You can create one of the following subtypes that are derived from authenticationEventListener.
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.
You can specify the following properties when creating an authenticationEventListener. You must specify the @odata.type property to specify the type of authenticationEventListener to create; for example, @odata.type": "microsoft.graph.onTokenIssuanceStartListener".
Property
Type
Description
authenticationEventsFlowId
String
The identifier of the authentication events flow. Optional.
The handler to invoke when conditions are met. Can be set for the onUserCreateStartListener listener type.
priority
Int32
The priority of this handler. Between 0 (lower priority) and 1000 (higher priority). Required.
Response
If successful, this method returns a 201 Created response code and an authenticationEventListener object in the response body. The @odata.type property specifies the type of the created object.
Examples
Example 1: Create an onTokenIssuanceStartListener object
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new OnTokenIssuanceStartListener
{
OdataType = "#microsoft.graph.onTokenIssuanceStartListener",
Conditions = new AuthenticationConditions
{
Applications = new AuthenticationConditionsApplications
{
IncludeAllApplications = false,
IncludeApplications = new List<AuthenticationConditionApplication>
{
new AuthenticationConditionApplication
{
AppId = "a13d0fc1-04ab-4ede-b215-63de0174cbb4",
},
},
},
},
Priority = 500,
Handler = new OnTokenIssuanceStartCustomExtensionHandler
{
OdataType = "#microsoft.graph.onTokenIssuanceStartCustomExtensionHandler",
CustomExtension = new OnTokenIssuanceStartCustomExtension
{
Id = "6fc5012e-7665-43d6-9708-4370863f4e6e",
},
},
};
// To initialize your graphClient, see https://video2.skills-academy.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Identity.AuthenticationEventListeners.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.
// 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"
graphmodels "github.com/microsoftgraph/msgraph-beta-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewAuthenticationEventListener()
conditions := graphmodels.NewAuthenticationConditions()
applications := graphmodels.NewAuthenticationConditionsApplications()
includeAllApplications := false
applications.SetIncludeAllApplications(&includeAllApplications)
authenticationConditionApplication := graphmodels.NewAuthenticationConditionApplication()
appId := "a13d0fc1-04ab-4ede-b215-63de0174cbb4"
authenticationConditionApplication.SetAppId(&appId)
includeApplications := []graphmodels.AuthenticationConditionApplicationable {
authenticationConditionApplication,
}
applications.SetIncludeApplications(includeApplications)
conditions.SetApplications(applications)
requestBody.SetConditions(conditions)
priority := int32(500)
requestBody.SetPriority(&priority)
handler := graphmodels.NewOnTokenIssuanceStartCustomExtensionHandler()
customExtension := graphmodels.NewOnTokenIssuanceStartCustomExtension()
id := "6fc5012e-7665-43d6-9708-4370863f4e6e"
customExtension.SetId(&id)
handler.SetCustomExtension(customExtension)
requestBody.SetHandler(handler)
// To initialize your graphClient, see https://video2.skills-academy.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
authenticationEventListeners, err := graphClient.Identity().AuthenticationEventListeners().Post(context.Background(), requestBody, nil)
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 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
OnTokenIssuanceStartListener authenticationEventListener = new OnTokenIssuanceStartListener();
authenticationEventListener.setOdataType("#microsoft.graph.onTokenIssuanceStartListener");
AuthenticationConditions conditions = new AuthenticationConditions();
AuthenticationConditionsApplications applications = new AuthenticationConditionsApplications();
applications.setIncludeAllApplications(false);
LinkedList<AuthenticationConditionApplication> includeApplications = new LinkedList<AuthenticationConditionApplication>();
AuthenticationConditionApplication authenticationConditionApplication = new AuthenticationConditionApplication();
authenticationConditionApplication.setAppId("a13d0fc1-04ab-4ede-b215-63de0174cbb4");
includeApplications.add(authenticationConditionApplication);
applications.setIncludeApplications(includeApplications);
conditions.setApplications(applications);
authenticationEventListener.setConditions(conditions);
authenticationEventListener.setPriority(500);
OnTokenIssuanceStartCustomExtensionHandler handler = new OnTokenIssuanceStartCustomExtensionHandler();
handler.setOdataType("#microsoft.graph.onTokenIssuanceStartCustomExtensionHandler");
OnTokenIssuanceStartCustomExtension customExtension = new OnTokenIssuanceStartCustomExtension();
customExtension.setId("6fc5012e-7665-43d6-9708-4370863f4e6e");
handler.setCustomExtension(customExtension);
authenticationEventListener.setHandler(handler);
AuthenticationEventListener result = graphClient.identity().authenticationEventListeners().post(authenticationEventListener);
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\OnTokenIssuanceStartListener;
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\OnTokenIssuanceStartCustomExtensionHandler;
use Microsoft\Graph\Beta\Generated\Models\OnTokenIssuanceStartCustomExtension;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new OnTokenIssuanceStartListener();
$requestBody->setOdataType('#microsoft.graph.onTokenIssuanceStartListener');
$conditions = new AuthenticationConditions();
$conditionsApplications = new AuthenticationConditionsApplications();
$conditionsApplications->setIncludeAllApplications(false);
$includeApplicationsAuthenticationConditionApplication1 = new AuthenticationConditionApplication();
$includeApplicationsAuthenticationConditionApplication1->setAppId('a13d0fc1-04ab-4ede-b215-63de0174cbb4');
$includeApplicationsArray []= $includeApplicationsAuthenticationConditionApplication1;
$conditionsApplications->setIncludeApplications($includeApplicationsArray);
$conditions->setApplications($conditionsApplications);
$requestBody->setConditions($conditions);
$requestBody->setPriority(500);
$handler = new OnTokenIssuanceStartCustomExtensionHandler();
$handler->setOdataType('#microsoft.graph.onTokenIssuanceStartCustomExtensionHandler');
$handlerCustomExtension = new OnTokenIssuanceStartCustomExtension();
$handlerCustomExtension->setId('6fc5012e-7665-43d6-9708-4370863f4e6e');
$handler->setCustomExtension($handlerCustomExtension);
$requestBody->setHandler($handler);
$result = $graphServiceClient->identity()->authenticationEventListeners()->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.on_token_issuance_start_listener import OnTokenIssuanceStartListener
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_token_issuance_start_custom_extension_handler import OnTokenIssuanceStartCustomExtensionHandler
from msgraph_beta.generated.models.on_token_issuance_start_custom_extension import OnTokenIssuanceStartCustomExtension
# To initialize your graph_client, see https://video2.skills-academy.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = OnTokenIssuanceStartListener(
odata_type = "#microsoft.graph.onTokenIssuanceStartListener",
conditions = AuthenticationConditions(
applications = AuthenticationConditionsApplications(
include_all_applications = False,
include_applications = [
AuthenticationConditionApplication(
app_id = "a13d0fc1-04ab-4ede-b215-63de0174cbb4",
),
],
),
),
priority = 500,
handler = OnTokenIssuanceStartCustomExtensionHandler(
odata_type = "#microsoft.graph.onTokenIssuanceStartCustomExtensionHandler",
custom_extension = OnTokenIssuanceStartCustomExtension(
id = "6fc5012e-7665-43d6-9708-4370863f4e6e",
),
),
)
result = await graph_client.identity.authentication_event_listeners.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 OnAttributeCollectionStartListener
{
OdataType = "#microsoft.graph.onAttributeCollectionStartListener",
Priority = 500,
Conditions = new AuthenticationConditions
{
Applications = new AuthenticationConditionsApplications
{
IncludeAllApplications = false,
IncludeApplications = new List<AuthenticationConditionApplication>
{
new AuthenticationConditionApplication
{
AppId = "a7eed01f-a333-4983-bc6b-d359ec9e5eef",
},
},
},
},
Handler = new OnAttributeCollectionStartCustomExtensionHandler
{
OdataType = "#microsoft.graph.onAttributeCollectionStartCustomExtensionHandler",
CustomExtension = new OnAttributeCollectionStartCustomExtension
{
Id = "2d9c3e8d-88a9-444e-8c4c-f0c6c4fe1c02",
},
},
};
// To initialize your graphClient, see https://video2.skills-academy.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Identity.AuthenticationEventListeners.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.
// 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"
graphmodels "github.com/microsoftgraph/msgraph-beta-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewAuthenticationEventListener()
priority := int32(500)
requestBody.SetPriority(&priority)
conditions := graphmodels.NewAuthenticationConditions()
applications := graphmodels.NewAuthenticationConditionsApplications()
includeAllApplications := false
applications.SetIncludeAllApplications(&includeAllApplications)
authenticationConditionApplication := graphmodels.NewAuthenticationConditionApplication()
appId := "a7eed01f-a333-4983-bc6b-d359ec9e5eef"
authenticationConditionApplication.SetAppId(&appId)
includeApplications := []graphmodels.AuthenticationConditionApplicationable {
authenticationConditionApplication,
}
applications.SetIncludeApplications(includeApplications)
conditions.SetApplications(applications)
requestBody.SetConditions(conditions)
handler := graphmodels.NewOnAttributeCollectionStartCustomExtensionHandler()
customExtension := graphmodels.NewOnAttributeCollectionStartCustomExtension()
id := "2d9c3e8d-88a9-444e-8c4c-f0c6c4fe1c02"
customExtension.SetId(&id)
handler.SetCustomExtension(customExtension)
requestBody.SetHandler(handler)
// To initialize your graphClient, see https://video2.skills-academy.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
authenticationEventListeners, err := graphClient.Identity().AuthenticationEventListeners().Post(context.Background(), requestBody, nil)
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 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
OnAttributeCollectionStartListener authenticationEventListener = new OnAttributeCollectionStartListener();
authenticationEventListener.setOdataType("#microsoft.graph.onAttributeCollectionStartListener");
authenticationEventListener.setPriority(500);
AuthenticationConditions conditions = new AuthenticationConditions();
AuthenticationConditionsApplications applications = new AuthenticationConditionsApplications();
applications.setIncludeAllApplications(false);
LinkedList<AuthenticationConditionApplication> includeApplications = new LinkedList<AuthenticationConditionApplication>();
AuthenticationConditionApplication authenticationConditionApplication = new AuthenticationConditionApplication();
authenticationConditionApplication.setAppId("a7eed01f-a333-4983-bc6b-d359ec9e5eef");
includeApplications.add(authenticationConditionApplication);
applications.setIncludeApplications(includeApplications);
conditions.setApplications(applications);
authenticationEventListener.setConditions(conditions);
OnAttributeCollectionStartCustomExtensionHandler handler = new OnAttributeCollectionStartCustomExtensionHandler();
handler.setOdataType("#microsoft.graph.onAttributeCollectionStartCustomExtensionHandler");
OnAttributeCollectionStartCustomExtension customExtension = new OnAttributeCollectionStartCustomExtension();
customExtension.setId("2d9c3e8d-88a9-444e-8c4c-f0c6c4fe1c02");
handler.setCustomExtension(customExtension);
authenticationEventListener.setHandler(handler);
AuthenticationEventListener result = graphClient.identity().authenticationEventListeners().post(authenticationEventListener);
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\OnAttributeCollectionStartListener;
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\OnAttributeCollectionStartCustomExtensionHandler;
use Microsoft\Graph\Beta\Generated\Models\OnAttributeCollectionStartCustomExtension;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new OnAttributeCollectionStartListener();
$requestBody->setOdataType('#microsoft.graph.onAttributeCollectionStartListener');
$requestBody->setPriority(500);
$conditions = new AuthenticationConditions();
$conditionsApplications = new AuthenticationConditionsApplications();
$conditionsApplications->setIncludeAllApplications(false);
$includeApplicationsAuthenticationConditionApplication1 = new AuthenticationConditionApplication();
$includeApplicationsAuthenticationConditionApplication1->setAppId('a7eed01f-a333-4983-bc6b-d359ec9e5eef');
$includeApplicationsArray []= $includeApplicationsAuthenticationConditionApplication1;
$conditionsApplications->setIncludeApplications($includeApplicationsArray);
$conditions->setApplications($conditionsApplications);
$requestBody->setConditions($conditions);
$handler = new OnAttributeCollectionStartCustomExtensionHandler();
$handler->setOdataType('#microsoft.graph.onAttributeCollectionStartCustomExtensionHandler');
$handlerCustomExtension = new OnAttributeCollectionStartCustomExtension();
$handlerCustomExtension->setId('2d9c3e8d-88a9-444e-8c4c-f0c6c4fe1c02');
$handler->setCustomExtension($handlerCustomExtension);
$requestBody->setHandler($handler);
$result = $graphServiceClient->identity()->authenticationEventListeners()->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.on_attribute_collection_start_listener import OnAttributeCollectionStartListener
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_attribute_collection_start_custom_extension_handler import OnAttributeCollectionStartCustomExtensionHandler
from msgraph_beta.generated.models.on_attribute_collection_start_custom_extension import OnAttributeCollectionStartCustomExtension
# To initialize your graph_client, see https://video2.skills-academy.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = OnAttributeCollectionStartListener(
odata_type = "#microsoft.graph.onAttributeCollectionStartListener",
priority = 500,
conditions = AuthenticationConditions(
applications = AuthenticationConditionsApplications(
include_all_applications = False,
include_applications = [
AuthenticationConditionApplication(
app_id = "a7eed01f-a333-4983-bc6b-d359ec9e5eef",
),
],
),
),
handler = OnAttributeCollectionStartCustomExtensionHandler(
odata_type = "#microsoft.graph.onAttributeCollectionStartCustomExtensionHandler",
custom_extension = OnAttributeCollectionStartCustomExtension(
id = "2d9c3e8d-88a9-444e-8c4c-f0c6c4fe1c02",
),
),
)
result = await graph_client.identity.authentication_event_listeners.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 OnAttributeCollectionSubmitListener
{
OdataType = "#microsoft.graph.onAttributeCollectionSubmitListener",
Priority = 500,
Conditions = new AuthenticationConditions
{
Applications = new AuthenticationConditionsApplications
{
IncludeAllApplications = false,
IncludeApplications = new List<AuthenticationConditionApplication>
{
new AuthenticationConditionApplication
{
AppId = "a7eed01f-a333-4983-bc6b-d359ec9e5eef",
},
},
},
},
Handler = new OnAttributeCollectionSubmitCustomExtensionHandler
{
OdataType = "#microsoft.graph.onAttributeCollectionSubmitCustomExtensionHandler",
CustomExtension = new OnAttributeCollectionSubmitCustomExtension
{
Id = "66867d1f-7824-4f38-aad1-75da1ad09ee2",
},
},
};
// To initialize your graphClient, see https://video2.skills-academy.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Identity.AuthenticationEventListeners.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.
// 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"
graphmodels "github.com/microsoftgraph/msgraph-beta-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewAuthenticationEventListener()
priority := int32(500)
requestBody.SetPriority(&priority)
conditions := graphmodels.NewAuthenticationConditions()
applications := graphmodels.NewAuthenticationConditionsApplications()
includeAllApplications := false
applications.SetIncludeAllApplications(&includeAllApplications)
authenticationConditionApplication := graphmodels.NewAuthenticationConditionApplication()
appId := "a7eed01f-a333-4983-bc6b-d359ec9e5eef"
authenticationConditionApplication.SetAppId(&appId)
includeApplications := []graphmodels.AuthenticationConditionApplicationable {
authenticationConditionApplication,
}
applications.SetIncludeApplications(includeApplications)
conditions.SetApplications(applications)
requestBody.SetConditions(conditions)
handler := graphmodels.NewOnAttributeCollectionSubmitCustomExtensionHandler()
customExtension := graphmodels.NewOnAttributeCollectionSubmitCustomExtension()
id := "66867d1f-7824-4f38-aad1-75da1ad09ee2"
customExtension.SetId(&id)
handler.SetCustomExtension(customExtension)
requestBody.SetHandler(handler)
// To initialize your graphClient, see https://video2.skills-academy.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
authenticationEventListeners, err := graphClient.Identity().AuthenticationEventListeners().Post(context.Background(), requestBody, nil)
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 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
OnAttributeCollectionSubmitListener authenticationEventListener = new OnAttributeCollectionSubmitListener();
authenticationEventListener.setOdataType("#microsoft.graph.onAttributeCollectionSubmitListener");
authenticationEventListener.setPriority(500);
AuthenticationConditions conditions = new AuthenticationConditions();
AuthenticationConditionsApplications applications = new AuthenticationConditionsApplications();
applications.setIncludeAllApplications(false);
LinkedList<AuthenticationConditionApplication> includeApplications = new LinkedList<AuthenticationConditionApplication>();
AuthenticationConditionApplication authenticationConditionApplication = new AuthenticationConditionApplication();
authenticationConditionApplication.setAppId("a7eed01f-a333-4983-bc6b-d359ec9e5eef");
includeApplications.add(authenticationConditionApplication);
applications.setIncludeApplications(includeApplications);
conditions.setApplications(applications);
authenticationEventListener.setConditions(conditions);
OnAttributeCollectionSubmitCustomExtensionHandler handler = new OnAttributeCollectionSubmitCustomExtensionHandler();
handler.setOdataType("#microsoft.graph.onAttributeCollectionSubmitCustomExtensionHandler");
OnAttributeCollectionSubmitCustomExtension customExtension = new OnAttributeCollectionSubmitCustomExtension();
customExtension.setId("66867d1f-7824-4f38-aad1-75da1ad09ee2");
handler.setCustomExtension(customExtension);
authenticationEventListener.setHandler(handler);
AuthenticationEventListener result = graphClient.identity().authenticationEventListeners().post(authenticationEventListener);
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\OnAttributeCollectionSubmitListener;
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\OnAttributeCollectionSubmitCustomExtensionHandler;
use Microsoft\Graph\Beta\Generated\Models\OnAttributeCollectionSubmitCustomExtension;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new OnAttributeCollectionSubmitListener();
$requestBody->setOdataType('#microsoft.graph.onAttributeCollectionSubmitListener');
$requestBody->setPriority(500);
$conditions = new AuthenticationConditions();
$conditionsApplications = new AuthenticationConditionsApplications();
$conditionsApplications->setIncludeAllApplications(false);
$includeApplicationsAuthenticationConditionApplication1 = new AuthenticationConditionApplication();
$includeApplicationsAuthenticationConditionApplication1->setAppId('a7eed01f-a333-4983-bc6b-d359ec9e5eef');
$includeApplicationsArray []= $includeApplicationsAuthenticationConditionApplication1;
$conditionsApplications->setIncludeApplications($includeApplicationsArray);
$conditions->setApplications($conditionsApplications);
$requestBody->setConditions($conditions);
$handler = new OnAttributeCollectionSubmitCustomExtensionHandler();
$handler->setOdataType('#microsoft.graph.onAttributeCollectionSubmitCustomExtensionHandler');
$handlerCustomExtension = new OnAttributeCollectionSubmitCustomExtension();
$handlerCustomExtension->setId('66867d1f-7824-4f38-aad1-75da1ad09ee2');
$handler->setCustomExtension($handlerCustomExtension);
$requestBody->setHandler($handler);
$result = $graphServiceClient->identity()->authenticationEventListeners()->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.on_attribute_collection_submit_listener import OnAttributeCollectionSubmitListener
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_attribute_collection_submit_custom_extension_handler import OnAttributeCollectionSubmitCustomExtensionHandler
from msgraph_beta.generated.models.on_attribute_collection_submit_custom_extension import OnAttributeCollectionSubmitCustomExtension
# To initialize your graph_client, see https://video2.skills-academy.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = OnAttributeCollectionSubmitListener(
odata_type = "#microsoft.graph.onAttributeCollectionSubmitListener",
priority = 500,
conditions = AuthenticationConditions(
applications = AuthenticationConditionsApplications(
include_all_applications = False,
include_applications = [
AuthenticationConditionApplication(
app_id = "a7eed01f-a333-4983-bc6b-d359ec9e5eef",
),
],
),
),
handler = OnAttributeCollectionSubmitCustomExtensionHandler(
odata_type = "#microsoft.graph.onAttributeCollectionSubmitCustomExtensionHandler",
custom_extension = OnAttributeCollectionSubmitCustomExtension(
id = "66867d1f-7824-4f38-aad1-75da1ad09ee2",
),
),
)
result = await graph_client.identity.authentication_event_listeners.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.