G
Guest
Hi,
I am trying to develop an outlook 2002 add-in using VC++ ATL. I have added a
button in the New Mail Message inspector window and I am trying to add the
following functionality:
Every time the user clicks the button, modify the attachment that he has
inserted in the mail message (assuming he has already done so). My code so
far:
CComQIPtr<Outlook::_MailItem>spMailItem;
CComQIPtr<Outlook::Attachments> spAttachments;
CComQIPtr<Outlook::Attachment> spAttachment;
BSTR bstrPathName;
ATLASSERT(spMailItem);
VARIANT index;
index.iVal = 1; // value
index.vt = VT_I2; // type of variant = integer
spMailItem->get_Attachments(&spAttachments);
ATLASSERT(spAttachments);
long count;
spAttachments->get_Count(&count);
if (count > 0) {
spAttachments->Item(index, &spAttachment);
ATLASSERT(spAttachment);
spAttachment->get_PathName(&bstrPathName);
}
My problem is that displaying "bstrPathName" gives me an empty string. I
have tried get_DisplayName() and was able to display the filename correctly.
Am I right in guessing that Outlook does not keep the full path once the
file has been inserted?
If this is the case, how should I go about modifying the file contents?
Thanks in advance,
Mark
I am trying to develop an outlook 2002 add-in using VC++ ATL. I have added a
button in the New Mail Message inspector window and I am trying to add the
following functionality:
Every time the user clicks the button, modify the attachment that he has
inserted in the mail message (assuming he has already done so). My code so
far:
CComQIPtr<Outlook::_MailItem>spMailItem;
CComQIPtr<Outlook::Attachments> spAttachments;
CComQIPtr<Outlook::Attachment> spAttachment;
BSTR bstrPathName;
ATLASSERT(spMailItem);
VARIANT index;
index.iVal = 1; // value
index.vt = VT_I2; // type of variant = integer
spMailItem->get_Attachments(&spAttachments);
ATLASSERT(spAttachments);
long count;
spAttachments->get_Count(&count);
if (count > 0) {
spAttachments->Item(index, &spAttachment);
ATLASSERT(spAttachment);
spAttachment->get_PathName(&bstrPathName);
}
My problem is that displaying "bstrPathName" gives me an empty string. I
have tried get_DisplayName() and was able to display the filename correctly.
Am I right in guessing that Outlook does not keep the full path once the
file has been inserted?
If this is the case, how should I go about modifying the file contents?
Thanks in advance,
Mark