Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

362 lines
11 KiB

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