In my provider-hosted app I load the UserCollection from SharePoint by CSOM (Client Side Object Model), like this:

UserCollection users = web.SiteUsers;

But I only want "normal" users to be displayed in my app. The result given here also shows users which seem to be system users, like:

  • _SPOCacheFull
  • System Account
  • Everyone
  • Everyone except external users

How can I determine if a user is a normal site user or a system user?

I checked the groups but most of the system users don't have any groups. Also the email is mostly empty but not always.


The following User properties could be used for that purpose:

The below example demonstrates how to determine a "regular" users in Web.SiteUsers:

public static IEnumerable<User> LoadUsers(ClientContext context)
   var users = context.LoadQuery(context.Web.SiteUsers.Where(u => u.PrincipalType == PrincipalType.User && u.UserId.NameIdIssuer == "urn:federation:microsoftonline"));
   return users;
  • 1
    Ah very nice! The urn:federation:microsoftonline Value is indeed very helpful as most of the SharePoint System users have PrincipalType.User aswell.
    – Vinz
    Sep 11 '14 at 7:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.