home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / trialva / ibmcppw / sdk / winh / mapi.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-11-29  |  12.0 KB  |  363 lines

  1. /*
  2.  *  M A P I . H
  3.  *
  4.  *  Messaging Applications Programming Interface.
  5.  *
  6.  *  Copyright 1993-1995 Microsoft Corporation. All Rights Reserved.
  7.  *
  8.  *  Purpose:
  9.  *
  10.  *    This file defines the structures and constants used by that
  11.  *    subset of the Messaging Applications Programming Interface
  12.  *    which is supported under Windows by Microsoft Mail for PC
  13.  *    Networks version 3.x.
  14.  */
  15.  
  16.  
  17. #ifndef MAPI_H
  18. #define MAPI_H
  19.  
  20.  
  21. /*
  22.  *  Types.
  23.  */
  24.  
  25.  
  26. #ifdef __cplusplus
  27. extern "C" {
  28. #endif
  29.  
  30. typedef unsigned long FAR * LPULONG;
  31. typedef unsigned long       FLAGS;
  32.  
  33. #ifndef __LHANDLE
  34. #define __LHANDLE
  35. typedef unsigned long       LHANDLE, FAR * LPLHANDLE;
  36. #endif
  37.  
  38. typedef unsigned char FAR * LPBYTE;
  39.  
  40. #define    lhSessionNull    ((LHANDLE)0)
  41.  
  42. typedef struct
  43. {
  44.     ULONG ulReserved;            /* Reserved for future use (must be 0)     */
  45.     ULONG flFlags;               /* Flags                                   */
  46.     ULONG nPosition;             /* character in text to be replaced by attachment */
  47.     LPSTR lpszPathName;          /* Full path name of attachment file       */
  48.     LPSTR lpszFileName;          /* Original file name (optional)           */
  49.     LPVOID lpFileType;           /* Attachment file type (can be lpMapiFileTagExt) */
  50. } MapiFileDesc, FAR * lpMapiFileDesc;
  51.  
  52. #define MAPI_OLE                0x00000001
  53. #define MAPI_OLE_STATIC         0x00000002
  54.  
  55.  
  56. typedef struct
  57. {
  58.     ULONG ulReserved;           /* Reserved, must be zero.                  */
  59.     ULONG cbTag;                /* Size (in bytes) of                       */
  60.     LPBYTE lpTag;               /* X.400 OID for this attachment type       */
  61.     ULONG cbEncoding;           /* Size (in bytes) of                       */
  62.     LPBYTE lpEncoding;          /* X.400 OID for this attachment's encoding */
  63. } MapiFileTagExt, FAR *lpMapiFileTagExt;
  64.  
  65.  
  66. typedef struct
  67. {
  68.     ULONG ulReserved;           /* Reserved for future use                  */
  69.     ULONG ulRecipClass;         /* Recipient class                          */
  70.                                 /* MAPI_TO, MAPI_CC, MAPI_BCC, MAPI_ORIG    */
  71.     LPSTR lpszName;             /* Recipient name                           */
  72.     LPSTR lpszAddress;          /* Recipient address (optional)             */
  73.     ULONG ulEIDSize;            /* Count in bytes of size of pEntryID       */
  74.     LPVOID lpEntryID;           /* System-specific recipient reference      */
  75. } MapiRecipDesc, FAR * lpMapiRecipDesc;
  76.  
  77. #ifndef MAPI_ORIG               /* also defined in mapix.h */
  78. #define MAPI_ORIG   0           /* Recipient is message originator          */
  79. #define MAPI_TO     1           /* Recipient is a primary recipient         */
  80. #define MAPI_CC     2           /* Recipient is a copy recipient            */
  81. #define MAPI_BCC    3           /* Recipient is blind copy recipient        */
  82. #endif
  83.  
  84. typedef struct
  85. {
  86.     ULONG ulReserved;             /* Reserved for future use (M.B. 0)       */
  87.     LPSTR lpszSubject;            /* Message Subject                        */
  88.     LPSTR lpszNoteText;           /* Message Text                           */
  89.     LPSTR lpszMessageType;        /* Message Class                          */
  90.     LPSTR lpszDateReceived;       /* in YYYY/MM/DD HH:MM format             */
  91.     LPSTR lpszConversationID;     /* conversation thread ID                 */
  92.     FLAGS flFlags;                /* unread,return receipt                  */
  93.     lpMapiRecipDesc lpOriginator; /* Originator descriptor                  */
  94.     ULONG nRecipCount;            /* Number of recipients                   */
  95.     lpMapiRecipDesc lpRecips;     /* Recipient descriptors                  */
  96.     ULONG nFileCount;             /* # of file attachments                  */
  97.     lpMapiFileDesc lpFiles;       /* Attachment descriptors                 */
  98. } MapiMessage, FAR * lpMapiMessage;
  99.  
  100. #define MAPI_UNREAD             0x00000001
  101. #define MAPI_RECEIPT_REQUESTED  0x00000002
  102. #define MAPI_SENT               0x00000004
  103.  
  104.  
  105. /*
  106.  *  Entry points.
  107.  */
  108.  
  109. /*
  110.  *  flFlags values for Simple MAPI entry points. All documented flags are
  111.  *  shown for each call. Duplicates are commented out but remain present
  112.  *  for every call.
  113.  */
  114.  
  115. /* MAPILogon() flags.       */
  116.  
  117. #define MAPI_LOGON_UI           0x00000001  /* Display logon UI             */
  118. #ifndef MAPI_PASSWORD_UI
  119. #define MAPI_PASSWORD_UI        0x00020000  /* prompt for password only     */
  120. #endif
  121. #define MAPI_NEW_SESSION        0x00000002  /* Don't use shared session     */
  122. #define MAPI_FORCE_DOWNLOAD     0x00001000  /* Get new mail before return   */
  123. #define MAPI_ALLOW_OTHERS       0x00000008  /* Make this a shared session   */
  124. #define MAPI_EXPLICIT_PROFILE   0x00000010  /* Don't use default profile    */
  125. #define MAPI_EXTENDED           0x00000020  /* Extended MAPI Logon          */
  126. #define MAPI_USE_DEFAULT        0x00000040  /* Use default profile in logon */
  127.  
  128. #define MAPI_SIMPLE_DEFAULT (MAPI_LOGON_UI | MAPI_FORCE_DOWNLOAD | MAPI_ALLOW_OTHERS)
  129. #define MAPI_SIMPLE_EXPLICIT (MAPI_NEW_SESSION | MAPI_FORCE_DOWNLOAD | MAPI_EXPLICIT_PROFILE)
  130.  
  131. /* MAPILogoff() flags.      */
  132.  
  133. #define MAPI_LOGOFF_SHARED      0x00000001  /* Close all shared sessions    */
  134. #define MAPI_LOGOFF_UI          0x00000002  /* It's OK to present UI        */
  135.  
  136. /* MAPISendMail() flags.    */
  137.  
  138. /* #define MAPI_LOGON_UI        0x00000001     Display logon UI             */
  139. /* #define MAPI_NEW_SESSION     0x00000002     Don't use shared session     */
  140.  
  141. #ifndef MAPI_DIALOG             /* also defined in property.h */
  142. #define MAPI_DIALOG             0x00000008  /* Display a send note UI       */
  143. #endif
  144. /*# define MAPI_USE_DEFAULT     0x00000040     Use default profile in logon */
  145.  
  146. /* MAPIFindNext() flags.    */
  147.  
  148. #define MAPI_UNREAD_ONLY        0x00000020  /* Only unread messages         */
  149. #define MAPI_GUARANTEE_FIFO     0x00000100  /* use date order               */
  150. #define MAPI_LONG_MSGID         0x00004000  /* allow 512 char returned ID   */
  151.  
  152. /* MAPIReadMail() flags.    */
  153.  
  154. #define MAPI_PEEK               0x00000080  /* Do not mark as read.         */
  155. #define MAPI_SUPPRESS_ATTACH    0x00000800  /* header + body, no files      */
  156. #define MAPI_ENVELOPE_ONLY      0x00000040  /* Only header information      */
  157. #define MAPI_BODY_AS_FILE       0x00000200
  158.  
  159. /* MAPISaveMail() flags.    */
  160.  
  161. /* #define MAPI_LOGON_UI        0x00000001     Display logon UI             */
  162. /* #define MAPI_NEW_SESSION     0x00000002     Don't use shared session     */
  163. /* #define MAPI_LONG_MSGID      0x00004000     allow 512 char returned ID   */
  164.  
  165. /* MAPIAddress() flags.     */
  166.  
  167. /* #define MAPI_LOGON_UI        0x00000001     Display logon UI             */
  168. /* #define MAPI_NEW_SESSION     0x00000002     Don't use shared session     */
  169.  
  170. /* MAPIDetails() flags.     */
  171.  
  172. /* #define MAPI_LOGON_UI        0x00000001     Display logon UI             */
  173. /* #define MAPI_NEW_SESSION     0x00000002     Don't use shared session     */
  174. #define MAPI_AB_NOMODIFY        0x00000400  /* Don't allow mods of AB entries */
  175.  
  176. /* MAPIResolveName() flags. */
  177.  
  178. /* #define MAPI_LOGON_UI        0x00000001     Display logon UI             */
  179. /* #define MAPI_NEW_SESSION     0x00000002     Don't use shared session     */
  180. /* #define MAPI_DIALOG          0x00000008     Prompt for choices if ambiguous */
  181. /* #define MAPI_AB_NOMODIFY     0x00000400     Don't allow mods of AB entries */
  182.  
  183. typedef ULONG (FAR PASCAL MAPILOGON)(
  184.     ULONG ulUIParam,
  185.     LPSTR lpszProfileName,
  186.     LPSTR lpszPassword,
  187.     FLAGS flFlags,
  188.     ULONG ulReserved,
  189.     LPLHANDLE lplhSession
  190. );
  191. typedef MAPILOGON FAR *LPMAPILOGON;
  192. MAPILOGON MAPILogon;
  193.  
  194. typedef ULONG (FAR PASCAL MAPILOGOFF)(
  195.     LHANDLE lhSession,
  196.     ULONG ulUIParam,
  197.     FLAGS flFlags,
  198.     ULONG ulReserved
  199. );
  200. typedef MAPILOGOFF FAR *LPMAPILOGOFF;
  201. MAPILOGOFF MAPILogoff;
  202.  
  203.  
  204. typedef ULONG (FAR PASCAL MAPISENDMAIL)(
  205.     LHANDLE lhSession,
  206.     ULONG ulUIParam,
  207.     lpMapiMessage lpMessage,
  208.     FLAGS flFlags,
  209.     ULONG ulReserved
  210. );
  211. typedef MAPISENDMAIL FAR *LPMAPISENDMAIL;
  212. MAPISENDMAIL MAPISendMail;
  213.  
  214.  
  215. typedef ULONG (FAR PASCAL MAPISENDDOCUMENTS)(
  216.     ULONG ulUIParam,
  217.     LPSTR lpszDelimChar,
  218.     LPSTR lpszFilePaths,
  219.     LPSTR lpszFileNames,
  220.     ULONG ulReserved
  221. );
  222. typedef MAPISENDDOCUMENTS FAR *LPMAPISENDDOCUMENTS;
  223. MAPISENDDOCUMENTS MAPISendDocuments;
  224.  
  225.  
  226. typedef ULONG (FAR PASCAL MAPIFINDNEXT)(
  227.     LHANDLE lhSession,
  228.     ULONG ulUIParam,
  229.     LPSTR lpszMessageType,
  230.     LPSTR lpszSeedMessageID,
  231.     FLAGS flFlags,
  232.     ULONG ulReserved,
  233.     LPSTR lpszMessageID
  234. );
  235. typedef MAPIFINDNEXT FAR *LPMAPIFINDNEXT;
  236. MAPIFINDNEXT MAPIFindNext;
  237.  
  238. typedef ULONG (FAR PASCAL MAPIREADMAIL)(
  239.     LHANDLE lhSession,
  240.     ULONG ulUIParam,
  241.     LPSTR lpszMessageID,
  242.     FLAGS flFlags,
  243.     ULONG ulReserved,
  244.     lpMapiMessage FAR *lppMessage
  245. );
  246. typedef MAPIREADMAIL FAR *LPMAPIREADMAIL;
  247. MAPIREADMAIL MAPIReadMail;
  248.  
  249. typedef ULONG (FAR PASCAL MAPISAVEMAIL)(
  250.     LHANDLE lhSession,
  251.     ULONG ulUIParam,
  252.     lpMapiMessage lpMessage,
  253.     FLAGS flFlags,
  254.     ULONG ulReserved,
  255.     LPSTR lpszMessageID
  256. );
  257. typedef MAPISAVEMAIL FAR *LPMAPISAVEMAIL;
  258. MAPISAVEMAIL MAPISaveMail;
  259.  
  260. typedef ULONG (FAR PASCAL MAPIDELETEMAIL)(
  261.     LHANDLE lhSession,
  262.     ULONG ulUIParam,
  263.     LPSTR lpszMessageID,
  264.     FLAGS flFlags,
  265.     ULONG ulReserved
  266. );
  267. typedef MAPIDELETEMAIL FAR *LPMAPIDELETEMAIL;
  268. MAPIDELETEMAIL MAPIDeleteMail;
  269.  
  270. typedef ULONG (FAR PASCAL MAPIFREEBUFFER)(
  271.     LPVOID pv
  272. );
  273. typedef MAPIFREEBUFFER FAR *LPMAPIFREEBUFFER;
  274. MAPIFREEBUFFER MAPIFreeBuffer;
  275.  
  276. typedef ULONG (FAR PASCAL MAPIADDRESS)(
  277.     LHANDLE lhSession,
  278.     ULONG ulUIParam,
  279.     LPSTR lpszCaption,
  280.     ULONG nEditFields,
  281.     LPSTR lpszLabels,
  282.     ULONG nRecips,
  283.     lpMapiRecipDesc lpRecips,
  284.     FLAGS flFlags,
  285.     ULONG ulReserved,
  286.     LPULONG lpnNewRecips,
  287.     lpMapiRecipDesc FAR *lppNewRecips
  288. );
  289. typedef MAPIADDRESS FAR *LPMAPIADDRESS;
  290. MAPIADDRESS MAPIAddress;
  291.  
  292. typedef ULONG (FAR PASCAL MAPIDETAILS)(
  293.     LHANDLE lhSession,
  294.     ULONG ulUIParam,
  295.     lpMapiRecipDesc lpRecip,
  296.     FLAGS flFlags,
  297.     ULONG ulReserved
  298. );
  299. typedef MAPIDETAILS FAR *LPMAPIDETAILS;
  300. MAPIDETAILS MAPIDetails;
  301.  
  302. typedef ULONG (FAR PASCAL MAPIRESOLVENAME)(
  303.     LHANDLE lhSession,
  304.     ULONG ulUIParam,
  305.     LPSTR lpszName,
  306.     FLAGS flFlags,
  307.     ULONG ulReserved,
  308.     lpMapiRecipDesc FAR *lppRecip
  309. );
  310. typedef MAPIRESOLVENAME FAR *LPMAPIRESOLVENAME;
  311. MAPIRESOLVENAME MAPIResolveName;
  312.  
  313. #ifndef SUCCESS_SUCCESS
  314. #define SUCCESS_SUCCESS                 0
  315. #endif
  316. #define MAPI_USER_ABORT                 1
  317. #define MAPI_E_USER_ABORT               MAPI_USER_ABORT
  318. #define MAPI_E_FAILURE                  2
  319. #define MAPI_E_LOGON_FAILURE            3
  320. #define MAPI_E_LOGIN_FAILURE            MAPI_E_LOGON_FAILURE
  321. #define MAPI_E_DISK_FULL                4
  322. #define MAPI_E_INSUFFICIENT_MEMORY      5
  323. #define MAPI_E_ACCESS_DENIED            6
  324. #define MAPI_E_TOO_MANY_SESSIONS        8
  325. #define MAPI_E_TOO_MANY_FILES           9
  326. #define MAPI_E_TOO_MANY_RECIPIENTS      10
  327. #define MAPI_E_ATTACHMENT_NOT_FOUND     11
  328. #define MAPI_E_ATTACHMENT_OPEN_FAILURE  12
  329. #define MAPI_E_ATTACHMENT_WRITE_FAILURE 13
  330. #define MAPI_E_UNKNOWN_RECIPIENT        14
  331. #define MAPI_E_BAD_RECIPTYPE            15
  332. #define MAPI_E_NO_MESSAGES              16
  333. #define MAPI_E_INVALID_MESSAGE          17
  334. #define MAPI_E_TEXT_TOO_LARGE           18
  335. #define MAPI_E_INVALID_SESSION          19
  336. #define MAPI_E_TYPE_NOT_SUPPORTED       20
  337. #define MAPI_E_AMBIGUOUS_RECIPIENT      21
  338. #define MAPI_E_AMBIG_RECIP              MAPI_E_AMBIGUOUS_RECIPIENT
  339. #define MAPI_E_MESSAGE_IN_USE           22
  340. #define MAPI_E_NETWORK_FAILURE          23
  341. #define MAPI_E_INVALID_EDITFIELDS       24
  342. #define MAPI_E_INVALID_RECIPS           25
  343. #define MAPI_E_NOT_SUPPORTED            26
  344.  
  345.  
  346.  
  347. #ifdef MAPIX_H
  348. /*  Maps from a simple mapi session to a MAPI 1.0 extended mapi session */
  349.  
  350. STDMETHODIMP_(SCODE)
  351. ScMAPIXFromSMAPI(LHANDLE lhSimpleSession,
  352.                 ULONG ulFlags,
  353.                 LPCIID lpInterface,
  354.                 LPMAPISESSION FAR * lppMAPISession);
  355. #endif /* MAPIX_H */
  356.  
  357.  
  358. #ifdef  __cplusplus
  359. }       /*  extern "C" */
  360. #endif
  361.  
  362. #endif /* MAPI_H */
  363.