visual-c++soaptimeoutdirectoryservicesdirectorysearcher

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


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

Microsoft Development Environment 2003 Version 7.1.3088.

Microsoft .Net Framework 1.1 Version 1.1.4322


using namespace System::DirectoryServices;//line 1268
void CClassName::MethodName(){
...
    DirectorySearcher* directorySearcher = new DirectorySearcher();//line 1701
    directorySearcher->ClientTimeout = 60000;//line 1702
...
}


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(1702): error C2227: left of '->ClientTimeout' must point to class/struct/union
        type is ''unknown-type''
file.cpp(1268): error C2653: 'System' : is not a class or namespace name
file.cpp(1268): error C2871: 'DirectoryServices' : 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


Solution

  • System.DirectoryServices is a .NET wrapper around the C++ Active Directory Service Interfaces. If your application is in C++, then just use the C++ libraries.

    There's an example of how to search using IDirectorySearch here: Searching with the IDirectorySearch Interface