Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Saving an Outlook email

Status
Not open for further replies.

RyanEK

Programmer
Apr 30, 2001
323
AU
Hi All,

I can save an outlook email via a drag and drop onto a listview. The code looks something like this:

Code:
Microsoft.Office.Interop.Outlook.Application OL = new Microsoft.Office.Interop.Outlook.Application();

for (int i = 1; i <= OL.ActiveExplorer().Selection.Count; i++)
{
   Object selObject = OL.ActiveExplorer().Selection[i];
   if (selObject is Microsoft.Office.Interop.Outlook.MailItem)
   {
       Microsoft.Office.Interop.Outlook.MailItem mi = (selObject as Microsoft.Office.Interop.Outlook.MailItem);
       sSub = mi.Subject.Replace(":", "");
       mi.SaveAs(sAttDir + "\\" + sSub + ".msg", Microsoft.Office.Interop.Outlook.OlSaveAsType.olMSG);
   }
}

When this code is run, Outlook will correctly display a dialog asking for permission to allow access.

This all works great on my development machine but I can't get it to work when I deploy my app onto another PC. Does anyone know what i'm missing?

I deploy Microsoft.Office.Interop.Outlook.dll and office.dll

Any help would be appreciated.
Thanks
Ry

 
The interop libraries for office have a lot of version issues (from my experience anyway, mostly with Excel). Are you sure the PC's both have the same (exact) version of outlook?

Hope this helps,

Alex

[small]----signature below----[/small]
I'm pushing an elephant up the stairs

My Crummy Web Page
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top