Read Email from OutLook
-
Hi, How can i read my Mails from another computer. Below code reads mails from the current system Inbox. In Outlook.NameSpace.Logon Profile property what value i need to pass to read other Inbox? Outlook.Application myOlApp = new Outlook.Application(); Outlook.NameSpace ns = myOlApp.GetNamespace("Mapi"); ns.Logon("","",false,true); Outlook.MAPIFolder inbox = ns.GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderInbox ); foreach (Microsoft.Office.Interop.Outlook.MailItem submail in inbox.Items) { Microsoft.Office.Interop.Outlook.Attachments ii = submail.Attachments; for (int j = 1; j <= ii.Count; j++) { Microsoft.Office.Interop.Outlook.Attachment aa = (Microsoft.Office.Interop.Outlook.Attachment)ii[j]; Console.WriteLine(aa.FileName); string mypath = @"D:\FileUpload\" + aa.FileName; aa.SaveAsFile(mypath); } } Thanks in Advance
-
Hi, How can i read my Mails from another computer. Below code reads mails from the current system Inbox. In Outlook.NameSpace.Logon Profile property what value i need to pass to read other Inbox? Outlook.Application myOlApp = new Outlook.Application(); Outlook.NameSpace ns = myOlApp.GetNamespace("Mapi"); ns.Logon("","",false,true); Outlook.MAPIFolder inbox = ns.GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderInbox ); foreach (Microsoft.Office.Interop.Outlook.MailItem submail in inbox.Items) { Microsoft.Office.Interop.Outlook.Attachments ii = submail.Attachments; for (int j = 1; j <= ii.Count; j++) { Microsoft.Office.Interop.Outlook.Attachment aa = (Microsoft.Office.Interop.Outlook.Attachment)ii[j]; Console.WriteLine(aa.FileName); string mypath = @"D:\FileUpload\" + aa.FileName; aa.SaveAsFile(mypath); } } Thanks in Advance
You have no idea about ASP.NET. Sorry. Imagine if outlook DID expose it's contents to any website. What a grand world it would be.
Christian Graus Driven to the arms of OSX by Vista. "I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
-
You have no idea about ASP.NET. Sorry. Imagine if outlook DID expose it's contents to any website. What a grand world it would be.
Christian Graus Driven to the arms of OSX by Vista. "I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
Coming from some one with a tag line; "Driven to the arms of OSX by Vista." followed directly by "I am new to programming world", I can see how you completely mis-understood the question. :confused: If you looked at his code, you would see he is authenicating with the target first. Second he is trying to access an second inbox other than the default, not 'your' outlook client inbox. :sigh: Nice way to try to characterize the question as a flaw with MS products somehow. Please leave your religious beliefs at the door in the ASP.net forum. To my knowledge, ASP.net is still wholly owned by MS. :suss: You obviously posted just to make a snide remark.
-
Coming from some one with a tag line; "Driven to the arms of OSX by Vista." followed directly by "I am new to programming world", I can see how you completely mis-understood the question. :confused: If you looked at his code, you would see he is authenicating with the target first. Second he is trying to access an second inbox other than the default, not 'your' outlook client inbox. :sigh: Nice way to try to characterize the question as a flaw with MS products somehow. Please leave your religious beliefs at the door in the ASP.net forum. To my knowledge, ASP.net is still wholly owned by MS. :suss: You obviously posted just to make a snide remark.
Brian W King wrote:
I can see how you completely mis-understood the question.
ROTFL - I guess you misunderstood that the second part of my sig, is a quote from someone. I guess that's a trap for young players.
Brian W King wrote:
If you looked at his code, you would see he is authenicating with the target first. Second he is trying to access an second inbox other than the default, not 'your' outlook client inbox
So, he's not trying to connect to a different machine at all ? His question has NOTHING conceivably to do with ASP.NET ? Yes, I did miss that. I thought he was clueless in other ways.
Brian W King wrote:
Nice way to try to characterize the question as a flaw with MS products somehow.
Wow - congratulations. You're the stupidest person on these forums, today. And for once, it's someone with a western sounding name. I was suggesting that it would be *insane* for Outlook to receive my mail, and then broadcast my mailbox over the web. I was suggesting a flaw in the OP's thinking, not in outlook.
Brian W King wrote:
. Please leave your religious beliefs at the door in the ASP.net forum.
Thanks for making assumptions. I am writing ASP.NET code right now, all my Macs run Windows XP as well ( because Vista is still crap ).
Brian W King wrote:
To my knowledge, ASP.net is still wholly owned by MS
I believe so. It's also the best web development platform going, IMO.
Brian W King wrote:
You obviously posted just to make a snide remark.
Why don't you give the OP the answer, if you know it ? As far as I am concerned, his question was how to use the web to connect to a remote instance of Outlook, I gave him the only possible answer, which is that for Outlook to allow that, would be insane. Especially assuming that he wants to use ASP.NET to do it, I assume this is yet another clueless poster who has no idea about the separation between server and client. If I'm wrong, prove it by answer him, NOT by throwing YOUR religious beleifs at me. Some MS products suck, and Macs in general, are better. Get over it. I still use a lot of MS productions, VS 2008, buggy as it is, leaves the Mac dev environment for dead. I presume you've never a
-
Hi, How can i read my Mails from another computer. Below code reads mails from the current system Inbox. In Outlook.NameSpace.Logon Profile property what value i need to pass to read other Inbox? Outlook.Application myOlApp = new Outlook.Application(); Outlook.NameSpace ns = myOlApp.GetNamespace("Mapi"); ns.Logon("","",false,true); Outlook.MAPIFolder inbox = ns.GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderInbox ); foreach (Microsoft.Office.Interop.Outlook.MailItem submail in inbox.Items) { Microsoft.Office.Interop.Outlook.Attachments ii = submail.Attachments; for (int j = 1; j <= ii.Count; j++) { Microsoft.Office.Interop.Outlook.Attachment aa = (Microsoft.Office.Interop.Outlook.Attachment)ii[j]; Console.WriteLine(aa.FileName); string mypath = @"D:\FileUpload\" + aa.FileName; aa.SaveAsFile(mypath); } } Thanks in Advance
I hope you are trying this from windows app not Web app. If it is the later, then you need to understand the basics of asp.net If it is windows app, then, my friend, you are in the wrong aisle. In any case,
Usharva wrote:
In Outlook.NameSpace.Logon Profile property what value i need to pass to read other Inbox?
Usharva wrote:
Outlook.NameSpace ns = myOlApp.GetNamespace("Mapi"); ns.Logon("","",false,true);
Check how outlook is configured and how you talk to your mail server. I am assuming it uses your windows credentials. that is why when you leave it blank, it will impersonate you. Did you try to use your windows credentials?
Yusuf May I help you?