> ## 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.

# Create a Contact entity through an entity collection

> How to create a Contact entity through an ContactCollection entity collection.

The `SuperOffice.CRM.Entities` namespace exposes entity collections such as `ContactCollection` and `PersonCollection`. It is therefore possible to create a `Contact` entity and assign it to the collection and thereby saving the collection the `Contact` entity will be saved.

## Code

```csharp CS theme={null}
using SuperOffice.CRM.Entities;
using SuperOffice.CRM.Rows;
using SuperOffice;
using(SoSession mySession = SoSession.Authenticate("sam", "sam"))
{
  //Create a Contact Row
  Contact newContact = Contact.CreateNew();
  //Setting the Defaults for the Contact
  newContact.SetDefaults();
  //Assigning values for the individual properties of the ContactEntity
  //Assigning basic properties to a Contact
  newContact.Name = "EuroCenter";
  newContact.OrgNr = "1234523";
  newContact.Number1 = "7412885";
  //Adding a Row type property to a Contact Entity
  newContact.Country = new CountryRow.IdxCountryId(40);
  //Creating Email Rows
  EmailRow eMail1 = EmailRow.CreateNew();
  eMail1.EmailAddress = "Frank@Hardy.com";
  eMail1.Description = "Frank first email";
  EmailRow eMail2 = EmailRow.CreateNew();
  eMail2.EmailAddress = "Frank@Hardy.com";
  eMail2.Description = "Frank second email";
  //Adding the created Row types to the Properties of Rows type to the Contact Entity
  newContact.Emails.Add(eMail1);
  newContact.Emails.Add(eMail2);
  //Assigning values to Properties of Entity Collection Types.
  Sale newSale1 = new Sale.IdxSaleId(10);
  Sale newSale2 = new Sale.IdxSaleId(20);
  newContact.Sales.Add(newSale1);
  newContact.Sales.Add(newSale2);
  //Instantiating a Contact Collection
  ContactCollection newConCol = ContactCollection.CreateNew();
  //Adding the Contact Entity to the Collection and Saving the Collection
  newConCol.Add(newContact);
  newConCol.Save();
}
```

## Walk-through

In the above code, a `Contact` entity has been created, and then it has been assigned to the instantiated `ContactCollection`.

Then the collection has been saved like this:

```csharp CS theme={null}
  newConCol.Add(newContact);
  newConCol.Save();
```


## Related topics

- [Create Default Contact Entity](/en/api/reference/restful/agent/contact_agent/create-default-contact-entity.md)
- [Create Default Contact Relation Entity](/en/api/reference/restful/agent/relation_agent/create-default-contact-relation-entity.md)
- [How to add members to a static selection using entities layer](/en/api/search/selection/entity/add-member-to-static-selection-entities.md)
- [Create a new company](/en/api/web-services/howto/company/create-contact.md)
- [Get a contact through the services layer](/en/api/web-services/howto/company/get-contact-via-services-layer.md)
- [How to display all user-defined fields](/en/api/web-services/howto/custom-objects/get-udef-list-and-values.md)
- [How to create a recurring appointment (services)](/en/api/web-services/howto/diary/create-recurring-appointment-services.md)
