gopalv
asked on
Microsoft outlook programming issue
Hello
I am doing some programming with Microsoft Office 2013 - Outlook to send a mail using Visual Studio 2010. Here is the code which I use to initialize Outlook Object.
Here the code is built with 32bit platform and works fine with Office 2013 - 32bit setup.
But when I try to use the same code with Office 2013 - 64bit, I am unable to initialize the outlook Application. Thought the first line (OutlookApp = New Outlook.Application ) is executing well, I am getting a COM exception from the second line while accessing the Version [pVersion = CShort(OutlookApp.Version. Substring( 0, OutlookApp.Version.IndexOf ("."))).]
This is the full error message
Thanks in Advance.
I am doing some programming with Microsoft Office 2013 - Outlook to send a mail using Visual Studio 2010. Here is the code which I use to initialize Outlook Object.
If OutlookApp Is Nothing Then
OutlookApp = New Outlook.Application
pVersion = CShort(OutlookApp.Version.Substring(0, OutlookApp.Version.IndexOf(".")))
oNameSpace = OutlookApp.GetNamespace("MAPI")
oNameSpace.Logon("", "", False, False)
oMailItem = CType(OutlookApp.CreateItem(Outlook.OlItemType.olMailItem), Outlook.MailItem)
End If
Here the code is built with 32bit platform and works fine with Office 2013 - 32bit setup.
But when I try to use the same code with Office 2013 - 64bit, I am unable to initialize the outlook Application. Thought the first line (OutlookApp = New Outlook.Application ) is executing well, I am getting a COM exception from the second line while accessing the Version [pVersion = CShort(OutlookApp.Version.
This is the full error message
Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-0Please help me on this.0000000004 6} failed due to the following error: 80004023.
System.ArgumentException: Empty path name is not legal.
at System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrde rMarks, Int32 bufferSize)
at System.IO.StreamReader..ctor(String path, Boolean detectEncodingFromByteOrde rMarks)
at MAPISESSION.frmTest.Button1_Click(Ob ject sender, EventArgs e) in E:\Visual Studio 2008 Projects\5. TWBS Components\TWBS Mail\MAPISESSION\MAPISESSI ON\frmTest .vb:line 20
Thanks in Advance.
ASKER
Hi Eric
Yes, I need Outlook in this case. In my program, I am supporting two types of emails. 1. SMTP and 2. Outlook. So this is the 2nd case.
Thanks
Yes, I need Outlook in this case. In my program, I am supporting two types of emails. 1. SMTP and 2. Outlook. So this is the 2nd case.
Thanks
Have a closer look to the last link in my blog: http://www.codeproject.com/Articles/17561/Programmatically-adding-attachments-to-emails-in-C
it has C# and VB code to open the new message dialog.
it has C# and VB code to open the new message dialog.
ASKER
Hi
I had gone through this, but didn't find anything related to a 64bit version.
Can you / any one please post a code sample to demonstrate how to work with 64bit?
Or is that an issue with any settings?
Thnx
I had gone through this, but didn't find anything related to a 64bit version.
Can you / any one please post a code sample to demonstrate how to work with 64bit?
Or is that an issue with any settings?
Thnx
Instead of trying to find the way to get your method working on 64-bits, try the other mechanism. I have used it on 32 and 64 bits.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi Jim
The Debug.Print also giving the same issue. What I am seeing when looking for OutlookApp object properties, all these properties are showing the same message. Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-0 0000000004 6} failed due to the following error
Thanks
The Debug.Print also giving the same issue. What I am seeing when looking for OutlookApp object properties, all these properties are showing the same message. Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-0
Thanks
ASKER
Eric
Thanks for your advice. Let me check your code once more. Hopefully, I will get my answer from this.
Thanks
Thanks for your advice. Let me check your code once more. Hopefully, I will get my answer from this.
Thanks
I have written many blogs on different ways of sending emails through the years like using the System.Net.Mail namespace. Check the http://emoreau.com/Entries/Articles/2010/07/Sending-e-mails-with-attachments-a-different-method.aspx (which include links to previous ones)