Formatting DIRSYNC Import and Export Files

The DIRSYNC sample application writes exported data to files and reads imported data from files. Although DIRSYNC communicates with the directory service using directory access functions, the file format it requires for import operations (and generates during export operations) differs from that used by the directory access functions.

Example: DIRSYNC File Format

The following is a sample of the DIRSYNC file format, which is based on the Microsoft Mail 3.2 IMPORT utility file format:

# Sample DIRSYNC import/export file

A /o=Microsoft/ou=WGA/cn=Recipients/cn=JerryWh
- Display-Name:Jerry Wheeler

M /o=Microsoft/ou=WGA/cn=Recipients/cn=West Coast/cn=KevinY
- Display-Name:Kevin Yim

D /o=Microsoft/ou=WGA/cn=Recipients/cn=KevinY
 

Each line is prefixed by a character that indicates how the line should be processed.

Prefix Type Notes
A Add Export: New directory entry.
Import: Add new directory entry.
M Modify Export: Modified directory entry.
Import: Modify directory entry.
D Delete Export: Deleted directory entry.
Import: Delete directory entry.
- Attribute Directory object attribute.
# Comment Comment line. The rest of the line after the hash character is ignored.

EXAMPLE: Syntax of Export or Import File

Here is an example of the import/export file syntax used by the DIRSYNC sample application:

data-list :
data-section
data-section data-list

data-section :
add-section
modify-section
delete-section
comment-line

add-section :
add-line attribute-section

modify-section :
modify-line attribute-section

delete-section :
delete-line

attribute-section :
attribute-line
attribute-line attribute-section

add-line :
A space-character RDN EOL

modify-line :
M space-character RDN EOL

delete-line :
D space-character RDN EOL

attribute-line :
- space-character attribute-label : attribute-value (opt)  EOL

comment-line :
# string EOL

EOL :
CR LF

attribute-value :
constant
string
hex-string
quoted-string

quoted-string :
" string "

hex-string :
\x hex-string-data

hex-string-data :
hex-character
hex-character hex-string-data

hex-character : one of
0 1 2 3 4 5 6 7 8 9 A B C D E F a b c d e f
 

Important Do not enter spaces between attribute names, the colon delimiter, and attribute values.