</table> </form> <?php } else { //collect the form parameters which will be set in the case this was a post back. $displayName = $_POST["dname"]; $description = $_POST["description"]; $alias = $_POST["alias"]; // Validate that the inputs are non-empty. if (empty($displayName) or empty($description) or empty($alias)) { echo '<p>One of the required fields is empty. Please go back to <a href="CreateGroup.php">Create Group</a></p>'; } else { $groupEntryInput = array('displayName' => $displayName, 'description' => $description, 'mailNickname' => $alias, 'mailEnabled' => 'False', 'securityEnabled' => 'True'); // Create the group and display a message to the user $group = GraphServiceAccessHelper::addEntryToFeed('groups', $groupEntryInput); //Check to see if we got back an error. if (!empty($group->{'odata.error'})) { $message = $group->{'odata.error'}->{'message'}; echo '<p>Group creation failed. Service returned error:<b>' . $message->{'value'} . '</b> Please go back to <a href="CreateGroup.php">Create Group</a></p>'; } else { echo '<p>'; echo '<b>Created Group with the following information:</b>'; echo '<table><tr><td><b>Display Name: </b>' . $group->{'displayName'} . '</td><td><b>Description: </b>' . $group->{'description'} . '</td></tr></table>'; echo '<br/> <br/>'; echo 'You can go back to <a href="CreateGroup.php">Create Group</a> to create more groups.'; echo '</p>'; } } } ?>
</table> </form> <?php } else { // Validate that the inputs are non-empty. if (empty($_POST["dname"]) or empty($_POST["alias"]) or empty($_POST["accountenabled"]) or empty($_POST["forcePasswordChangeOnNextLogin"]) or empty($_POST["password"])) { echo '<p>One of the required fields is empty. Please go back to <a href="CreateUser.php">Create User</a></p>'; } else { //collect the form parameters which will be set in the case this was a post back. $displayName = $_POST["dname"]; $alias = $_POST["alias"]; $accountEnabled = $_POST["accountenabled"]; $passwordProfile = array('password' => $_POST["password"], 'forceChangePasswordNextLogin' => $_POST["forcePasswordChangeOnNextLogin"]); $userEntryInput = array('displayName' => $displayName, 'userPrincipalName' => $alias . '@' . Settings::$appTenantDomainName, 'mailNickname' => $alias, 'passwordProfile' => $passwordProfile, 'accountEnabled' => $accountEnabled); // Create the user and display a message $user = GraphServiceAccessHelper::addEntryToFeed('users', $userEntryInput); //Check to see if we got back an error. if (!empty($user->{'odata.error'})) { $message = $user->{'odata.error'}->{'message'}; echo '<p>User creation failed. Service returned error:<b>' . $message->{'value'} . '</b> Please go back to <a href="createUser.php">Create User</a></p>'; } else { echo '<p>'; echo '<b>Created User with the following information:</b>'; echo '<table><tr><td><b>Display Name: </b>' . $user->{'displayName'} . '</td><td><b>User Principal Name: </b>' . $user->{'userPrincipalName'} . '</td></tr></table>'; echo '<br/> <br/>'; echo 'You can go back to <a href="CreateUser.php">Create User</a> to create more users.'; echo '</p>'; } } } ?>