Last post Jan 29, 2015 03:48 AM by AidyF
Jan 27, 2015 09:44 PM|slen|LINK
I would like to Accessing Outlook emails from C#
How do I do it? What are the setting I need to give permission with?
I got this error message, 80010001 Call was rejected by callee
I just want to access the email that is stored in Outlook.
Jan 28, 2015 02:47 AM|Mikesdotnetting|LINK
If you want to access emails from a web application and they are stored in Exchange Server, you should use Exchange Web Services. Otherwise you will need to look at POP3 or IMAP libraries. There is no point in trying to communicate with Outlook as that resides
on the client machine and you have no access to that from a web application.
Jan 28, 2015 05:59 AM|slen|LINK
Actually I am not familiar with EWS. I don't think client server uses Exchange Server.
Actually it does work in IIS express. Just in the traditional IIS it doesn't work.
Actually it is not in the client machine. if you meant client machine is from the user who accessing the server web application. Actually what I wanted is to access local host outlook. Yes. the outlook installed in the server which host the web application
and run by the server IIS.
Jan 28, 2015 06:05 AM|AidyF|LINK
What exactly are you doing with this email? If you explain what it is you're trying to achieve we might be able to suggest an alternative as interacting with Outlook from .net is not supported. Normally when people want to do this it is because they don't
understand that Outlook is just a mail client that interacts with a mail server, but your asp.net code can interact with those servers directly without the need of going via a desktop app.
Jan 28, 2015 08:00 PM|slen|LINK
I just need to retrieve emails from Outlook. And, I will need to read the retrieve email content (including subject, email from and to) and save it to mysql database.
Here is what the VB6 does.
Dim ol As Outlook.Application = CreateObject("Outlook.Application", "localhost");
From above it just reading the localhost outlook. How can I do it from the C#.NET?
Below is my current code
Microsoft.Office.Interop.Outlook.Application myApp = new Microsoft.Office.Interop.Outlook.Application();
Microsoft.Office.Interop.Outlook.NameSpace mapiNameSpace = myApp.GetNamespace("MAPI");
Microsoft.Office.Interop.Outlook.MAPIFolder myInbox = mapiNameSpace.GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderInbox);
Actually, I am interested in retrieving email from the localhost outlook, not from the user pc which accessing the server web application.
It seems like my IIS privileges is not the same as outlook. If so, how to set those permission? I have tried dcom setting, but still doesn’t work.
And, I don’t understand about Exchange Server very much. Does this need to be purchased separately from the window server? Is there any alternative instead?
Jan 29, 2015 03:48 AM|AidyF|LINK
Outlook is a desktop application though....who is using Outlook on the web server such that it has anything in its InBox in the first place? If you want to read emails from an inbox then use a pop3 component. If you google for "asp.net pop3" you'll find
some pre-built components you can use. You can't really automate Outlook in the way you are intending, the automation of Office apps isn't supported in asp.net. You could maybe look into using the MAPI API as an alternative to using Outlook but you're going
to run into a whole load of security and configuration issues.
Ultimately what you are trying to do just isn't supported in asp.net and you should look for al alternative solution.