Platform SDK: Exchange Server

DAPIWrite

The DAPIWrite function writes (imports) information to a directory object.

Quick Info

Header file: DAPI.H
Library: DAPI.LIB
Unicode: Yes

PDAPI_EVENT DAPIWrite (
  DAPI_HANDLE hDAPISession,  
  DWORD dwFlags,             
  PDAPI_ENTRY pAttributes,   
  PDAPI_ENTRY pValues,       
  PULONG lpulUSN,            
  LPTSTR * lppszCreatedAccount,  
  LPTSTR * lppszPassword     
);
 

Parameters

hDAPISession
Input parameter. Specifies the directory operation session handle obtained through DAPIStart.
dwFlags
Accepts defined values that control the directory write operations. Use the bitwise OR operator (|) to enable multiple operations:
DAPI_WRITE_UPDATE
If an object exists, you modify it; if it doesn't exist, you create it. This is the default mode.
DAPI_WRITE_CREATE
Creates the object. If the object exists, DAPIWrite fails.
DAPI_WRITE_MODIFY
Modifies the object. If the object does not exist, DAPIWrite fails.
DAPI_WRITE_DELETE
Deletes the object.
pAttributes
Input parameter. Points to a DAPI_ENTRY structure containing the names of attributes to write. If NULL, This function uses the session default list specified by DAPIStart.
pValues
Input parameter. Points to a DAPI_ENTRY structure containing the values to set on the DIT entry.

Note  You can override the DAPI_WRITE_CREATE, DAPI_WRITE_DELETE, DAPI_WRITE_MODIFY, and DAPI_WRITE_UPDATE values in dwFlags by setting the second value in pAttributes to Mode and the second value in pValues to create, delete, modify, or update.

lpulUSN
Input/output parameter. Points to the USN of the updated DIT entry. If NULL, DAPIWrite does not update this value.
lppszCreatedAccount
Input parameter. Points to the name of created Windows NT account.
lppszPassword
Input parameter. Points to the password generated if a Windows NT account is created.

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 this function, see Using Directory Access Functions.

See Also

BatchImport, DAPIEnd, DAPIRead