Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsWindows Server 2003Windows 2000Windows NTSmall Business ServerVirtual ServerExchange ServerIISHost Integration ServerISA ServerSMSWSUSMOMWindows Media ServerSecurityCertification
Related Topics
SQL ServerMS WindowsMS OfficePC HardwareMore Topics ...

Windows Server Forum / Exchange Server / Applications / March 2006

Tip: Looking for answers? Try searching our database.

Accessing Exchange mailbox from WinForm

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jay Williams - 20 Mar 2006 23:19 GMT
Can someone give me some C# sample code for retrieving mail from an Exchange
folder (such as "Inbox" or "Sent Items") using Windows Authentication from a
WinForm app? Or, just point me to a website that has a sample.

How does Outlook do all of its stuff? I suspect this is how I would want to
do it.

Thanks,
Jay
Henning Krause [MVP] - 20 Mar 2006 23:53 GMT
Hello,

Outlook uses MAPI.. and from C# you don't want to use this :-) Actually,
it's not even supported.

One method you can use is WebDAV. You can find some examples here:
http://msdn.microsoft.com/library/en-us/e2k3/e2k3/_esdk_key_tasks.asp and
the reference here:
http://msdn.microsoft.com/library/en-us/e2k3/e2k3/_webdav_web_store_http_webdav_
protocol_reference.asp


All communications are done with the HttpRequest Class, which supports
Windows Authentication.

Greetings,
Henning Krause

> Can someone give me some C# sample code for retrieving mail from an
> Exchange
[quoted text clipped - 8 lines]
> Thanks,
> Jay
Jay Williams - 21 Mar 2006 00:33 GMT
Thanks for your response.

I have a few questions, however:

1) Why does Outlook use MAPI and why shouldn't I?
2) I see, in the sample code you directed me to that they'r doing the
following (with WebDAV):

MyCredentialCache.Add(new System.Uri(strRootURI), "NTLM",
new System.Net.NetworkCredential(strUserName, strPassword, strDomain));

Is there a way I can simply pass along the Credentials via the Windows
Principal or Windows Identity so that I don't have to type in a username and
password? If not, what's the point of Windows Authentication?

I want anyone on our network to be able to fire up this app and see their
own Inbox (for example) without having to type anything in. After all,
they're already Authenticated by Windows. Why should I have to have them type
anything else it?

Thanks a ton!
Jay

> Hello,
>
[quoted text clipped - 24 lines]
> > Thanks,
> > Jay
Dan Mitchell - 21 Mar 2006 01:55 GMT
=?Utf-8?B?SmF5IFdpbGxpYW1z?= <JayWilliams@discussions.microsoft.com>
wrote in news:A36675FA-E7BA-46F6-832F-5984FEB731F9@microsoft.com:
> 1) Why does Outlook use MAPI and why shouldn't I?

Because Outlook isn't a .Net application.

And why shouldn't you use MAPI? To quote from one of the MS support folks
on one of these newsgroups a while ago:

"It's the sort of thing that'll mostly work. It'll work while you're
writing it. Then it'll work while you're testing it. It'll work while your
customer is evaluating it. Then as soon as the customer deploys it - BAM!
That's when it'll decide to start having problems. And Microsoft ain't
gonna help you with it, since we told you not to do it in the first place.
:)"

See
http://groups.google.com/group/microsoft.public.win32.programmer.messaging
/msg/20149ae3de2f4920?hl=en& for that posting, and

http://support.microsoft.com/kb/813349 for more.

I don't know much about the WebDAV end of things, sorry.

-- dan
Henning Krause [MVP] - 21 Mar 2006 11:55 GMT
Hello Jay,

Dan already answered the first question.

As with your second question:

You can simply use request.Crededentials =
CredentialCache.DefaultCredentials.

this will use integrated authentication.

Greetings,
Henning Krause

> Thanks for your response.
>
[quoted text clipped - 51 lines]
>> > Thanks,
>> > Jay
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.