How can I list all the users from an office 365 account. I have tried this:
$users = $Context.web.SiteUsers;
$userinfos = $Context.web.SiteUserInfoList;
$Context.Load($users);
$Context.Load($userinfos);
$Context.ExecuteQuery();
$isuser = $false
foreach ($user in $users)
{
write-host $user.LoginName
}
However this does not work? Please help