DAPIRead
The DAPIRead function reads (exports) attributes from a directory object.
Quick Info
Header file: |
DAPI.H |
Library: |
DAPI.LIB |
Unicode: |
Yes |
PDAPI_EVENT DAPIRead (
DAPI_HANDLE hDAPISession,
DWORD dwFlags,
LPTSTR pszObjectName,
DAPI_ENTRY pAttList,
PDAPI_ENTRY * ppValues,
PDAPI_ENTRY * ppAttributes
);
Parameters
-
hDAPISession
-
Input parameter. Specifies the directory operation session handle obtained through DAPIStart.
-
dwFlags
-
Input parameter. Accepts defined values that control the directory read operations. Use the bitwise OR operator (|) to enable multiple operations:
-
DAPI_READ_DEFINED_ATTRIBUTES
-
Returns all attributes that are set for the current object.
-
DAPI_READ_ALL_ATTRIBUTES
-
Returns all attributes that are defined for the class of the current object.
-
DAPI_MODIFY_REPLACE_PROPERTIES
-
Overwrites any existing properties when modifying.
You can also set these flags in the lpDAPIParms->dwFlags parameter member in the DAPIStart function. They remain in effect unless you override them. If both of these flags are set, DAPI_READ_ALL_ATTRIBUTES takes precedence.
-
pszObjectName
-
Input parameter. Points to a string containing the name of the object to read. If specified as a relative distinguished name (RDN), it is combined with the lpDAPIParms->pszBasePoint and lpDAPIParms->pszParentContainer parameter members in the DAPIStart function. If specified with the prefix "/cn=", the string is concatenated to the session pszBasePoint. If specified with the prefix "/o=", the string is taken to be a fully qualified distinguished name (DN).
-
pAttList
-
Input parameter. Points to a DAPI_ENTRY structure containing the names of the attributes to read. The session default list is overridden for the present call only. This parameter is ignored if either DAPI_READ_ALL_ATTRIBUTES or DAPI_READ_DEFINED_ATTRIBUTES is set in dwFlags.
If you specify export attributes in pAttList, the first attribute in pAttList must be NM_OBJECT_CLASS; otherwise, DAPIRead fails.
Normally, you cannot read the attributes of deleted objects. If you want to read the attributes of an object that has been deleted, but not purged, include the NM_IS_DELETED attribute.
-
ppValues
-
Output parameter. Points to the address where the pointer to a DAPI_ENTRY structure containing the values read from the DIT entry is stored. The pointer returned must be freed by a call to DAPIFreeMemory.
-
ppAttributes
-
Output parameter. If either DAPI_READ_ALL_ATTRIBUTES or DAPI_READ_DEFINED_ATTRIBUTES is set in dwFlag, points to the address where a DAPI_ENTRY structure containing the names of the attributes read from the DIT is stored. Otherwise, this parameter is NULL. If this value is not NULL, you must release the pointer with a call to DAPIFreeMemory before your program exits.
Return Values
-
NULL
-
No errors were encountered.
-
A pointer to a DAPI_EVENT structure
-
An error was encountered.
Remarks
If the return value is non-NULL, you must release the DAPI_EVENT structure with a call to DAPIFreeMemory before your program exits.
For more information on the DAPIRead function, see Using Directory Access Functions.
See Also
BatchExport, BatchImport, DAPIEnd, DAPIWrite