Solved

Microsoft outlook programming issue

Posted on 2014-02-20
8
530 Views
Last Modified: 2014-08-05
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.

                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

Open in new window


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
Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} 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 detectEncodingFromByteOrderMarks, Int32 bufferSize)
   at System.IO.StreamReader..ctor(String path, Boolean detectEncodingFromByteOrderMarks)
   at MAPISESSION.frmTest.Button1_Click(Object sender, EventArgs e) in E:\Visual Studio 2008 Projects\5. TWBS Components\TWBS Mail\MAPISESSION\MAPISESSION\frmTest.vb:line 20
Please help me on this.

Thanks in Advance.
0
Comment
Question by:gopalv
  • 4
  • 3
8 Comments
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 39873216
do you need to use Outlook? or do you just want to send a email from your application?

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)
0
 

Author Comment

by:gopalv
ID: 39873345
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
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 39873381
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.
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 

Author Comment

by:gopalv
ID: 39874019
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
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 39874301
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.
0
 
LVL 15

Accepted Solution

by:
JimFive earned 500 total points
ID: 39875050
What does the result of debug.print OutlookApp.Version look like?
0
 

Author Comment

by:gopalv
ID: 39875981
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-000000000046} failed due to the following error

Thanks
0
 

Author Comment

by:gopalv
ID: 39875984
Eric

Thanks for your advice. Let me check your code once more. Hopefully, I will get my answer from this.

Thanks
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Are you unable to connect or configure Hotmail email account in Microsoft Outlook 2010, 2007? Or Outlook.com emails are not downloading to Outlook? Lets’ see the problem and resolve Outlook Connector error syncing folder hierarchy (0x8004102A).
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question