Hi there,
Has anybody found any solution to Windows return code 0x80020009,
that is returned while trying to create the GW user. Please do kindly let
me know about the same, since I am getting the same error.
The code I am using is as follows

pIADDomain->get_Users(&pDIADUsers); //Till here works fine, and able to
print existing users.

bstrUserID = SysAllocString(TO_OLE_STRING("testuser"));
bstrSurname = SysAllocString(TO_OLE_STRING("testuser"));
bstrSurname = SysAllocString(TO_OLE_STRING("testuser"));
bstrDN = SysAllocString(TO_OLE_STRING("cn=testuser,o=VISHTR EE"));

V_VT(&variantPassword) = VT_BSTR;
V_BSTR(&variantPassword) = SysAllocString(TO_OLE_STRING("password"));
V_VT(&variantPostOffice) = VT_BSTR;
V_BSTR(&variantPostOffice) = SysAllocString(TO_OLE_STRING
V_VT(&variantDomain) = VT_BSTR;
V_BSTR(&variantDomain) = SysAllocString(TO_OLE_STRING("domain"));
V_VT(&variantMailboxID) = VT_BSTR;
V_BSTR(&variantMailboxID) = NULL;//SysAllocString(TO_OLE_STRING(""));

HResult idfi = pIADUsers->Add(bstrUserID, bstrSurname, bstrDN,
variantPassword, variantPostOffice, variantDomain, variantMailboxID,

printf("\n[%x]\n",idfi); //prints 0x80020009

printf("\nadd sucess\n");
printf("\nadd failed\n"); //prints add failed

> Could someone please send me some sample C++ code that creates a
> GW user using the Admin API? I have a pointer to an IADUsers
> object and am calling the Add method, but I keep getting the
> Windows return code 0x80020009, which indicates an exception
> has occurred, but I can't figure out why. I also tried
> AddExistingUser and AddExternalUser, but I get the same
> results. I can modify and delete users with the API, and I
> can create users with ConsoleOne, but I haven't found the
> magic combination to create a user from the Admin API. I'm
> new to COM/OLE, so please include the setup of the parameters.
> Thanks very much.
> rhopson@VisualClick.com