---
title: "Get operation results"
slug: "get-operation-results"
abstract: "Examples showing how to see a list of all operations that were included in a batch and how to save a reference to a specific operation and inspect it after submitting a batch."
---
# Get operation results

Inspect `client.LastBatch` after successfully submitting a batch to see a list of all operations that were included in that batch.

```csharp
using Sitecore.XConnect;
using Sitecore.XConnect.Client;
using Sitecore.XConnect.Operations;
using System;

namespace Documentation
{
    public class SeeAllExecutedOperations
    {
        // Async Example
        public async void ExampleAsync()
        {
            using (Sitecore.XConnect.Client.XConnectClient client = Sitecore.XConnect.Client.Configuration.SitecoreXConnectClientConfiguration.GetClient())
            {
                try
                {
                    var newContact = new Sitecore.XConnect.Contact();
                    client.AddContact(newContact);

                    Guid channelId = Guid.NewGuid();
                    string userAgent = "Sample User Agent";

                    var interaction = new Sitecore.XConnect.Interaction(newContact, InteractionInitiator.Brand, channelId, userAgent);

                    var fakeItemID = Guid.NewGuid();
                    var fakeItemVersion = 3;

                    Sitecore.XConnect.Collection.Model.PageViewEvent pageView = new Sitecore.XConnect.Collection.Model.PageViewEvent(DateTime.UtcNow, fakeItemID, fakeItemVersion, "en")
                    {
                        Duration = new TimeSpan(0, 0, 30),
                    };

                    interaction.Events.Add(pageView);

                    client.AddInteraction(interaction);

                    await client.SubmitAsync();

                    var allOperations = client.LastBatch;

                    foreach (IXdbOperation op in allOperations)
                    {
                        // Output operation type
                        var operationType = op.OperationType;
                        // Output status
                        var status = op.Status;
                    }
                }
                catch (XdbExecutionException ex)
                {
                    // Handle exception
                }
            }
        }

        // Sync example
        public void ExampleSync()
        {
            using (Sitecore.XConnect.Client.XConnectClient client = Sitecore.XConnect.Client.Configuration.SitecoreXConnectClientConfiguration.GetClient())
            {
                try
                {
                    var newContact = new Sitecore.XConnect.Contact();
                    client.AddContact(newContact);

                    Guid channelId = Guid.NewGuid();
                    string userAgent = "Sample User Agent";

                    var interaction = new Sitecore.XConnect.Interaction(newContact, InteractionInitiator.Brand, channelId, userAgent);

                    var fakeItemID = Guid.NewGuid();
                    var fakeItemVersion = 3;

                    Sitecore.XConnect.Collection.Model.PageViewEvent pageView = new Sitecore.XConnect.Collection.Model.PageViewEvent(DateTime.UtcNow, fakeItemID, fakeItemVersion, "en")
                    {
                        Duration = new TimeSpan(0, 0, 30),
                    };

                    interaction.Events.Add(pageView);

                    client.AddInteraction(interaction);

                    client.Submit();

                    var allOperations = client.LastBatch;

                    foreach (IXdbOperation op in allOperations)
                    {
                        // Output operation type
                        var operationType = op.OperationType;
                        // Output status
                        var status = op.Status;
                    }
                }
                catch (XdbExecutionException ex)
                {
                    // Handle exception
                }
            }
        }
    }
}

```

> [!note]
> Refer to documentation on [exception handling](https://doc.sitecore.com/xp/en/developers/100/sitecore-experience-platform/handling-exceptions.html "Handling exceptions") and [retrying operations](https://doc.sitecore.com/xp/en/developers/100/sitecore-experience-platform/optimistic-concurrency-in-xconnect.html "Optimistic concurrency in xConnect") for information about how to handle failed operations.

<details>
<summary><h2>Get single operation result</h2></summary>

You can also save a reference to a specific operation and inspect it after submitting a batch. For example:

```csharp
using Sitecore.XConnect;
using Sitecore.XConnect.Client;
using Sitecore.XConnect.Operations;
using System;

namespace Documentation
{
    public class SeeSingleOperation
    {
        // Async Example
        public async void ExampleAsync()
        {
            using (Sitecore.XConnect.Client.XConnectClient client = Sitecore.XConnect.Client.Configuration.SitecoreXConnectClientConfiguration.GetClient())
            {
                try
                {
                    var newContact = new Sitecore.XConnect.Contact();
                    client.AddContact(newContact);

                    Guid channelId = Guid.NewGuid();
                    string userAgent = "Sample User Agent";

                    var interaction = new Sitecore.XConnect.Interaction(newContact, InteractionInitiator.Brand, channelId, userAgent);

                    var fakeItemID = Guid.NewGuid();
                    var fakeItemVersion = 3;

                    Sitecore.XConnect.Collection.Model.PageViewEvent pageView = new Sitecore.XConnect.Collection.Model.PageViewEvent(DateTime.UtcNow, fakeItemID, fakeItemVersion, "en")
                    {
                        Duration = new TimeSpan(0, 0, 30),
                    };

                    interaction.Events.Add(pageView);

                    // Save reference to operation
                    var addInteractionOperation = client.AddInteraction(interaction);

                    await client.SubmitAsync();

                    if (addInteractionOperation.Result.Status == SaveResultStatus.Conflict)
                    {
                        // Do something
                    }
                }
                catch (XdbExecutionException ex)
                {
                    // Handle exception
                }
            }
        }

        // Sync example
        public void ExampleSync()
        {
            using (Sitecore.XConnect.Client.XConnectClient client = Sitecore.XConnect.Client.Configuration.SitecoreXConnectClientConfiguration.GetClient())
            {
                try
                {
                    var newContact = new Sitecore.XConnect.Contact();
                    client.AddContact(newContact);

                    Guid channelId = Guid.NewGuid();
                    string userAgent = "Sample User Agent";

                    var interaction = new Sitecore.XConnect.Interaction(newContact, InteractionInitiator.Brand, channelId, userAgent);

                var fakeItemID = Guid.NewGuid();
                var fakeItemVersion = 3;

                Sitecore.XConnect.Collection.Model.PageViewEvent pageView = new Sitecore.XConnect.Collection.Model.PageViewEvent(DateTime.UtcNow, fakeItemID, fakeItemVersion, "en")
                {
                    Duration = new TimeSpan(0, 0, 30),
                };

                interaction.Events.Add(pageView);

                // Save reference to operation
                var addInteractionOperation = client.AddInteraction(interaction);

                client.Submit();

                if (addInteractionOperation.Result.Status == SaveResultStatus.Conflict)
                {
                    // Do something
                }
            }
            catch (XdbExecutionException ex)
            {
                // Handle exception
            }
        }
    }
}

```

</details>