Click here to Skip to main content
15,896,539 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
We have added the following lines of coding in our MVC project for open outlook with an attached file.

C#
Outlook.AppointmentItem tempApp =  (Outlook.AppointmentItem)olook.CreateItem(Outlook.OlItemType.olAppointmentItem);
Outlook.Application objApp = new Outlook.Application();
Outlook.MailItem mail = null;
mail = (Outlook.MailItem)objApp.CreateItem(Outlook.OlItemType.olMailItem);
mail.Attachments.Add((object)@"" + FilePath + "", Outlook.OlAttachmentType.olEmbeddeditem, 1, (object)"Attachment");
mail.Display();


it works perfectly by locally,But when it moves to Live server it says the following error

Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).


Please help.
Thanks & Regards,
soumya
Posted
Updated 11-Mar-15 1:55am
v3

1 solution

That simply means that Outlook is not installed on your live server, which is not a bad thing per se.

There's a package that can be deployed to servers allowing applications to access core MAPI objects.

Search for "MAPI CDO" on your favorite search engine, and find the suitable version for your Windows/Exchange.

Good luck.
 
Share this answer
 
Comments
soumyaraj 11-Mar-15 10:00am    
we have installed Microsoft Exchange Server MAPI Client and Collaboration Data Objects from below link
http://www.microsoft.com/en-in/download/details.aspx?id=1004
That didn't help me.Still it shows the same error.
phil.o 11-Mar-15 10:14am    
The way you are thinking your process is biased, IMHO. The code you showed is more appropriate for a client machine on which Oulook is installed.
On a server, though, installing an application like Outlook is not recommended. If your goal is only to send emails, then you should use object in System.Net.Mail namespace: it will then rely on core .NET Framework objects rather than on a client application dirtyly installed on a web server.
MSDN: System.Net.Mail.SmtpClient[^]
soumyaraj 18-Mar-15 4:34am    
Hi philo,
My requirement is, I just want to open outlook window with an attached file.for that I used the code 'mailto' in href tag.it could help to open an outlook window but files are not attached

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900