Link to home
Start Free TrialLog in
Avatar of fairy birds
fairy birds

asked on

issue in using outlook in c# windows form

i make a desktop application..and i faced problem in receiving an email on a form.i face this error when load the email:
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............it's urgent
ASKER CERTIFIED SOLUTION
Avatar of AndyAinscow
AndyAinscow
Flag of Switzerland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of fairy birds
fairy birds

ASKER

but i have installed outlook sir
i can send email successfully ,but i cant load email....i have installed outlook,,,,,,and outlook is 64bit, pc was also 64bit and the project was x86..........  ialso try to set project configuration "any cpu" but stil i can receive this error
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)).
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
i also tried  with x64........but its not working...........so now what can i do?
Does that mean that you are getting the identical error or some other error? If the same error I do not know what to have you do next seeming that the Outlook does not seem to be loaded. That could mean all three variables are not the same PC, Outlook and application, for example all x64 or all x86. Please check again.
sir i upload all info with pic that pc , offic and project congfi was 64 and also the error...........please sir help how we recover this
Can you post the equivalent of 2.PNG but from the microsoft outlook you have installed on the PC giving the problem.
Ignore the 'test' comment - the submit comment button hadn't been working despite numerous refreshes and restarts of my browser.
sir the provided instruction is for code 80080005 but my code error is "error: 80040154", is it same?
sir i follow the steps and after that we restat pc and run project....but its not working, again i get this error
so now, whats the next step sir
err.png
is this error because of the activation of ms office?
The error is typically that the correct (32 or 64 bit) version of outlook is not installed.  The solution is to install the required version of outlook - which you have done.

>>is this error because of the activation of ms office?

Have you had a problem with that?  (You seem to be able to start and run outlook so that shouldn't be an issue).
hello............. the error is solved now..but i can't get the data from the outlook.........means the process has been completed sucessfully but does not show me the data...........
code is:
 try
            {              
                 Outlook._Application app = new Outlook.Application();
                 //Outlook.NameSpace ns = new Outlook.NameSpace();
                 Outlook.NameSpace ns = app.GetNamespace("MAPI");
                 Outlook.MAPIFolder inbox = ns.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox);
                 ns.SendAndReceive(true);
                 dt = new DataTable("Inbox");
                 dt.Columns.Add("Subject", typeof(String));
                 dt.Columns.Add("Sender", typeof(String));
                 dt.Columns.Add("Body", typeof(String));
                 dt.Columns.Add("Date", typeof(String));
                 dataGridView1.DataSource = dt;
                 foreach (Outlook.MailItem item in inbox.Items)
                 {
                     dt.Rows.Add(new Object[] { item.Subject, item.Sender, item.HTMLBody, item.SentOn.ToLongDateString() + "" + item.SentOn.ToLongTimeString() });
                 }
             }
             catch (Exception ex)
             {
                 MessageBox.Show(ex.Message, "message", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
Not clear what solved it but the author does state it was solved.  IMHO the most likely causes have been selected as the answer comments.