Espace de noms : microsoft.graph.externalConnectors
Importante
Les API sous la version /beta dans Microsoft Graph sont susceptibles d’être modifiées. L’utilisation de ces API dans des applications de production n’est pas prise en charge. Pour déterminer si une API est disponible dans v1.0, utilisez le sélecteur Version .
L’une des autorisations suivantes est nécessaire pour appeler cette API. Pour plus d’informations, notamment sur la façon de choisir les autorisations, voir Autorisations.
Type d’autorisation
Autorisations (de celle qui offre le plus de privilèges à celle qui en offre le moins)
Un 207 Multi-Status code de réponse indique que seules certaines des instances externalActivity ajoutées ont été traitées avec succès. L’appelant doit inspecter la charge utile de réponse, en examinant le champ d’erreur pour chaque externalActivityResult afin de déterminer pourquoi l’instance externalActivity n’a pas été traitée et quelle action peut être effectuée. Une null propriété d’erreur indique un externalActivityResult réussi.
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.External.Connections.Item.Items.Item.MicrosoftGraphExternalConnectorsAddActivities;
using Microsoft.Graph.Beta.Models.ExternalConnectors;
var requestBody = new AddActivitiesPostRequestBody
{
Activities = new List<ExternalActivity>
{
new ExternalActivity
{
OdataType = "#microsoft.graph.externalConnectors.externalActivity",
Type = ExternalActivityType.Created,
StartDateTime = DateTimeOffset.Parse("2021-04-06T18:04:31.033Z"),
PerformedBy = new Identity
{
Type = IdentityType.User,
Id = "1f0c997e-99f7-43f1-8cca-086f8d42be8d",
},
},
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.External.Connections["{externalConnection-id}"].Items["{externalItem-id}"].MicrosoftGraphExternalConnectorsAddActivities.PostAsAddActivitiesPostResponseAsync(requestBody);
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
graphexternal "github.com/microsoftgraph/msgraph-beta-sdk-go/external"
graphmodelsexternalconnectors "github.com/microsoftgraph/msgraph-beta-sdk-go/models/externalconnectors"
//other-imports
)
requestBody := graphexternal.NewAddActivitiesPostRequestBody()
externalActivity := graphmodelsexternalconnectors.NewExternalActivity()
type := graphmodels.CREATED_EXTERNALACTIVITYTYPE
externalActivity.SetType(&type)
startDateTime , err := time.Parse(time.RFC3339, "2021-04-06T18:04:31.033Z")
externalActivity.SetStartDateTime(&startDateTime)
performedBy := graphmodelsexternalconnectors.NewIdentity()
type := graphmodels.USER_IDENTITYTYPE
performedBy.SetType(&type)
id := "1f0c997e-99f7-43f1-8cca-086f8d42be8d"
performedBy.SetId(&id)
externalActivity.SetPerformedBy(performedBy)
activities := []graphmodelsexternalconnectors.ExternalActivityable {
externalActivity,
}
requestBody.SetActivities(activities)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
microsoftGraphExternalConnectorsAddActivities, err := graphClient.External().Connections().ByExternalConnectionId("externalConnection-id").Items().ByExternalItemId("externalItem-id").MicrosoftGraphExternalConnectorsAddActivities().PostAsAddActivitiesPostResponse(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
com.microsoft.graph.beta.external.connections.item.items.item.microsoftgraphexternalconnectorsaddactivities.AddActivitiesPostRequestBody addActivitiesPostRequestBody = new com.microsoft.graph.beta.external.connections.item.items.item.microsoftgraphexternalconnectorsaddactivities.AddActivitiesPostRequestBody();
LinkedList<com.microsoft.graph.beta.models.externalconnectors.ExternalActivity> activities = new LinkedList<com.microsoft.graph.beta.models.externalconnectors.ExternalActivity>();
com.microsoft.graph.beta.models.externalconnectors.ExternalActivity externalActivity = new com.microsoft.graph.beta.models.externalconnectors.ExternalActivity();
externalActivity.setOdataType("#microsoft.graph.externalConnectors.externalActivity");
externalActivity.setType(com.microsoft.graph.beta.models.externalconnectors.ExternalActivityType.Created);
OffsetDateTime startDateTime = OffsetDateTime.parse("2021-04-06T18:04:31.033Z");
externalActivity.setStartDateTime(startDateTime);
com.microsoft.graph.beta.models.externalconnectors.Identity performedBy = new com.microsoft.graph.beta.models.externalconnectors.Identity();
performedBy.setType(com.microsoft.graph.beta.models.externalconnectors.IdentityType.User);
performedBy.setId("1f0c997e-99f7-43f1-8cca-086f8d42be8d");
externalActivity.setPerformedBy(performedBy);
activities.add(externalActivity);
addActivitiesPostRequestBody.setActivities(activities);
var result = graphClient.external().connections().byExternalConnectionId("{externalConnection-id}").items().byExternalItemId("{externalItem-id}").microsoftGraphExternalConnectorsAddActivities().post(addActivitiesPostRequestBody);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\External\Connections\Item\Items\Item\MicrosoftGraphExternalConnectorsAddActivities\AddActivitiesPostRequestBody;
use Microsoft\Graph\Beta\Generated\Models\ExternalConnectors\ExternalActivity;
use Microsoft\Graph\Beta\Generated\Models\ExternalConnectors\ExternalActivityType;
use Microsoft\Graph\Beta\Generated\Models\ExternalConnectors\Identity;
use Microsoft\Graph\Beta\Generated\Models\ExternalConnectors\IdentityType;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new AddActivitiesPostRequestBody();
$activitiesExternalActivity1 = new ExternalActivity();
$activitiesExternalActivity1->setOdataType('#microsoft.graph.externalConnectors.externalActivity');
$activitiesExternalActivity1->setType(new ExternalActivityType('created'));
$activitiesExternalActivity1->setStartDateTime(new \DateTime('2021-04-06T18:04:31.033Z'));
$activitiesExternalActivity1PerformedBy = new Identity();
$activitiesExternalActivity1PerformedBy->setType(new IdentityType('user'));
$activitiesExternalActivity1PerformedBy->setId('1f0c997e-99f7-43f1-8cca-086f8d42be8d');
$activitiesExternalActivity1->setPerformedBy($activitiesExternalActivity1PerformedBy);
$activitiesArray []= $activitiesExternalActivity1;
$requestBody->setActivities($activitiesArray);
$result = $graphServiceClient->external()->connections()->byExternalConnectionId('externalConnection-id')->items()->byExternalItemId('externalItem-id')->microsoftGraphExternalConnectorsAddActivities()->post($requestBody)->wait();
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.external.connections.item.items.item.microsoft_graph_external_connectors_add_activities.add_activities_post_request_body import AddActivitiesPostRequestBody
from msgraph_beta.generated.models.external_connectors.external_activity import ExternalActivity
from msgraph_beta.generated.models.external_activity_type import ExternalActivityType
from msgraph_beta.generated.models.external_connectors.identity import Identity
from msgraph_beta.generated.models.identity_type import IdentityType
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = AddActivitiesPostRequestBody(
activities = [
ExternalActivity(
odata_type = "#microsoft.graph.externalConnectors.externalActivity",
type = ExternalActivityType.Created,
start_date_time = "2021-04-06T18:04:31.033Z",
performed_by = Identity(
type = IdentityType.User,
id = "1f0c997e-99f7-43f1-8cca-086f8d42be8d",
),
),
],
)
result = await graph_client.external.connections.by_external_connection_id('externalConnection-id').items.by_external_item_id('externalItem-id').microsoft_graph_external_connectors_add_activities.post(request_body)