i have converted a outlook 2010 addin project into outlook 365(for desktop), after that when it reach below line
Private Sub ThisAddIn_Startup() Handles Me.Startup Try
Dim Application As Microsoft.Office.Interop.Outlook.Application = New Microsoft.Office.Interop.Outlook.Application 'EXCEPTION LINE
then immediately throws exception as like below
{"Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 8000ffff Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))."}
I read the topic Why am I receiving exception from Office's Outlook library? but, in my case its not resolved the issue.
experts please advise me.
You are already inside outlook (ThisAddin class), so you do not need to create a new instance of the application. What you need is to get a pointer to the existing one.
I do not code in VB.Net but the C# equivalent would be:
this.Application;
I am assuming you want to mimic what is present in the code you are pointing to and want to send an email then I would write it like this:
public void Email_Send()
{
O.MailItem message = this.Application.CreateItem(O.OlItemType.olMailItem);
message.To = Receiver;
message.CC = Sender;
message.Subject = Subject;
message.Body = "This is an automated message sent at " + DateTime.Now.ToString("HH:mm:ss") + " about " + Body_Topic + System.Environment.NewLine + Body_Content ;
message.Send();
}
User contributions licensed under CC BY-SA 3.0