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

    C++ ActiveDirectory user information problem

    Hi I have some problem with my code which should view user information.

    #include "stdafx.h"
    #include "activeds.h"
    #include <exception>
    #include <atlbase.h>
    using namespace std;

    int main(int argc, char* argv[])
    {
    IADsUser *pUser;
    HRESULT hr = CoInitialize(NULL);
    VARIANT telephone;
    hr = ADsGetObject(L"WinNT://domena.local
    /robert",IID_IADsUser,(void**)&;pUser);
    if (FAILED(hr)) {
    printf("blad");
    return NULL;}
    BSTR bstr;
    hr = pUser->get_EmailAddress(&bstr);
    printf("email: %S\n", bstr);
    bstr=L"\n";
    hr = pUser->get_FullName(&bstr);
    printf("fullname: %S\n", bstr);
    bstr=L"\n";
    hr = pUser->get_Description(&bstr);
    printf("desc: %S\n", bstr);
    bstr=L"\n";
    hr = pUser->get_EmployeeID(&bstr);
    printf("id: %S\n", bstr);
    bstr=L"\n";
    hr = pUser->get_FirstName(&bstr);
    printf("first name: %S\n", bstr);
    SysFreeString(bstr);
    return 0;
    }

    In the link bellow I attach screen where is example of using my code. I can't get information about email.

    http://term-lux.pl/screen.jpg

  2. #2
    Join Date
    Aug 2010
    Posts
    51

    Re: C++ ActiveDirectory user information problem

    hi,


    I have no idea about of this , i need suggestions.
    pl help me



    thanks for help



    regards,
    phe9oxis,
    http://www.guidebuddha.com

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