} else { // First get the object id of the user that needs to be createed to this group // Use the $filter syntax from OData. $filteredusers = GraphServiceAccessHelper::getFeedWithFilterClause('users', 'displayName', $_POST['dname']); // If the query did not return any members, display an error to the user. if (count($filteredusers) === 0) { echo '<p><b>Please provide a valid user display name for the user to be added. User display name:\'' . $_POST['dname'] . '\' is not valid</b></p>'; } else { // We should ideally handle the case where there are multiple members with the same diplay name but let's // make the simple assumption that they are distinct. foreach ($filteredusers as $filtereduser) { $userid = $filtereduser->{'objectId'}; } $useruri = array('url' => 'https://graph.windows.net/' . Settings::$appTenantDomainName . '/users(\'' . $userid . '\')'); $groupUrl = "groups(" . '\'' . $_GET['id'] . '\')'; $addedLink = GraphServiceAccessHelper::addLinkForEntries($groupUrl, $useruri, 'members'); } } } // Get the list of members for this group and diplay. A simplistic assumption that all members // are users for this sample. $users = GraphServiceAccessHelper::getLinkedFeed('groups', $_GET['id'], 'members'); foreach ($users as $user) { echo '<tr><td>' . $user->{'objectId'} . '</td><td>' . $user->{'displayName'} . '</td></tr>'; } ?> </table> <br/><br/> <form method="post" action="<?php echo $_SERVER['PHP_SELF'] . '?id=' . $_GET['id'] . '&name=' . $_GET['name']; ?>