A 207 Multi-Status response code indicates that only some of the added externalActivity instances were successfully processed. The caller should inspect the response payload, looking at the error field for each externalActivityResult to determine why the externalActivity instance was not processed and what action can be taken. A nullerror property indicates a successful externalActivityResult.
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.External.Connections.Item.Items.Item.MicrosoftGraphExternalConnectorsAddActivities;
using Microsoft.Graph.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 version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
com.microsoft.graph.external.connections.item.items.item.microsoftgraphexternalconnectorsaddactivities.AddActivitiesPostRequestBody addActivitiesPostRequestBody = new com.microsoft.graph.external.connections.item.items.item.microsoftgraphexternalconnectorsaddactivities.AddActivitiesPostRequestBody();
LinkedList<com.microsoft.graph.models.externalconnectors.ExternalActivity> activities = new LinkedList<com.microsoft.graph.models.externalconnectors.ExternalActivity>();
com.microsoft.graph.models.externalconnectors.ExternalActivity externalActivity = new com.microsoft.graph.models.externalconnectors.ExternalActivity();
externalActivity.setOdataType("#microsoft.graph.externalConnectors.externalActivity");
externalActivity.setType(com.microsoft.graph.models.externalconnectors.ExternalActivityType.Created);
OffsetDateTime startDateTime = OffsetDateTime.parse("2021-04-06T18:04:31.033Z");
externalActivity.setStartDateTime(startDateTime);
com.microsoft.graph.models.externalconnectors.Identity performedBy = new com.microsoft.graph.models.externalconnectors.Identity();
performedBy.setType(com.microsoft.graph.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);
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see: https://aka.ms/ContentUserFeedback.