Filter using UserAccountControl attribute


Could you supply a code sample to filter users based on their UserAccountControl attribute? I only want to display users with an attribute decimal value of 512 (NORMAL_ACCOUNT) or 65536 (DONT_EXPIRE_PASSWORD). I’m using a User Profiles data source.

Many thanks in advance.

Hi Damien,

Org Chart filtration has access to SharePoint user profile properties only. There is no such user profile property as UserAccountControl in a profile by default. I would recommend you to configure such filtration in user profile service. Please read this article for more information.

Thanks, your article was very helpful and we will apply the filtration in the user profile service.

However, the documentation in the wizard (Settings > Filtration > Field Names link) does specifically list the UserAccountControl as a valid field name (see the attached screenshot). You may need to update this. If it turns out that the UserAccountControl field can be used in the filtration, let me know.

Thanks again.

Hi Damien,

Thank you for additional information.

If you see UserAccountControl in the list it means that you have such property in user profile. But there is no guarantee that is synchronized with Active Directory. It may be empty, You may need to check it.

If it is synchronized, then you can use it in filtration, but consider that Org Chart returns all values as strings. Thus, you may need to convert it to number to use it correctly in your filtration rule.

Additionally, you should add quotes to access properties like this:


Best regards
Anton Khritonenkov
Plumsail Team