> Yeah! That's fine for a few addressbooks, but I'm talking about 20
> users, some with up to 50 addressbooks.
>
> I need to automate the process so that I can do the changes
> overnight. I can open and read the addressbook file, but I'm having
> trouble rewriting the data.
Here's what I have for the file format of the address book PMR and PM! files. Hope this helps. If you need more send me a message at support@tstephenson.com since I'm not going to be in the forum all that much at $0.68 a minute. ;-)
Address books File formats
Address books are binary files, laid out as follows: the first 128 bytes of the file is a header. The first 50 bytes of the header contain the long name of the address book, as a nul-terminated C string. The byte at offset 51 in the header (ie, header [51]) is non-zero if the book is a system address book. All other bytes in the header are reserved and must be set to 0. Following the header is simply a flat file of the following C structure:
typedef struct
{
int flag;
char name [40]; /* Username, and alias */
char dept [40]; /* Department */
char index [12];/* Quick lookup key */
char phys_address [60]; /* Delivery address */
char post_address [60]; /* Postal address */
char phone [24];/* Phone number */
char fax [24]; /* Fax number */
char details [80]; /* Anything you want */
char address [100] /* E-mail address */
long user_field; /* For your use */
char reserved [12];
} ADDRESS;
The flag field is reserved for internal use and must be 0. The name field may not be blank. user_field is provided for you to use if you wish — Pegasus Mail will initialise it to 0, but will never touch it after that. You should NOT use the bytes marked reserved.
The .PM! file associated with each address book consists of a subset of the master record, using the following structure:
typedef struct
{
int flag;
char index [12]; /* As in master record */
int filepos; /* Record # in master file */
char name [36]; /* Sorting form of name */
char phone [12];
} AINDEX;
> Yeah! That's fine for a few addressbooks, but I'm talking about 20
> users, some with up to 50 addressbooks.
>
> I need to automate the process so that I can do the changes
> overnight. I can open and read the addressbook file, but I'm having
> trouble rewriting the data.
Here's what I have for the file format of the address book PMR and PM! files.  Hope this helps.  If you need more send me a message at support@tstephenson.com since I'm not going to be in the forum all that much at $0.68 a minute.  ;-)
Address books File formats
Address books are binary files, laid out as follows: the first 128 bytes of the file is a header. The first 50 bytes of the header contain the long name of the address book, as a nul-terminated C string. The byte at offset 51 in the header (ie, header [51]) is non-zero if the book is a system address book. All other bytes in the header are reserved and must be set to 0. Following the header is simply a flat file of the following C structure:  
typedef struct
{
int flag;
char name [40]; /* Username, and alias */
char dept [40]; /* Department */
char index [12];/* Quick lookup key */
char phys_address [60]; /* Delivery address */
char post_address [60]; /* Postal address */
char phone [24];/* Phone number */
char fax [24]; /* Fax number */
char details [80]; /* Anything you want */
char address [100] /* E-mail address */
long user_field; /* For your use */
char reserved [12];
} ADDRESS;
The flag field is reserved for internal use and must be 0. The name field may not be blank. user_field is provided for you to use if you wish — Pegasus Mail will initialise it to 0, but will never touch it after that. You should NOT use the bytes marked reserved.  
The .PM! file associated with each address book consists of a subset of the master record, using the following structure:  
typedef struct
{
int flag;
char index [12]; /* As in master record */
int filepos; /* Record # in master file */
char name [36]; /* Sorting form of name */
char phone [12];
} AINDEX;