Commit 6e33bfb7 authored by Owen Rudge's avatar Owen Rudge Committed by Alexandre Julliard

mapi32: Open the Drafts folder in preparation for creating a message.

parent 8555035d
...@@ -48,10 +48,18 @@ WINE_DEFAULT_DEBUG_CHANNEL(mapi); ...@@ -48,10 +48,18 @@ WINE_DEFAULT_DEBUG_CHANNEL(mapi);
static ULONG sendmail_extended_mapi(LHANDLE mapi_session, ULONG_PTR uiparam, lpMapiMessage message, static ULONG sendmail_extended_mapi(LHANDLE mapi_session, ULONG_PTR uiparam, lpMapiMessage message,
FLAGS flags, ULONG reserved) FLAGS flags, ULONG reserved)
{ {
ULONG tags[] = {1, PR_IPM_DRAFTS_ENTRYID};
ULONG retval = MAPI_E_FAILURE; ULONG retval = MAPI_E_FAILURE;
IMAPISession *session = NULL; IMAPISession *session = NULL;
IMAPITable* msg_table; IMAPITable* msg_table;
LPSRowSet rows = NULL; LPSRowSet rows = NULL;
IMsgStore* msg_store;
IMAPIFolder* folder;
LPENTRYID entry_id;
LPSPropValue props;
ULONG entry_len;
DWORD obj_type;
ULONG values;
HRESULT ret; HRESULT ret;
TRACE("Using Extended MAPI wrapper for MAPISendMail\n"); TRACE("Using Extended MAPI wrapper for MAPISendMail\n");
...@@ -110,9 +118,39 @@ static ULONG sendmail_extended_mapi(LHANDLE mapi_session, ULONG_PTR uiparam, lpM ...@@ -110,9 +118,39 @@ static ULONG sendmail_extended_mapi(LHANDLE mapi_session, ULONG_PTR uiparam, lpM
if (!rows) if (!rows)
goto logoff; goto logoff;
/* Open the message store */
IMAPISession_OpenMsgStore(session, 0, rows->aRow[0].lpProps[0].Value.bin.cb,
(ENTRYID *) rows->aRow[0].lpProps[0].Value.bin.lpb, NULL,
MDB_NO_DIALOG | MAPI_BEST_ACCESS, &msg_store);
/* We don't need this any more */ /* We don't need this any more */
FreeProws(rows); FreeProws(rows);
/* First open the inbox, from which the drafts folder can be opened */
if (IMsgStore_GetReceiveFolder(msg_store, NULL, 0, &entry_len, &entry_id, NULL) == S_OK)
{
IMsgStore_OpenEntry(msg_store, entry_len, entry_id, NULL, 0, &obj_type, (LPUNKNOWN*) &folder);
MAPIFreeBuffer(entry_id);
}
/* Open the drafts folder, or failing that, try asking the message store for the outbox */
if ((folder == NULL) || ((ret = IMAPIFolder_GetProps(folder, (LPSPropTagArray) tags, 0, &values, &props)) != S_OK))
{
TRACE("Unable to open Drafts folder; opening Outbox instead\n");
tags[1] = PR_IPM_OUTBOX_ENTRYID;
ret = IMsgStore_GetProps(msg_store, (LPSPropTagArray) tags, 0, &values, &props);
}
if (ret != S_OK)
goto logoff;
IMsgStore_OpenEntry(msg_store, props[0].Value.bin.cb, (LPENTRYID) props[0].Value.bin.lpb,
NULL, MAPI_MODIFY, &obj_type, (LPUNKNOWN *) &folder);
/* Free up the resources we've used */
IMAPIFolder_Release(folder);
IMsgStore_Release(msg_store);
logoff: ; logoff: ;
IMAPISession_Logoff(session, (ULONG) NULL, 0, 0); IMAPISession_Logoff(session, (ULONG) NULL, 0, 0);
IMAPISession_Release(session); IMAPISession_Release(session);
......
...@@ -452,6 +452,7 @@ ...@@ -452,6 +452,7 @@
#define PR_AB_PROVIDER_ID PROP_TAG(PT_BINARY,0x3615) #define PR_AB_PROVIDER_ID PROP_TAG(PT_BINARY,0x3615)
#define PR_DEFAULT_VIEW_ENTRYID PROP_TAG(PT_BINARY,0x3616) #define PR_DEFAULT_VIEW_ENTRYID PROP_TAG(PT_BINARY,0x3616)
#define PR_ASSOC_CONTENT_COUNT PROP_TAG(PT_I4,0x3617) #define PR_ASSOC_CONTENT_COUNT PROP_TAG(PT_I4,0x3617)
#define PR_IPM_DRAFTS_ENTRYID PROP_TAG(PT_BINARY,0x36D7)
#define PR_ATTACHMENT_X400_PARAMETERS PROP_TAG(PT_BINARY,0x3700) #define PR_ATTACHMENT_X400_PARAMETERS PROP_TAG(PT_BINARY,0x3700)
#define PR_ATTACH_DATA_OBJ PROP_TAG(PT_OBJECT,0x3701) #define PR_ATTACH_DATA_OBJ PROP_TAG(PT_OBJECT,0x3701)
#define PR_ATTACH_DATA_BIN PROP_TAG(PT_BINARY,0x3701) #define PR_ATTACH_DATA_BIN PROP_TAG(PT_BINARY,0x3701)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment