Retrieve all users in SharePoint Online using CSOM

I want to retrieve all users in SharePoint Online using CSOM, but it is not giving me all users.

It is just giving me those users which are assign individually in the SharePoint group but not those which are assigned in AD Group or Everyone Group.

This is my Code :

public static void GetAllUsers(ClientContext context)         {             Web webs = context.Web;             var siteUsers = from user in webs.SiteUsers                             where user.PrincipalType == Microsoft.SharePoint.Client.Utilities.PrincipalType.User                             select user;             var usersResult = context.LoadQuery(siteUsers);             context.ExecuteQuery();             foreach (var user in usersResult)             {                 Console.WriteLine(user.LoginName + " - " + user.Email);             }         } 

Kindly give me any solution on how to retreive all users from Azure AD or User profile.


Category: sharepoint online Time: 2016-07-29 Views: 0

Related post

iOS development

Android development

Python development

JAVA development

Development language

PHP development

Ruby development


Front-end development


development tools

Open Platform

Javascript development

.NET development

cloud computing


Copyright (C), All Rights Reserved.

processed in 0.223 (s). 12 q(s)