> ## Documentation Index
> Fetch the complete documentation index at: https://superofficeas-bugfix-ty-screen-designer-paradox.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Retrieving list of persons with PersonAgent

> How to retrieve a list of persons with PersonAgent.

You can retrieve a `Person` list is with the `GetPersonList` method available through the `PersonAgent`. To use this service, we must know the IDs of the people we want before we can make the call. If we do not know the ID, we need to use a different service, for example, a method like `GetPersonsFromContact`.

```csharp theme={null}
using SuperOffice;
using SuperOffice.CRM.Services;

using(SoSession newSession = SoSession.Authenticate("sam", "sam"))
{
  //Instantiating the Person Agent
  using(PersonAgent newPerAgt = new PersonAgent())
  {
    //Local variable Declaration
    int [] personIds = {100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110};

    //Retrieving a List of Persons
    Person[] newPersonArr = newPerAgt.GetPersonList(personIds);

    Console.WriteLine("Full Name" + "\t" + "ContactName" + "\t" + "Email");

    //Retrieving Properties of Person in the Person list
    foreach (Person newPerson in newPersonArr)
    {
      Console.Write(newPerson.Firstname + " " + newPerson.Lastname + "\t");
      Console.Write(newPerson.ContactName + "\t");
      Console.Write(newPerson.Email);
      Console.WriteLine();
    }
  }
}
```

A list of `PersonIds` is passed into the `GetPersonList` method, which returns an array of `Person` data types. Once the values have been assigned to a Person type array, we may access the properties of each person by looping through the array elements.

**Output:**

```text theme={null}
Full Name         ContactName                  Email
Unni Ukultsted    Uri Geller International     example@example.com
Veronika Viseth   Vertigo AS                   example@example.com
Vebjørn Valstad   Vin & Sprit AB                example@example.com
Werner Wigseth    Warner Brothers Norway        example@example.com
Wenche Wilson     Werner & Werner               example@example.com
Ulf Ulstein       Uniformeffekter AS            example@example.com
Ulster Undervold  Uri Geller International     example@example.com
Vilde Veum        Vertigo AS                    example@example.com
Varg Vigernes     Vin & Sprit AB                example@example.com
Waldorf Weem      Warner Brothers Norway        example@example.com
Wilma Wetter      Werner & Werner               example@example.com
```

We could also have used the Person agent's `GetPersonsFromContact` method since we are just reading some simple properties out of the results. `GetPersonsFromContact` returns simple read-only carriers.

Another option is to use the [ContactAgent][1].

[1]: ./get-persons-contactagent
