﻿#### 

Sitecore 9 has perfect documentation ([https://doc.sitecore.net/developers/xp/](https://doc.sitecore.net/developers/xp/ "Sitecore 9 documentation")) that answers most possible questions, but it also describes such a nice features so that it is hard not to share them.

And an example of such required for a long time functionality is conformity with **PII** (Personally identifiable information, [https://en.wikipedia.org/wiki/Personally_identifiable_information](https://en.wikipedia.org/wiki/Personally_identifiable_information "Personally identifiable information")) laws. That means now we can mark xDB contact information as ‘sensitive’ and remove it when required for GDPR Compliance. And there is no need to run MongoDB queries from console ([https://sitecore.stackexchange.com/questions/7427/how-do-i-anonymize-contact-data-in-mongodb](https://sitecore.stackexchange.com/questions/7427/how-do-i-anonymize-contact-data-in-mongodb "MongoDB queries"))! 

First thing we need is the **Sitecore.XConnect.Schema.PIISensitiveAttribute** attribute. We can apply it to a **Facet or its property**:

```
      
public class SensitiveInformation : Facet
{
[PIISensitive]
public string PassportNumber { get; set; }
...
  
```

Second thing is a simple xConnect client method call:

```
      
using (XConnectClient client = GetClient())
{
    IdentifiedContactReference reference = new IdentifiedContactReference(source, identifier);

    Contact contact = client.Get<Contact>(reference, new ContactExpandOptions());

    client.ExecuteRightToBeForgotten(contact);
    client.Submit();
}
  
```

That’s it. xConnect will delete PII sensitive facets, reset sensitive properties values and delete all identifiers. Empty contact will stay in xDB for a data consistency.

Experience profile:

![remove xDB contact Sitecore 9 profile ](https://www.brimit.com/-/media/images/blog/sc91.png?la=en&amp;hash=A55C6A8E76B98FE95700C74AFB0744DB)

SQL Database:

![remove xDB contact Sitecore 9 database](https://www.brimit.com/-/media/images/blog/sc92.png?la=en&amp;hash=45C3C2EBF483FC7E1A6968B26B464635)

##### Do you need help with your Sitecore project?

      ![](~/media/CD37043DFD1F491D8E92958A11959F75.ashx?la=en&amp;hash=D08B252DD3B41C09B588007541E5D22F)

   [VIEW SITECORE SERVICES](https://www.brimit.com/expertise/sitecore-cms)

###### Author

[!\[daniil_side2\](https://www.brimit.com/-/jssmedia/feature/blogs/authors/daniil_side2.jpg?h=180&amp;iar=0&amp;w=360&amp;hash=B759563CA3F35642FD513A79358CC84C)
Daniil Raschupkin
Sitecore Solution Architect](https://www.brimit.com/blog/author?authors=Daniil%20Raschupkin)

#### More on Sitecore

[!\[How Vercel Will Help You Save Effort When Deploying Sophisticated Sitecore Projects\](https://www.brimit.com/-/jssmedia/project/brimit/blog/2024/vercel_cover-image.png)
#Guides#How-toDXPE-commerce
##### How Vercel Will Help You Save Effort When Deploying Sophisticated Sitecore Projects
Optimize and accelerate the development and deployment of complex multisite Sitecore projects.
Alexei Vershalovich on July 17, 2024](https://www.brimit.com/blog/how-vercel-will-help-you-save-effort-when-deploying-sophisticated-sitecore-projects)

[!\[Training Up Tomorrow's Sitecore MVPs: a Mentoring Success Story\](https://www.brimit.com/-/jssmedia/project/brimit/blog/2023/sitecore-mentoring---cover-image.png)
#How-toDXP
##### Training Up Tomorrow's Sitecore MVPs: a Mentoring Success Story
How to participate in the Sitecore Mentor program and help younger colleagues jump-start a career in Sitecore development.
Sergey Baranov on October 2, 2023](https://www.brimit.com/blog/training-up-tomorrows-sitecore-mvps)

[!\[Going Headless. Part 2: When a Headless CMS Is Your Best Bet (if you have Sitecore)\](https://www.brimit.com/-/jssmedia/project/brimit/blog/2022/headless/adobestock_456986731.jpg)
#How-toDXPE-commerce
##### Going Headless. Part 2: When a Headless CMS Is Your Best Bet (if you have Sitecore)
Discover how a headless CMS can benefit organizations that use Sitecore.
Daniil Raschupkin, Palina Trokhautsava on September 15, 2022](https://www.brimit.com/blog/going-headless-part-2-when-a-headless-cms-is-your-best-bet-if-you-have-sitecore)

![](https://bat.bing.net/action/0?ti=187017043&amp;tm=gtm002&amp;Ver=2&amp;mid=a58f5676-3add-453e-a0f2-d907340ef06b&amp;bo=2&amp;gtm_tag_source=1&amp;pi=0&amp;lg=en-US&amp;sw=800&amp;sh=600&amp;sc=24&amp;nwd=1&amp;tl=Sitecore%209%3A%20Delete%20xDB%20Contact%20for%20GDPR%20Compliance&amp;kw=Sitecore,%20sitecore%209,%20GDPR,%20Compliance,%20Delete,%20xDB,%20Contact,%20how%20to,%20remove,%20personal,%20information,%20GDPR%20Compliant&amp;p=https%3A%2F%2Fwww.brimit.com%2Fblog%2Fsitecore-9-delete-xdb-contact-gdpr-compliance&amp;r=&amp;lt=273&amp;evt=pageLoad&amp;sv=2&amp;asc=D&amp;cdb=AQAY&amp;rn=20948)