//Below is an C# example for updating user's password:

using System;
using System.Text;
using System.IO;
using Google.GData.Apps;
using Google.GData.Client;
using Google.GData.Extensions;
using System.Web;
using System.Net;
using System.Diagnostics;

namespace GoogleProvisioning
{
    class googleupdate
    {
        public static string domain;
        public static string adminEmail;
        public static string adminPassword;

        private static void UserOperations(AppsService service)
        {
            string userName = "XXXXXX";

            // Restore the user.
            UserEntry restoredEntry = service.RestoreUser(userName);

            UserEntry userEntry = service.RetrieveUser(userName);
            userEntry.Login.Password = "SomeNewPassword";
            service.UpdateUser(userEntry);
            Console.WriteLine("Updated the password for user {0}",
userEntry.Login.UserName);

            // Query for a single user.
            UserEntry entry = service.RetrieveUser(userName);
            Console.WriteLine("Retrieved user {0}",
entry.Login.UserName);

            // retrieve Nickname
            service.RetrieveNicknames(userName);
            Console.WriteLine("Nickname for user is {0}",
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);

        }

        private static void RunSample(AppsService service)
        {
            try
            {
                // Demonstrate operations on user accounts.
                UserOperations(service);
            }
            catch (AppsException a)
            {
                Console.WriteLine("A Google Apps error occurred.");
                Console.WriteLine();
                Console.WriteLine("Error code: {0}", a.ErrorCode);
                Console.WriteLine("Invalid input:
{0}",a.InvalidInput);
                Console.WriteLine("Reason: {0}", a.Reason);
            }
        }

        public static void Main()
        {
            domain = "XXX.XXX.XXX";
            adminEmail = "xx...@xxxxxxxx"; // make sure you put your
admin_lo...@domain
            adminPassword = "XXXXXX";

                AppsService service = new AppsService(domain,
adminEmail, adminPassword);

                RunSample(service);

         }
    }
}

On Jan 13, 2:32 pm, Dino <[email protected]> wrote:
> Can somebody submit code example for a .Net solution c# class with
> methods for getting an Authentication Token and updating a users
> password?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Apps APIs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-apps-apis?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to