المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Outlook Attachments differs from original files



C# Programming
06-10-2009, 10:30 AM
Hi there,

I wrote an add-in for outlook 2003 and am saving files from Outlook in a way that is provided in many examples:

Microsoft.Office.Interop.Outlook.Selection SelectedEmails = this.Application.ActiveExplorer().Selection;
Microsoft.Office.Interop.Outlook.MailItem EMail = null;
if (SelectedEmails.Count == 0)
{
MessageBox.Show("Please select e-mail for submission", "3Hats Add-In", MessageBoxButtons.OK);
return;
}
else if (SelectedEmails.Count > 1)
{
MessageBox.Show("Please select only one e-mail for submission", "3Hats Add-In", MessageBoxButtons.OK);
return;
}

try
{
// Apparently Office is VB oriented, so all indicies start from 1, not 0
EMail = (Microsoft.Office.Interop.Outlook.MailItem)SelectedEmails[1];
// Save attachments into temporary folder (Docs & Settings\Temp)
foreach (Microsoft.Office.Interop.Outlook.Attachment Attachment in EMail.Attachments)
{
Attachment.SaveAsFile(System.IO.Path.GetTempPath() + "\\" + Attachment.FileName);

}

After saving, I figure out that file size is different by at least 0x1200 bytes if sent from within the Outlook 2003 to an e-mail. After examining it, it appears that a few bytes in header of the file are changed, and a huge chunk is attached to the end of the file. Can anyone tell me how I can retrieve original file from within Outlook 2003?

Thank you.

"Do not try. Do"