XMLHTTP with Forms Based Authentication
Exchange Server Forum Index Exchange Server
Discussion forums for Microsoft Exchange Server users.
Microsoft Outlook
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web ExchangeServerHelp.com
XMLHTTP with Forms Based Authentication

 
Post new topic   Reply to topic    Exchange Server Forum Index -> Development
Author Message
wannaknowmore
Guest





Posted: Tue Dec 06, 2005 1:58 am    Post subject: XMLHTTP with Forms Based Authentication Reply with quote

I need to get a list of emails form my inbox that are not read (new
emails).
I am using XMLHTTP and have Forms based Authentication on the exchange
server.

I can get an individual message as well as attachment of a message
using PROPFIND and X-MS-ENUMATTS using HttpWebRequest and cookie
authentication without a problem.

Quote:
From research (KN article 290899 and
http://www.infinitec.de/exchange/howtos/webdavwithfba.aspx) I

understand that I need to set the cookie header twice but even that
does not work for me; I get 440 Login Timeout.

Code snippet:
strReusableCookies = AuthenticateSecureOWA();
xmlHttp_.open("SEARCH", strSrcURI, false, domain + "\\" + username,
password) ;

xmlHttp_.setRequestHeader ("Cookie", strReusableCookies) ;
xmlHttp_.setRequestHeader ("Cookie", strReusableCookies) ;
xmlHttp_.setRequestHeader("Depth", "1") ;
xmlHttp_.setRequestHeader("Content-type", "text/xml") ;
StringBuilder strXML = new StringBuilder() ;
strXML.Append("<?xml version='1.0' ?>") ;
strXML.Append("<a:searchrequest xmlns:a='DAV:'><a:sql>") ;
strXML.Append("SELECT") ;
strXML.Append(" \"DAV:creationdate\"") ;
strXML.Append(",\"urn:schemas:httpmail:subject\"") ;
strXML.Append(",\"http://schemas.microsoft.com/exchange/permanenturl\"")
;
strXML.Append(",\"urn:schemas:httpmail:hasattachment\"") ;
strXML.Append(",\"urn:schemas:httpmail:read\"") ;
strXML.Append(" FROM scope('shallow traversal of \"" + strSrcURI +
"\"')") ;
strXML.Append(" WHERE \"DAV:ishidden\"=False") ;
strXML.Append(" AND \"DAV:isfolder\"=False") ;
if(!(null == readStatus) && !("".Equals(readStatus)) &&
"true".Equals(readStatus))
strXML.Append(" AND \"urn:schemas:httpmail:read\"=True") ;
else if ("false".Equals(readStatus))
strXML.Append(" AND \"urn:schemas:httpmail:read\"=False") ;
strXML.Append(" ORDER BY \"DAV:creationdate\"") ;
strXML.Append("</a:sql></a:searchrequest>") ;

xmlHttp_.send(strXML.ToString()) ;
string str = xmlHttp_.responseText ;
//Load the read mails into XML document'''
System.Xml.XmlDataDocument xmlDOMParams = new XmlDataDocument() ;
xmlDOMParams.LoadXml(str) ;

The method AuthenticateSecureOWA() returns the cookie string which is
successfully used in other methods to get individual messages.

Any suggestions?

Back to top
 
Post new topic   Reply to topic    Exchange Server Forum Index -> Development All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




Windows Server Dedicated Servers
New Topics Powered by phpBB