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

# How to set an interest on or off for a contact (services)

> How to set an interest on or off for a contact using services

You can use web services to alter the selected status of an [interest][1] of a specific contact.

## Code

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

Console.Write("Please Enter the UserName :- ");
string userName = Console.ReadLine();

Console.Write("Please enter the password :- ");
string passWord = Console.ReadLine();
Console.WriteLine();

using (SoSession newSession = SoSession.Authenticate(userName, passWord))
{
  //Retrieve a Contact Entity using the Contact Agent
  ContactAgent newConAgt = new ContactAgent();
  ContactEntity newConEnt = newConAgt.GetContactEntity(10);

  //Retrieve all available Interests for a Contact
  SelectableMDOListItem[] newSelMdoLstItms = newConEnt.Interests;

  foreach(SelectableMDOListItem newSelMdoLstItm in newSelMdoLstItms)
  {
    //Changing the Selected status and displaying only the selected items
    if (newSelMdoLstItm.Selected)
      newSelMdoLstItm.Selected = false;
    else
    {
      newSelMdoLstItm.Selected = true;
      Console.WriteLine(newSelMdoLstItm.Name);
    }
  }

  Console.ReadLine();

  //Save the modified Contact Entity
  newConAgt.SaveContactEntity(newConEnt);
}
```

## Walk-through

We have first retrieved a `Contact` entity using the `ContactAgent`. And then used its `Interests` property to retrieve the contact's interests into a `SelectableMDOListItem` array.

Next, we iterate on the array and change its Boolean `Selected` property status. By using the `SaveContactEntity` method available in the `Contact` agent, we save the modifications made to the entity.

[1]: ../../../../company/dev/index#interests


## Related topics

- [How to list all selected interests for a contact (services)](/en/api/web-services/howto/company/get-interests-for-contact-services.md)
- [Interests](/en/automation/crmscript/howto/interests/index.md)
- [Set/clear interest on contact](/en/automation/crmscript/howto/interests/contact-interests.md)
- [Set/clear interest on company](/en/automation/crmscript/howto/interests/company-interests.md)
- [How to set a user-defined list item on a Udef field (services)](/en/api/web-services/howto/custom-objects/set-udef-listitem-value.md)
- [List interests for a person](/en/automation/crmscript/howto/contact/get-interests.md)
