-
December 21st, 2014, 05:13 PM
#1
Help with IADsUser::Put when calling setInfo(), error E_ADS_INVALID_USER_OBJECT
Hello, I am looking for a solution that may be very simple but I can't find it, I am a beginner.
I am trying to call the setInfo() function, when committing changes to a user object in Active Directory after using Put(). The call results in E_ADS_INVALID_USER_OBJECT error. I am able to bind with LDAP successfully, my code is:
Code:
IADsUser *pUser = NULL;
RESULT hr = CoInitialize(0);
VARIANT var;
hr = ADsGetObject(L"LDAP://CN=Foo Bar,CN=Users,DC=mydomain,DC=com", IID_IADsUser, (void**) &pUser);
VariantInit(&var);
V_BSTR(&var) = SysAllocString(L"foobar@email.com");
V_VT(&var) = VT_BSTR;
hr = pUser->Put(CComBSTR("mail"), var);
hr = pUser->SetInfo(); //ERROR: E_ADS_INVALID_USER_OBJECT
The Get() function works and I am able to retrieve user information. The above code runs in a DLL by a process which is run by the Local System account. Does the Local System have enough permissions to make changes in AD objects? Can I give Local System more permissions? If I run the same code in an executable, it works I can't figure it out..
Tips are very appreciated. Thanks!
-
December 22nd, 2014, 08:55 AM
#2
Re: Help with IADsUser::Put when calling setInfo(), error E_ADS_INVALID_USER_OBJECT
Try to bind to a local user instead, See the IADsUser interface documentation.
Victor Nijegorodov
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|