> ## Documentation Index
> Fetch the complete documentation index at: https://docs.superoffice.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Retrieving list of persons with ContactAgent

> How to retrieve a list of persons with ContactAgent.

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 Contact Agent
  using(ContactAgent newConAgt = new ContactAgent())
  {
    //Retrieving a Contact Entity with the use of the Contact Agent
    ContactEntity newConEnt = newConAgt.GetContactWithPersons(143);

    //Retriving properties of a Person from the Contact Entity
    if (newConEnt.Persons.Length > 0)
    {
      Console.WriteLine("Full Name" + "\t" + "ContactName" + "\t" + "Email");
      foreach (Person newPerson in newConEnt.Persons)
      {
        Console.WriteLine(newPerson.Firstname + " " + newPerson.Lastname + "\t");
        Console.Write(newPerson.ContactName + "\t");
        Console.Write(newPerson.Email);
        Console.WriteLine();
      }
    }
  }
}
```

After we have created an instance of the `ContactEntity` calling the `ContactAgent`'s `GetContactWithPersons` method, we can iterate through the `Person` property of the instantiated entity and retrieve its properties.

**Output:**

```text theme={null}
Full Name         ContactName             Email
Admin Adminson    StateZeroDatabase       example@example.com
Arne Arnesen      StateZeroDatabase       example@example.com
Brede Bredesen    StateZeroDatabase       example@example.com
Cato Carlsson     StateZeroDatabase       example@example.com
Donald Duck       StateZeroDatabase       example@example.com
Erik Eide         StateZeroDatabase       example@example.com
```

Another option is to use the [PersonAgent][1]

[1]: ./get-persons-personagent


## Related topics

- [Retrieving list of persons with PersonAgent](/en/api/web-services/howto/contact/get-persons-personagent.md)
- [SuperOffice.WebApi.Agents.ContactAgent](/en/api/reference/webapi/SuperOffice.WebApi.Agents.ContactAgent.md)
- [Get a contact through the services layer](/en/api/web-services/howto/company/get-contact-via-services-layer.md)
- [Contact (person)](/en/contact/dev/index.md)
- [Get Contact With Persons](/en/api/reference/restful/agent/contact_agent/get-contact-with-persons.md)
- [Add Person](/en/api/reference/restful/agent/contact_agent/add-person.md)
