CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2014
    Posts
    1

    Unhappy 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!

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,099

    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
  •  





Click Here to Expand Forum to Full Width

Featured