Can not create object of DirectorySearcher class with Visual C++ MFC with project reference of System.DirectoryServices.dll

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Alex B
    New Member
    • Apr 2022
    • 3

    Can not create object of DirectorySearcher class with Visual C++ MFC with project reference of System.DirectoryServices.dll

    System.Director yServices.dll file has been added successfully to Visual C++ project through References in Solution Explorer

    Code:
    using namespace System.DirectoryServices;//line 1268
    void CClassName::MethodName(){
    ...
        DirectorySearcher* directorySearcher = new DirectorySearcher();//line 1701
        directorySearcher->Timeout = 60000;//line 1702
    ...
    }
    
    file.cpp(1268): error C2059: syntax error : '.'
    file.cpp(1701): error C2061: syntax error : identifier 'DirectorySearcher'
    file.cpp(1701): error C2065: 'directorySearcher' : undeclared identifier
    file.cpp(1701): error C2065: 'DirectorySearcher' : undeclared identifier
    file.cpp(1268): error C2143: syntax error : missing ';' before '.'
    file.cpp(1702): error C2228: left of '.Timeout' must have class/struct/union type
            type is ''unknown-type''
    file.cpp(1268): error C2871: 'System' : a namespace with this name does not exist
    file.cpp(1702): error C3861: 'directorySearcher': identifier not found, even with argument-dependent lookup
    By this way I need to set Request Timeout for SOAP WebService
Working...