Thanks for the assistance....the posted code is valid and does work.
It seems that I had to login for the initial time before it would
allow me to reset the password(complete captcha and accept tos). After
that was done I ran the same code and it allowed the updates. Does
anyone know if this is normal behavior?

On Mar 26, 11:19 am, Jon <[email protected]> wrote:
> The correct code is:
>   public string resetPassword(string username, string newpass)
>         {
>             AppsService service = new AppsService(domain, adminEmail,
> adminPass);
>             string response = null;
>             string result = null;
>
>             try
>             {
>                 UserEntry entry = service.RetrieveUser(username);
>                 entry.Login.Password = newpass;
>                 entry = service.UpdateUser(entry);
>             }
>             catch(AppsException ex)
>             {
>                 response = "::" + ex.ErrorCode + "::" +
> ex.InvalidInput + "::" + ex.Reason + "::";
>                 worker.logThisStuff("gResetPassword :", response);
>                 result = ex.Reason;
>
>             }
>             return result;
>
>         }
>
> service is an authenticated AppsService in debug the RetrieveUser
> seems to be working as it displays the username and not a null value.
> So it looks like there is a failure in the UpdateUser call, however it
> does not throw an exception. I tried to go off of the data provided
> for .net and from my understanding UpdateUser can change password,
> firstname, or lastname. do these need to be submitted on every update
> user call? should i be passing the FamilyName and GivenName through
> with the password?
>
> On Mar 26, 10:49 am, Jon <[email protected]> wrote:
>
> > Sorry I changed the code because I was trying to set any of the
> > elements with the UpdateUser call and was unsuccessful, i forgot to
> > change it back for the post. This is .net and the change first or last
> > name failed as well.
>
> > On Mar 26, 10:44 am, George Adams <[email protected]> wrote:
>
> > > Jon,
>
> > > Looks like you are setting the last name of the user to your new password
> > > with this line.
>
> > > entry.Name.FamilyName = newpass;
>
> > > If this code is Java and not .net then this would set the password
>
> > > entry.getLogin().setPassword(newpass);
>
> > > George
>
> > > On Thu, Mar 26, 2009 at 8:56 AM, Jon <[email protected]> wrote:
>
> > > > I am trying to use the UpdateUser method to reset passwords for users
> > > > in my google apps....
> > > > Here is what i have:
>
> > > >       public string resetPassword(string username, string newpass)
> > > >        {
> > > >            AppsService service = new AppsService(domain, adminEmail,
> > > > adminPass);
> > > >            string response = null;
> > > >            string result = null;
>
> > > >            try
> > > >            {
> > > >                UserEntry entry = service.RetrieveUser(username);
> > > >                entry.Name.FamilyName = newpass;
> > > >                entry = service.UpdateUser(entry);
> > > >                result = entry.Name.FamilyName;
> > > >            }
> > > >            catch(AppsException ex)
> > > >            {
> > > >                response = "::" + ex.ErrorCode + "::" +
> > > > ex.InvalidInput + "::" + ex.Reason + "::";
> > > >                worker.logThisStuff("gResetPassword :", response);
> > > >                result = ex.Reason;
>
> > > >            }
> > > >            return result;
>
> > > >        }
>
> > > > When I execute this it does not throw an exception for failure,
> > > > however it also does not set the password. Any insight on what I might
> > > > be doing wrong would be appreciated.
--~--~---------~--~----~------------~-------~--~----~
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