Experiences on CRM, .Net and DHTML

CrmXpress

  • Join Us on Facebook!
  • Follow Us on Twitter!
  • LinkedIn
  • Subcribe to Our RSS Feed

Nice Day... Food Festival at ETI and more...

Today was a nice day. I completed the WebDAV Post today. moreover, I am ready with
an Encryption Library in C#. I'll post it soon. I also managed to force File Save Dialog Box
on client side using C# & ASP.Net so WebDevz can push the user to download particular file
instead of opening it.

At ETI(
Effective Teleservices Inc), today was Food Festival, and I enjoyed a lot... a lot of fun...
relly... soon I'll post images or video may be... keep Visiting...


Btw, today when I reached home, I received my new Timex Watch... its the one of the best watch I've ever seen. with this I'll close for today...

Accessing MS Exchange Server using WebDAV

Topic : Accessing MS Exchange Server using WebDAV

Tools : C#, MSXML, ASP.Net... and lil bit of grey matter! ;)

Scenario :
As a Developer, we, have to face many scenarios... sometimes it is easy to get things goin...
while sometimes... you fell why did you raise your hand to solve that particular thing.

Same thing happenned to me, few days back, I was trying to access MS Exchange 2000 to
get mails from a given mailbox, and extract mails from it. I already did it using a Pop3 Class
I got from CodeProject.com. but than the question was accessing RAW mail ie .eml or .msg
so I had to forget 2-3 days I spent to get Pop3 working with the Current System. After
looking for some help here and there, I came to know about WebDAV - Web(-based)
Distributed Authoring & Versioning. After doin R&D I felt that this is the thing that I was
looking for... so I started DEVENV and loaded my R&D Project(I call it.. WebCentrino... he he)

Here are the steps that will get you a mail in RAW format from MS Exchange Server.

1. Creat a New Web Application (you can go for WinApp also)

2. Add reference to MS XML 4.0 or greater, it will appear as MSXML2 in References

3. Now, add this System.IO, System.Xml and System.MSXML2

4. Add following code to the Page_Load event. This dumps XML Listing of your mail box. You'll have to write a Custom Handler to process the Output and display to User.

WebRequest.open("PROPFIND", "http://mail.urmailserver.com/exchange/username/inbox", false, "domain\\username", "password");//Connect to the Mail Server

WebRequest.setRequestHeader("Depth", "1");//Set Access Depth

WebRequest.setRequestHeader("Content-type", "xml");//Set Content Type of the Request

WebRequest.send(null);//Send the Request

Response.Write(WebRequest.responseText);//Dump Response from the Server

Response.End();

This will get you mailbox content with all the attirbutes you'll ever need to access your mailbox.
if you need more on this look into MSDN and MS Exchange Online Docs.

Comments/Suggestions on this article are most welcome.