I am trying to write a C++ code for importing mails from MSOUTLOOK
using MAPI functions.I use the fuction PR_BODY_W for gewtting the HTML
mail body but it doesn't works so i use GETHTMLBODY() instead.Thus i
got the HTML mails correctly.
But the problem is that i used PR_HASATTACH,
PR_ATTACH_FILENAME_W,PR_ATTACH_TAG for getting attachments.But i am not
getting attachments correctly.some pictures (mails in msoutlook) are
taken here as attachments(in msoutlook it is not shown as attachments)
and is displaying one after another in my application. please give me
suggestion for getting the mails correctly or please help me by giving
a sample code(using MAPI) for getting(importing) mails from msoutlook.
regards,
Alex
On 15 Mar 2006 03:23:49 -0800, "Alex" <alex...@gmail.com> wrote :
>I am trying to write a C++ code for importing mails from MSOUTLOOK
>using MAPI functions.
What do you mean with "importing"? Have you had a look at
IConverterSession's MAPIToMIMEStm() and MIMEToMAPI() member functions?
(http://msdn.microsoft.com/library/en-us/olintapi/html/oliaIConverterSession_HV01154520.asp)
HTH,
Volker
__
Mail replies to/an V B A R T H E L D at G M X dot D E
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
"Alex" <alex...@gmail.com> wrote in message
news:1142421829.4...@j52g2000cwj.googlegroups.com...
I meant that i want to get(take) emails from msoutlook to my
application.The problem i am facing is that the embedded images are
getting as attachments and is displaying seperately(not as a single one
as in actual case) .please help me in getting all types of emais from
msoutlook to my application using MAPI
regards,
Alex
On 15 Mar 2006 23:36:20 -0800, "Alex" <alex...@gmail.com> wrote :
>I meant that i want to get(take) emails from msoutlook to my
>application.
I got that. Depends in which format you expect the message. Easiest
is/could be RFC(2)822 where you're able to use the IConverterSession API
and it's back and forth conversion routines.
>The problem i am facing is that the embedded images are
>getting as attachments
Sure. That is - to my knowledge - the intended behaviour. You have to
open the attachment and then recurse, depending if it's a "file" (open a
stream on it) or a "message" (using IMAPIProp::OpenProperty() and get a
MAPI_Message object type back) - storing everything you find in a
suitable container. I've used STL vectors for that.
>and is displaying seperately(not as a single one
>as in actual case) .please help me in getting all types of emais from
>msoutlook to my application using MAPI
This is not an easy job and currently a little beyond my time schedule.
However, I have copied a selection of my code that works with recipients
tables, attachments and the like below. Take care - almost all error
handling has been removed and you might get unresolved externals as I
for sure have missed a handful of helper functions and definitions. But
it should help you to get an impression what's necessary. All that code
works with LPEXCHEXTCALLBACK pEECB because it was inteded to run within
an ECE. So you might want to change that to use a global IMAPISession
pointer or IMAPIFolder, IMAPIProp or whatever.
Good luck and happy hacking.
Volker
namespace MAIL_ENUMS
{
enum ePROTOCOLS {eSMTP, eEX, eX400, ePROFS, eMHS, eNUM_PROTO};
enum eADDRTYPES {eORIGINATOR=Outlook::olOriginator, eTO=Outlook::olTo, eCC=Outlook::olCC, eBCC=Outlook::olBCC, eNUM_ADDRTYPES};
enum eIMPORTANCE {e_I_LOW=0, e_I_NORMAL=1, eI_HIGH=2};
enum eSENSITIVITY {e_S_NORMAL=0, e_S_PERSONAL=1, e_S_PRIVATE=2, e_S_CONFIDENTIAL=3};
};
struct CMailUser
{
CMailUser() : m_sAddr(""), m_sOlAddr(""), m_Proto(MAIL_ENUMS::eSMTP), m_Type(MAIL_ENUMS::eTO) { };
CMailUser(std::string sAddr, MAIL_ENUMS::ePROTOCOLS Proto, MAIL_ENUMS::eADDRTYPES Type) :
m_sAddr(sAddr), m_Proto(Proto), m_Type(MAIL_ENUMS::eTO), m_sOlAddr("") { };
inline void clear() { m_sAddr=""; m_sOlAddr="", m_Proto=MAIL_ENUMS::eSMTP; m_Type=MAIL_ENUMS::eTO; };
std::string m_sAddr;
std::string m_sOlAddr;
MAIL_ENUMS::ePROTOCOLS m_Proto;
MAIL_ENUMS::eADDRTYPES m_Type;
};
static char *s_SZPROTO[MAIL_ENUMS::eNUM_PROTO]={"SMTP", "EX", "X400", "PROFS", "MHS"};
static char *s_SZADDRTYPES[MAIL_ENUMS::eNUM_ADDRTYPES]={"SENDER", "TO", "CC", "BCC"};
typedef CMailUser CRecipient;
typedef CMailUser CSender;
typedef std::vector< CRecipient > CRecipients;
typedef std::vector< CAttachment > CAttachments;
struct CFlags
{
CFlags() : m_iImportance(MAIL_ENUMS::e_I_NORMAL), m_iSensitivity(MAIL_ENUMS::e_S_NORMAL), m_ulType(0), m_bDeliveryReportRequested(false), m_bReadRecieptRequested(false), m_sTransportMessageHeaders(""), m_sEID("") { };
inline void clear() { m_iImportance=MAIL_ENUMS::e_I_NORMAL; m_iSensitivity=MAIL_ENUMS::e_S_NORMAL; m_ulType=0; m_bDeliveryReportRequested=false; m_bReadRecieptRequested=false; m_sTransportMessageHeaders=""; m_sEID=""; };
int m_iImportance; // importance of message (0: Low, 1: Normal, 2: High)
int m_iSensitivity; // sensitivity of message (0: Normal, 1: Personal, 2: Private, 3: Confidential)
unsigned long m_ulType; // bitmask for status (Binary mask from MAIL_ENUMS::eMAILTYPES)
bool m_bDeliveryReportRequested;
bool m_bReadRecieptRequested;
std::string m_sTransportMessageHeaders;
std::string m_sEID;
};
struct CMail
{
CMail() : m_sSubject(""), m_Body(std::vector<char>(0)) { };
inline void clear() { m_sSubject=""; m_Body.clear(); m_Sender.clear(); m_Recipients.clear(); m_Attachments.clear(); m_Flags.clear(); };
std::string m_sSubject;
std::vector< char > m_Body;
CSender m_Sender;
CRecipients m_Recipients;
CAttachments m_Attachments;
CFlags m_Flags;
};
struct CFileAttachment
{
CFileAttachment() : m_sName(""), m_sMimeType("application/octet-stream"), m_Data(std::vector<char>(0)) // empty c'tor
{ }
CFileAttachment(std::string sName) : m_sName(sName), m_Data(std::vector<char>(0)) // c'tor with file name and automatic detection of MIME type
{
GetMimeType(m_sName, m_sMimeType);
}
CFileAttachment(std::string sName, std::string sMimeType) : m_sName(sName), m_sMimeType(sMimeType), m_Data(std::vector<char>(0)) // c'tor with file name and MIME type
{ }
CFileAttachment(std::string sName, std::string sMimeType, unsigned int uiLen) : m_sName(sName), m_sMimeType(sMimeType) // c'tor with file name, MIME type and size reservation
{
m_Data.reserve(uiLen);
}
CFileAttachment(std::string sName, std::string sMimeType, std::vector< char >& Data) : m_sName(sName), m_sMimeType(sMimeType), m_Data(Data) // full c'tor with filename, MIME type and data
{ }
inline void clear()
{
m_sName=""; m_sMimeType="application/octet-stream"; m_Data.clear();
}
std::string m_sName; // filename of attachment
std::string m_sMimeType; // attachment mime type
std::vector< char > m_Data; // raw attachment data
}; // struct CFileAttachment
struct CAttachment
{
CAttachment(bool isEmbedded=false); // construct an attachment of given type (embedded mail / file)
CAttachment(const CFileAttachment& att); // construct file attachment from template
CAttachment(const CMail& att); // construct mail attachment from template
~CAttachment(); // destructor
bool m_isEmbedded; // flag to determine if attachment is an embedded mail
unsigned long m_ulNum; // number of attachment in associated IMAPITable
union
{
CFileAttachment* m_pFileAttachment;
CMail* m_pMailAttachment;
} m_pAttachment;
// member functions that return references to the attachments
CFileAttachment& FileAttachment() const { leoassert(!m_isEmbedded); return *m_pAttachment.m_pFileAttachment; }
CMail& MailAttachment() const { leoassert(m_isEmbedded); return *m_pAttachment.m_pMailAttachment; }
CAttachment(const CAttachment& other); // copy constructor
CAttachment& operator= (const CAttachment& other); // assignment
}; // struct CAttachment
//////////////////////////////////////////////////////////////////////
// read a property from object into memory using IStream interface
//////////////////////////////////////////////////////////////////////
HRESULT MAPI_ReadPropStream(IMAPIProp* pProp, unsigned long ulProp, std::vector<char>& Data)
{
std::vector<char> Buffer(CHUNK, '\0');
HRESULT hr=SYSERRS::E_NOERROR;
unsigned long ulRead;
IStream* pStream=NULL;
STATSTG stat;
unsigned long ulSize=0;
if(FAILED(hr=pProp->OpenProperty(ulProp, &IID_IStream, 0, 0, (IUnknown**)&pStream))) goto err;
Data.clear(); // clear the data vector
if(FAILED(hr=pStream->Stat(&stat, STATFLAG_NONAME))) goto err; // get stream statistics (we don't need a name)
do // read from pStream in chunks of CHUNK
{
if(FAILED(hr=pStream->Read(&Buffer[0], CHUNK, &ulRead))) goto err; // read into buffer vector
Data.insert(Data.end(), Buffer.begin(), Buffer.begin()+ulRead); // add (append) read buffer to data vector
ulSize+=ulRead;
} while(ulRead);
if(stat.cbSize.LowPart!=ulSize) // check for size mismatch (we are satisfied with the lower 4GB of the attachment)
{
hr=SYSERRS::E_STREAM_SIZE_MISMATCH;
goto err;
}
err:
if(pStream) pStream->Release(); // release the stream
return hr;
} // HRESULT MAPI_ReadPropStream(IMAPIProp* pProp, unsigned long ulProp, std::vector<char> Data)
//////////////////////////////////////////////////////////////////////
// get and store all attachments of an email message
//////////////////////////////////////////////////////////////////////
HRESULT MAPI_GetAttachments(LPEXCHEXTCALLBACK pEECB, CAttachments& Attachments)
{
HRESULT hr=SYSERRS::E_NOERROR;
IMessage* pMessage=NULL;
if(FAILED(hr=pEECB->GetObject(NULL,(IMAPIProp**)(&pMessage)))) goto err; // get the message
hr=MAPI_GetAttachments(pEECB, pMessage, Attachments);
err:
if(pMessage) MAPIFreeBuffer(pMessage);
return hr;
} // HRESULT MAPI_GetAttachments(LPEXCHEXTCALLBACK pEECB, CAttachments& Attachments)
//////////////////////////////////////////////////////////////////////
// get and store all attachments of an email message
//////////////////////////////////////////////////////////////////////
HRESULT MAPI_GetAttachments(LPEXCHEXTCALLBACK pEECB, IMessage* pMessage, CAttachments& Atts)
{
HRESULT hr=S_OK;
IAttach* pAttach=NULL;
IMAPITable* pAttachmentsTable=NULL;
SPropValue *pProp=NULL;
SRowSet* pAttachmentRows=NULL;
unsigned long ul, ulNum;
CAttachment* pAtt=NULL;
IMessage* pMessageEmb = NULL;
// define a bunch of properties here that might be used later
enum {ePR_ATTACH_NUM, ePR_ATTACH_METHOD, ePR_ATTACH_LONG_FILENAME, ePR_ATTACH_FILENAME, ePR_ATTACH_MIME_TAG, NUM_COLS};
static SizedSPropTagArray(NUM_COLS, PrAttach) = {NUM_COLS, {PR_ATTACH_NUM, PR_ATTACH_METHOD, PR_ATTACH_LONG_FILENAME, PR_ATTACH_FILENAME, PR_ATTACH_MIME_TAG}};
if(FAILED(hr=HrGetOneProp(pMessage, PR_HASATTACH, &pProp)) || !pProp->Value.b) // no PR_HASATTACH property present or its value==false means:
{
hr=S_OK; // no attachment there
goto err; // just finish processing
}
// get attachment table
if(FAILED(hr=pMessage->GetAttachmentTable(0, &pAttachmentsTable))) goto err;
if(FAILED(hr=HrQueryAllRows(pAttachmentsTable, (LPSPropTagArray)&PrAttach, NULL, NULL, 0L, &pAttachmentRows))) goto err;
for(ul=0; ul<pAttachmentRows->cRows; ul++) // enumerate all attachments
{
pAtt=NULL; // reset pointer (shows that new attachment has been "pushed")
ulNum=pAttachmentRows->aRow[ul].lpProps[ePR_ATTACH_NUM].Value.ul; // store attachment number
if(FAILED(hr=pMessage->OpenAttach(ulNum, NULL, MAPI_BEST_ACCESS, &pAttach))) goto err;
switch(pAttachmentRows->aRow[ul].lpProps[ePR_ATTACH_METHOD].Value.ul) // switch for the attachment method
{
case ATTACH_BY_VALUE:
{
// insert a new (file) attachment into storage class (we are working on the pointer pAtt in order not to
// have two copies of the same attachment in memory at the same time)
Atts.push_back(CFileAttachment()); pAtt=&(*Atts.rbegin());
pAtt->m_ulNum=ulNum;
// try to get the attachment's filename (for undef'd props, .ulPropTag is PT_NULL)
if(VT_LPSTR==PROP_TYPE(pAttachmentRows->aRow[ul].lpProps[ePR_ATTACH_LONG_FILENAME].ulPropTag)) // long filename
{
pAtt->FileAttachment().m_sName=pAttachmentRows->aRow[ul].lpProps[ePR_ATTACH_LONG_FILENAME].Value.lpszA;
}
else if(VT_LPSTR==PROP_TYPE(pAttachmentRows->aRow[ul].lpProps[ePR_ATTACH_FILENAME].ulPropTag)) // short filename
{
pAtt->FileAttachment().m_sName=pAttachmentRows->aRow[ul].lpProps[ePR_ATTACH_FILENAME].Value.lpszA;
}
else
{
// no filename available - create one from static global UID (this should normally _NOT_ happen!)
std::ostringstream os;
os << "~unknown" << g_lUID++;
pAtt->FileAttachment().m_sName=os.str();
}
// try to get the attachment's MIME type
if(VT_LPSTR==PROP_TYPE(pAttachmentRows->aRow[ul].lpProps[ePR_ATTACH_MIME_TAG].ulPropTag)) // mime property is available
{
pAtt->FileAttachment().m_sMimeType=pAttachmentRows->aRow[ul].lpProps[ePR_ATTACH_MIME_TAG].Value.lpszA;
}
else // determine MIME type from filename extension
{
GetMimeType(pAtt->FileAttachment().m_sName, pAtt->FileAttachment().m_sMimeType); // don't care about the result because GetMimeType() returns a default value
}
if(FAILED(hr=MAPI_ReadPropStream(pAttach, PR_ATTACH_DATA_BIN, pAtt->FileAttachment().m_Data))) goto err; // read the whole attachment into data vector
break;
} // case ATTACH_BY_VALUE:
case ATTACH_EMBEDDED_MSG:
{
// insert a new (mail) attachment into storage class (we are working on the pointer pAtt in order not to
// have two copies of the same attachment in memory at the same time)
Atts.push_back(CMail()); pAtt=&(*Atts.rbegin());
pAtt->m_ulNum=ulNum;
// open the embedded message and parse props into pAtt->MailAttachment() which is the embedded message
if(FAILED(hr=pAttach->OpenProperty(PR_ATTACH_DATA_OBJ, &IID_IMessage, 0, MAPI_MODIFY, (LPUNKNOWN*)&pMessageEmb))) goto err;
if(FAILED(hr=MAPI_OpenMessage(pEECB, pMessageEmb, pAtt->MailAttachment()))) goto err;
if(pMessageEmb) { pMessageEmb->Release(); pMessageEmb=NULL; }
break;
}
default:
{
// ignore unknown attachments
break;
}
} // switch(pAttachmentRows->aRow[ul].lpProps[ePR_ATTACH_METHOD].Value.ul)
if(pProp)
{
MAPIFreeBuffer(pProp); // free buffer if necessary
pProp=NULL;
} // if(pProp)
if(pAttach)
{
pAttach->Release();
pAttach=NULL;
}
} // for(ul=0; ul<pAttachmentRows->cRows; ul++)
err:
if(FAILED(hr) && pAtt) Atts.pop_back(); // if there was an error and we already pushed the att, so remove it
// free properties, rows and table
if(pAttachmentRows) FreeProws(pAttachmentRows);
if(pAttachmentsTable) pAttachmentsTable->Release();
if(pProp) MAPIFreeBuffer(pProp);
if(pAttach) pAttach->Release();
if(pMessageEmb) pMessageEmb->Release();
return hr;
} // HRESULT MAPI_GetAttachments(IMessage* pMessage, CAttachments& Atts)
//////////////////////////////////////////////////////////////////////
// get standard email address of user and other properties
//////////////////////////////////////////////////////////////////////
HRESULT MAPI_GetStandardEmail(LPEXCHEXTCALLBACK pEECB, SPropValue* pEntryId, CMailUser& MailUser)
{
HRESULT hr=SYSERRS::E_NOERROR;
IAddrBook* pAdrBook=NULL;
IMailUser* pMailUser=NULL;
SPropValue* pMailUserProp=NULL;
unsigned long ulObjType, ulCount=0;
int iProtocolNum;
enum {ePR_ADDRTYPE, ePR_EMAIL_ADDRESS, ePR_SMTP_ADDRESS, ePR_DISPLAY_NAME, NUM_COLS};
static SizedSPropTagArray(NUM_COLS, PropMailUser) = {NUM_COLS, {PR_ADDRTYPE, PR_EMAIL_ADDRESS, PR_SMTP_ADDRESS, PR_DISPLAY_NAME}};
if(FAILED(hr=pEECB->GetSession(NULL, &pAdrBook))) goto err; // get the address book
if(FAILED(hr=pAdrBook->OpenEntry(pEntryId->Value.bin.cb, (LPENTRYID)pEntryId->Value.bin.lpb, &IID_IMailUser, MAPI_BEST_ACCESS, &ulObjType, (LPUNKNOWN *)&pMailUser))) // open the address book entry in pEntryId
{
goto err;
} // if(FAILED(hr=pAdrBook->OpenEntry( ...
if(MAPI_MAILUSER!=ulObjType) // should be a mail user object
{
hr=E_FAIL;
goto err;
}
if(FAILED(hr=pMailUser->GetProps((LPSPropTagArray)&PropMailUser, 0, &ulCount, &pMailUserProp))) goto err;
if(MAPI_W_ERRORS_RETURNED==hr) hr=SYSERRS::E_NOERROR; // delete a hr==0x40380 (not all properties retrieved) warning
if(PT_STRING8!=PROP_TYPE(pMailUserProp[ePR_ADDRTYPE].ulPropTag)) // address type must be string8
{
hr=E_FAIL;
goto err;
}
iProtocolNum=GetProtocolNum(pMailUserProp[ePR_ADDRTYPE].Value.lpszA); // convert protocol from string to number
MailUser.m_Proto=(MAIL_ENUMS::ePROTOCOLS)iProtocolNum; // save protocol (EX, SMTP, ...) for MailUser
switch(iProtocolNum) // switch for the possible protocols
{
case MAIL_ENUMS::eSMTP:
{
// plain SMTP message ("Friendly Name" <john...@company.com>) select PR_EMAIL_ADDRESS
MailUser.m_sAddr=pMailUserProp[ePR_EMAIL_ADDRESS].Value.lpszA;
break;
}
case MAIL_ENUMS::eEX:
{
if(PT_STRING8==PROP_TYPE(pMailUserProp[ePR_EMAIL_ADDRESS].ulPropTag))
MailUser.m_sOlAddr=pMailUserProp[ePR_EMAIL_ADDRESS].Value.lpszA; // if there's a valid PR_EMAIL_ADDRESS, add the OL-sepcific email addy
// exchange server EX message ("Administrator") select PR_SMTP_ADDRESS (0x39FE001E)
if(PT_STRING8==PROP_TYPE(pMailUserProp[ePR_SMTP_ADDRESS].ulPropTag))
MailUser.m_sAddr=pMailUserProp[ePR_SMTP_ADDRESS].Value.lpszA;
else hr=E_FAIL;
break;
}
default:
{
// don't know for X400, PROFS, MHS, ...
hr=E_FAIL;
goto err;
}
} // switch(iProtocolNum)
err:
if(pMailUserProp) MAPIFreeBuffer(pMailUserProp);
if(pMailUser) pMailUser->Release();
if(pAdrBook) pAdrBook->Release();
return hr;
} // MAPI_GetStandardEmail(SPropValue* pEntryId, CMailUser& MailUser)
//////////////////////////////////////////////////////////////////////
// get all recipients of an email
//////////////////////////////////////////////////////////////////////
HRESULT MAPI_GetRecipients(LPEXCHEXTCALLBACK pEECB, CRecipients& Rcpts, CAddressCache* pAddrCache)
{
HRESULT hr=SYSERRS::E_NOERROR;
IMessage* pMessage=NULL;
if(FAILED(hr=pEECB->GetObject(NULL,(IMAPIProp**)(&pMessage)))) goto err; // get the message
hr=MAPI_GetRecipients(pEECB, pMessage, Rcpts, pAddrCache);
err:
if(pMessage) MAPIFreeBuffer(pMessage);
return hr;
} // HRESULT MAPI_GetRecipients(LPEXCHEXTCALLBACK pEECB, IMessage* pMessage, CRecipients& Rcpts)
//////////////////////////////////////////////////////////////////////
// get all recipients of an email
//////////////////////////////////////////////////////////////////////
HRESULT MAPI_GetRecipients(LPEXCHEXTCALLBACK pEECB, IMessage* pMessage, CRecipients& Rcpts, CAddressCache* pAddrCache)
{
HRESULT hr=SYSERRS::E_NOERROR;
IMAPITable* pRecipientsTable=NULL;
SRowSet* pRecipientRows=NULL;
char* pszRecipientEmail=NULL;
unsigned long ul;
IMailUser* pMailUser=NULL;
CMailUser MailUser;
enum {ePR_ADDRTYPE, ePR_RECIPIENT_TYPE, ePR_ENTRYID, NUM_COLS};
static SizedSPropTagArray(NUM_COLS, PropRecipient) = {NUM_COLS, {PR_ADDRTYPE, PR_RECIPIENT_TYPE, PR_ENTRYID}};
// get recipient table and query all rows for email addresses (selector is in PropRecipientNum)
if(FAILED(hr=pMessage->GetRecipientTable(0, &pRecipientsTable))) goto err;
if(FAILED(hr=HrQueryAllRows(pRecipientsTable, (SPropTagArray*)&PropRecipient, NULL, NULL, 0L, &pRecipientRows))) goto err;
for(ul=0; ul<pRecipientRows->cRows; ul++) // enumerate all recipients
{
if(PT_LONG ==PROP_TYPE(pRecipientRows->aRow[ul].lpProps[ePR_RECIPIENT_TYPE].ulPropTag))
MailUser.m_Type =(enum MAIL_ENUMS::eADDRTYPES)pRecipientRows->aRow[ul].lpProps[ePR_RECIPIENT_TYPE].Value.l;
if(PT_STRING8==PROP_TYPE(pRecipientRows->aRow[ul].lpProps[ePR_ADDRTYPE].ulPropTag))
MailUser.m_Proto=(enum MAIL_ENUMS::ePROTOCOLS)GetProtocolNum(pRecipientRows->aRow[ul].lpProps[ePR_ADDRTYPE].Value.lpszA);
if(PT_BINARY ==PROP_TYPE(pRecipientRows->aRow[ul].lpProps[ePR_ENTRYID].ulPropTag))
{
if(FAILED(hr=MAPI_GetStandardEmail(pEECB, &pRecipientRows->aRow[ul].lpProps[ePR_ENTRYID], MailUser))) goto err; // get the sender's email addy from user properties depending on SMTP, EX, ...
}
else
{
hr=SYSERRS::E_ADR_UNKNOWN;
goto err;
}
Rcpts.push_back(MailUser); // add the MailUser to list of recipients
if(MailUser.m_sAddr.empty()) g_LogFile.fprintf(SEVERITY::S_INFORMATION, "MAPI_GetRecipients(): Incomplete Recipient: '%s': \"%s\" (%s).", s_SZADDRTYPES[MailUser.m_Type], MailUser.m_sOlAddr.c_str(), s_SZPROTO[MailUser.m_Proto]);
else g_LogFile.fprintf(SEVERITY::S_INFORMATION, "MAPI_GetRecipients(): Complete Recipient: '%s': \"%s\" (%s).", s_SZADDRTYPES[MailUser.m_Type], MailUser.m_sAddr.c_str(), s_SZPROTO[MailUser.m_Proto]);
} // for(unsigned long ul=0; ul<pRecipientRows->cRows; ul++)
err:
if(pMailUser) pMailUser->Release(); // free mail user
// free rows and table
if(pRecipientRows) FreeProws(pRecipientRows);
if(pRecipientsTable) pRecipientsTable->Release();
return hr;
} // HRESULT MAPI_GetRecipients(LPEXCHEXTCALLBACK pEECB, CRecipients& Rcpts)
Thank you for giving the code.when i applied there are some errors like
(1)'Outlook' : is not a class or namespace name
(2)'CAttachment' : undeclared identifier.
Actually what is this "Outlook" means.How can i solve this problems??
Thanks and regards,
Alex
regards,
Alex
On 19 Mar 2006 21:35:50 -0800, "Alex" <alex...@gmail.com> wrote :
>Thank you for giving the code.when i applied there are some errors like
>(1)'Outlook' : is not a class or namespace name
It's a namespace. You should include/import
#import ".\OL2000_Typelib\mso9.dll" named_guids, rename("DocumentProperties", "DocProps"), rename("RGB", "OL_RGB")
#import ".\OL2000_Typelib\msoutl9.olb" exclude("_IRecipientControl", "_DRecipientControl")
#import ".\OL2000_Typelib\rule.dll"
- these are the files that come with OL2000. Please read the MSDN-L docu
about writing a minimal Exchange Client Extension.
>(2)'CAttachment' : undeclared identifier.
CAttachment is a class name and it's def'd in the codesample I sent. I
dunno why the compiler doesn't find it. Maybe you need a predeclaration.
As said, don't expect the code to compile flawlessly. It's a compilation
of useful snippets for your own modification.
>Actually what is this "Outlook" means.How can i solve this problems??
Read the MSDN-L docu regarding Exchange Client Extensions, subscribe to
MAPI-L and read its archive.
HTH,
V.
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
"Alex" <alex...@gmail.com> wrote in message
news:1142838113.4...@u72g2000cwu.googlegroups.com...
I meant to place the embedded images in actual position of the message
body.
regards,
Alex
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
"Alex" <alex...@gmail.com> wrote in message
news:1142914775.0...@t31g2000cwb.googlegroups.com...