private static void UserOperations(AppsService service) { // Create a new user. UserEntry insertedEntry = service.CreateUser(testUserName, "Jane", "Doe", "testuser-password"); Console.WriteLine("Created new user '{0}'", insertedEntry.Login.UserName); // Suspend the user. UserEntry suspendedEntry = service.SuspendUser(testUserName); Console.WriteLine("Suspended account for {0}", suspendedEntry.Login.UserName); // Restore the user. UserEntry restoredEntry = service.RestoreUser(testUserName); Console.WriteLine("Restored user {0}", restoredEntry.Login.UserName); // Query for a single user. UserEntry entry = service.RetrieveUser(testUserName); Console.WriteLine("Retrieved user {0}", entry.Login.UserName); // Query for a page of users. UserFeed feed = service.RetrievePageOfUsers(testUserName); entry = feed.Entries[0] as UserEntry; Console.WriteLine("Retrieved page of {0} users, beginning with '{1}'", feed.Entries.Count, entry.Login.UserName); // Query for all users. feed = service.RetrieveAllUsers(); entry = feed.Entries[0] as UserEntry; Console.WriteLine("Retrieved all {0} users in the domain, beginning with '{1}'", feed.Entries.Count, entry.Login.UserName); // Update the user's given name. restoredEntry.Name.GivenName = "John"; UserEntry updatedEntry = service.UpdateUser(entry); Console.WriteLine("Updated user with new given name '{0}'", updatedEntry.Name.GivenName); }