I can't figure out why my loop isn't working at all. I have successfully connected to my clients directory and I am able to fetch some users. I have followed the PHP instructions. But this tutorial doesn't include example for fetching all users only the default page size of 100 users.
I am aware of the skipToken (explained here) but for some reason I am not been able to get it work with my loop.
Basically first I define an array, and two sub arrays.
$myArray = array();
$myArray['skipToken'] = "";
$myArray['users'] = "";
Then I'll perform the first fetch so I can get skipToken and bunch of users that come along.
require_once("GraphServiceAccessHelper.php");
$users = GraphServiceAccessHelper::getFeed('users');
Pushing values into already existing arrays.
$myArray['skipToken'] = $users->{'odata.nextLink'};
$myArray['users'][] = $users->{'value'};
Now they are filled with information. Now its time to loop!
for($i = 0; $i < 2; $i++){
if($myArray['skipToken'] != ""){
$skipToken = $myArray['skipToken'];
require_once("GraphServiceAccessHelper.php");
$users = GraphServiceAccessHelper::getNextFeed('users', $skipToken);
$myArray['skipToken'] = $users->{'odata.nextLink'};
$myArray['users'][] = $users->{'value'};
}
}
Console fires up from error, that points to loop skipToken defining part:
Notice: Undefined property: stdClass::$odata.nextLink
$myArray['skipToken'] = $users->{'odata.nextLink'};