ADSI Errors

ADSI error codes are returned in the standard COM HRESULT status variable using facility code 5 with the severity bit set TRUE. This results in errors of the form 0x80005xxx. The following 32-bit error codes are listed here and defined in adserr.h.

Error/Value Message
0x80005000L E_ADS_BAD_PATHNAME: An invalid ADSI pathname was passed.
0x80005001L E_ADS_INVALID_DOMAIN_OBJECT: An unknown ADSI domain object was requested.
0x80005002L E_ADS_INVALID_USER_OBJECT: An unknown ADSI user object was requested.
0x80005003L E_ADS_INVALID_COMPUTER_OBJECT: An unknown ADSI computer object was requested.
0x80005004L E_ADS_UNKNOWN_OBJECT: An unknown ADSI object was requested.
0x80005005L E_ADS_PROPERTY_NOT_SET: The specified ADSI property was not set.
0x80005006L E_ADS_PROPERTY_NOT_SUPPORTED: The specified ADSI property is not supported.
0x80005007L E_ADS_PROPERTY_INVALID: The specified ADSI property is invalid.
0x80005008L E_ADS_BAD_PARAMETER: One or more input parameters are invalid.
0x80005009L E_ADS_OBJECT_UNBOUND: The specified ADSI object is not bound to a remote resource.
0x8000500AL E_ADS_PROPERTY_NOT_MODIFIED: The specified property for an ADSI object has not been modified.
0x8000500BL E_ADS_PROPERTY_MODIFIED: The specified property for an ADSI has been modified.
0x8000500CL E_ADS_CANT_CONVERT_DATATYPE: The ADSI datatype cannot be converted to or from a native DS datatype.
0x8000500DL E_ADS_PROPERTY_NOT_FOUND: The ADSI property cannot be found in the property cache.
0x8000500EL E_ADS_OBJECT_EXISTS: The ADSI object exists.
0x8000500FL E_ADS_SCHEMA_VIOLATION: The attempted action violates the DS schema rules.
0x80005010L E_ADS_COLUMN_NOT_SET: During a query, the specified column in the Active Directory was not set.
0x80005011L S_ADS_ERRORSOCCURRED: During a query, one or more errors occurred.
0x80005012L S_ADS_NOMORE_ROWS: During a query, there are no more rows to be obtained by the search result.
0x80005013L S_ADS_NOMORE_COLUMNS: During a query, there are no more columns to be obtained by the search result.
0x80005014L E_ADS_INVALID_FILTER: During a query, the specified search filter is invalid.

Error codes beginning with 0x8007xxxx are standard Win32® error codes. Within the Visual Basic® environment, the function error(#) gives you a friendly help message. Outside the Visual Basic environment, do the following. Take the last 3 digits of the error number and convert them from hex to decimal, using the Microsoft® Calculator if you choose. Type

net helpmsg #

where # is the decimal number. A description of the error message is then displayed.

If an error code is 0x8005XXXX, the error is listed above and defined in adserr.h.

Two common errors are 0x80004005, E_FAIL and 0x000041E4 MK_E_SYNTAX. The former is the generic COM fail message; the latter indicates the object was not found and probably indicates an error in the ADsPath name.

More information can be found in adserr.h and in Platform SDK, COM and ActiveX Object Services, COM, Error Handling. Error codes returned from the ADSI OLE DB provider implementation can be found in oledberr.h.

ADSI provides extended error handling so that providers may supply their own error messages and add context information to system errors.

The ADSI functions ADsGetLastError and ADsSetLastError are C-language wrappers provided for applications that receive an ERROR_EXTENDED_ERROR return in response to any ADSI helper function in the ADSI Function List.

Functions Value
ADsGetLastError Returns the last-error code value for the calling thread.
ADsSetLastError Sets the last-error code value for the calling thread.

These two functions follow the same rules as the Win32 functions GetLastError and SetLastError described in the Microsoft Platform SDK.