Im trying to set a new password on a user using the Groupwise Administrative
Object API. This is the code Im using (C++):

// Start of code
VARIANT mode;
VARIANT oldPWD;
VariantInit (&mode);
VariantInit(&oldPWD);
V_VT(&mode) = VT_I4;
V_I4(&mode) = eadGW;
V_VT(&oldPWD) = VT_BSTR;
V_BSTR(&oldPWD) = SysAllocString(TO_OLE_STRING("oldpwd"));
HRESULT idfi =
pIADUser->SetPassword(SysAllocString(TO_OLE_STRING("newpwd" )), mode,
oldPWD);
pIADUser->Commit();
// End of code

pIADUser is the user-object Im trying to modify. First off, I havent found
any good documentation on what type the "mode" parameter should be, but I
have tried most of them and its giving the same effect. When I run this
code, "idfi" will be set to "1" which I guess indicates a failure (once
again, no good documentation) since "pIADUser->getName" and
"pIADUser->put_GivenName" both returns "0" when they succeed. The password
does not seem to change as I still must use the old password to login to
GroupWise.

What am I missing here? I would really appreciate it if you could analyze
the code and see if something is wrong.