title: How to recognize non-human users?
body: <p>Listing all the users in the system, I noticed that some of them were system users and didn't have e.g. working hours at all. At the moment, I just list them and exclude from my loop my it's a Q&amp;D approach and I prefer to do it right.</p>
  
  <p>I haven't found any specific information on the <em>systemuser</em> entity that'd tell me if a certain one is a real profile (i.e. created in the Office 365 portal) or one that's provided my MS by default.</p>
  
  <p>The Q&amp;D code is as follows.</p>
  
  <pre><code>QueryExpression userQuery = new QueryExpression { EntityName = "systemuser", ... };
  IEnumerable&lt;Entity&gt; users = service.RetrieveMultiple(userQuery).Entities;
  
  IEnumerable&lt;String&gt; automatics = new[] { "INTEGRATION", "Support User", "SYSTEM" };
    foreach (Entity user in users.Where(element
      =&gt; !automatics.Contains(element.GetAttributeValue&lt;String&gt;("fullname")))) { ... }
  </code></pre>
  
  <p>Second best solution, if there's no way to determine who's on the automatics list and who's a real dude, is to make an exhaustive comprehensive list of exceptions. Once again, my google-fu failed me, as I haven't found any documentation on the full list of automatically created instances of the entity <em>systemuser</em>.</p>