DeviceRepositoryV3.GetArchivedWithParents Method

Get archived devices with special data for Client tree.

Namespace: Gamanet.C4.SDK
Assembly: Gamanet.C4.SimpleClient (in Gamanet.C4.SimpleClient.dll) Version: 2026.0.0.733
Syntax
C#
public ISimpleCollection<SimpleDeviceV1> GetArchivedWithParents()

Return Value

ISimpleCollection<SimpleDeviceV1>
Collection of devices

Implements

ISimpleClientDeviceRepositoryV3.GetArchivedWithParents()
Example
The following example illustrates how SimpleClient filter all devices parents
C#
using System;
using Gamanet.C4.SDK;
using Gamanet.C4.SimpleInterfaces;

public class Example
{
    static void Main()
    {
        // Create instance of simple client
        var client = new SimpleClient(ConnectorConfiguration.HttpClient);

        ConnectionInfoV1 token;
        // Connect to local server
        var connectionResult = client.Connect(new Uri("https://localhost/"), "Support", "support", out token);

        if (connectionResult != ConnectionResult.Successful)
        {
            Console.WriteLine("Connection unsuccessful, result: {0}", connectionResult);
            return;
        }

        Console.WriteLine("Connection result: {0}", connectionResult);
        Console.WriteLine();

        // You need to have installed the Demo Access Device package from https://my.c4portal.com/plugins/
        var exampleBusCategory = client.EntityDefinitions.Get(Guid.Parse("4810e0c6-9391-490c-a646-ca9643dd1ca5")).Id;
        var examplePanelCategory = client.EntityDefinitions.Get(Guid.Parse("822caeea-b66b-4f60-ab43-bc14240cb6ec")).Id;
        var exampleDoorCategory = client.EntityDefinitions.Get(Guid.Parse("dcd0cea7-8de9-4458-afa7-cd1e94b56028")).Id;

        // Create the Example Device (Bus Controller)
        var exampleBusController = new SimpleDeviceV1(
            Guid.NewGuid(),
            "BUS",
            EntityRoot.Device,
            exampleBusCategory
        );

        // Create the Example Device (Panel)
        var examplePanel = new SimpleDeviceV1(
            Guid.NewGuid(),
            "PANEL",
            exampleBusController.Id,
            examplePanelCategory
        );

        // Create the Example Device (Door)
        var exampleDoor = new SimpleDeviceV1(
            Guid.NewGuid(),
            "DOOR",
            examplePanel.Id,
            exampleDoorCategory
        );
        // Create devices in db
        client.Devices.Create(exampleBusController);
        client.Devices.Create(examplePanel);
        client.Devices.Create(exampleDoor);

        // Archive door device
        client.Devices.Archive(exampleDoor);

        // Check whether devices were created and print out their name and Archived status
        var devices = client.Devices.GetAll(EntityRoot.DeviceSuperRoot, Properties.All, true);
        foreach ( var device in devices)
        {
            Console.WriteLine($"Device name: {device.Name}  Archived: {device.Archived}");
        }

        // Get archived devices with its parents
        var result = client.Devices.GetArchivedWithParents();
        //Result should contain devices with names 'DOOR', 'PANEL', 'BUS'
        foreach (var device in result)
        {
            Console.WriteLine($"Device name: {device.Name}  Archived: {device.Archived}");
        }

        // Disconnect from server
        client.Disconnect();
    }
}
See Also

Reference

DeviceRepositoryV3 Class
Gamanet.C4.SDK Namespace