|
|
|
date: Tue, 2 Aug 2005 09:49:01 -0700,
group: microsoft.public.exchange2000.development
back
Re: Cannot create calendar appointment via webdav
How are you actually trying to use the code eg are you writing a console
application,ASP.NET or a web service (or are you trying to write something
in VB6). You will need to change the code from that KB to be able to
authenticate via FBA. There are samples for doing this in
http://support.microsoft.com/?kbid=891748 and
http://www.infinitec.de/exchange/howtos/webdavwithfba.aspx. Another quick
sample i use in VBS to handle FBA looks like
Set req = CreateObject("Microsoft.XMLhttp")
servername = "servername"
mailbox = "mailbox"
domain = "domain"
strpassword = "password"
strusername = domain & "\" & mailbox
szXml = "destination=https://" & servername & "/exchange&flags=0&username="
& strusername
szXml = szXml & "&password=" & strpassword & "&SubmitCreds=Log
On&forcedownlevel=0&trusted=0"
req.Open "post", "https://" & servername & "/exchweb/bin/auth/owaauth.dll",
False
req.send szXml
reqhedrarry = split(req.GetAllResponseHeaders(), vbCrLf,-1,1)
for i = lbound(reqhedrarry) to ubound(reqhedrarry)
if instr(lcase(reqhedrarry(i)),"set-cookie: sessionid=") then reqsessionID
= right(reqhedrarry(i),len(reqhedrarry(i))-12)
if instr(lcase(reqhedrarry(i)),"set-cookie: cadata=") then reqcadata=
right(reqhedrarry(i),len(reqhedrarry(i))-12)
next
stmsgbody ="Hello Fred <BR<BR>"
stmsgbody = stmsgbody & "What to get some coffee Mate, Meet me downstairs in
ten<BR><BR>"
stmsgbody = stmsgbody & "Cheers<BR>"
stmsgbody = stmsgbody & "Barney<BR>"
szXml = ""
szXml = szXml & "Cmd=send" & vbLf
szXml = szXml & "MsgTo=address@youdomain.com" & vbLf
szXml = szXml & "MsgCc=" & vbLf
szXml = szXml & "MsgBcc=" & vbLf
szXml = szXml & "urn:schemas:httpmail:importance=1" & vbLf
szXml = szXml &
"http://schemas.microsoft.com/exchange/readreceiptrequested=1" & vbLf
szXml = szXml &
"http://schemas.microsoft.com/exchange/deliveryreportrequested=1" & vbLf
szXml = szXml & "http://schemas.microsoft.com/exchange/sensitivity-long=" &
vbLf
szXml = szXml & "urn:schemas:httpmail:subject=Coffee ???" & vbLf
szXml = szXml & "urn:schemas:httpmail:htmldescription=<!DOCTYPE HTML PUBLIC
" _
& """-//W3C//DTD HTML 4.0 Transitional//EN""><HTML DIR=ltr><HEAD><META
HTTP-EQUIV" _
& "=""Content-Type"" CONTENT=""text/html;
charset=utf-8""></HEAD><BODY><DIV>" _
& "<FONT face='Arial' color=#000000 size=2>" & stmsgbody & "</font>" _
& "</DIV></BODY></HTML>" & vbLf
req.Open "POST", "https://" & servername & "/exchange/" & mailbox & "/",
False, "", ""
req.setRequestHeader "Accept-Language:", "en-us"
req.setRequestHeader "Content-type:", "application/x-www-UTF8-encoded"
req.SetRequestHeader "cookie", reqsessionID
req.SetRequestHeader "cookie", reqCadata
req.setRequestHeader "Content-Length:", Len(szXml)
req.Send szXml
Wscript.echo req.responseText
Cheers
Glen
"Mike647" wrote in message
news:EF389B2A-1F44-4659-8E04-420A6A8A45B7@microsoft.com...
>I am writing an application that needs to export calendar information to an
> exchange server using webdav. I can successfully send information to the
> test
> server(no FBA) using code of the form:
>
> Dim xmlReq As New MSXML2.XMLHTTP40
> xmlReq = CreateObject("Microsoft.XMLHTTP")
> xmlReq.open("PROPPATCH", msServer & msMailbox & "/Calendar/test.eml",
> False, msUser, msPassword)
> xmlReq.setRequestHeader("Content-Type", "text/xml")
> xmlReq.send(sReqXML)
>
> Unfortunately I can't use this code since I need to be able to use Forms
> Based Authentication which requires me to handle cookies.
>
> If I use code from http://support.microsoft.com/?kbid=314191 on the same
> test server I get the following message:
>
> "A first chance exception of type 'System.Net.WebException' occurred in
> system.dll"
>
> "Addtional information: The remote server returned an error: (401)
> Unauthorized."
>
> I have kept the actual xml request identical in both cases. The only
> difference is in how the information was sent to the server.
>
> Any help would greatly be appreciated.
>
> Thank you,
> Mike
date: Thu, 4 Aug 2005 12:19:56 +1000
author: Glen Scales [MVP]
Re: Cannot create calendar appointment via webdav
I worked on the project in stages, first an unsecure non fba server then
modifying the code to work with the next level of security.
It turns out it's one of those scratch your head issues, the code was
rewritten, using all the same techniques in a new project and now it appears
to be working.
Thanks for the response Glen, if we can figure out what was actually causing
the problem I will post it here.
Mike
"Glen Scales [MVP]" wrote:
> How are you actually trying to use the code eg are you writing a console
> application,ASP.NET or a web service (or are you trying to write something
> in VB6). You will need to change the code from that KB to be able to
> authenticate via FBA. There are samples for doing this in
> http://support.microsoft.com/?kbid=891748 and
> http://www.infinitec.de/exchange/howtos/webdavwithfba.aspx. Another quick
> sample i use in VBS to handle FBA looks like
>
> Set req = CreateObject("Microsoft.XMLhttp")
> servername = "servername"
> mailbox = "mailbox"
> domain = "domain"
> strpassword = "password"
> strusername = domain & "\" & mailbox
> szXml = "destination=https://" & servername & "/exchange&flags=0&username="
> & strusername
> szXml = szXml & "&password=" & strpassword & "&SubmitCreds=Log
> On&forcedownlevel=0&trusted=0"
> req.Open "post", "https://" & servername & "/exchweb/bin/auth/owaauth.dll",
> False
> req.send szXml
> reqhedrarry = split(req.GetAllResponseHeaders(), vbCrLf,-1,1)
> for i = lbound(reqhedrarry) to ubound(reqhedrarry)
> if instr(lcase(reqhedrarry(i)),"set-cookie: sessionid=") then reqsessionID
> = right(reqhedrarry(i),len(reqhedrarry(i))-12)
> if instr(lcase(reqhedrarry(i)),"set-cookie: cadata=") then reqcadata=
> right(reqhedrarry(i),len(reqhedrarry(i))-12)
> next
>
> stmsgbody ="Hello Fred <BR<BR>"
> stmsgbody = stmsgbody & "What to get some coffee Mate, Meet me downstairs in
> ten<BR><BR>"
> stmsgbody = stmsgbody & "Cheers<BR>"
> stmsgbody = stmsgbody & "Barney<BR>"
> szXml = ""
> szXml = szXml & "Cmd=send" & vbLf
> szXml = szXml & "MsgTo=address@youdomain.com" & vbLf
> szXml = szXml & "MsgCc=" & vbLf
> szXml = szXml & "MsgBcc=" & vbLf
> szXml = szXml & "urn:schemas:httpmail:importance=1" & vbLf
> szXml = szXml &
> "http://schemas.microsoft.com/exchange/readreceiptrequested=1" & vbLf
> szXml = szXml &
> "http://schemas.microsoft.com/exchange/deliveryreportrequested=1" & vbLf
> szXml = szXml & "http://schemas.microsoft.com/exchange/sensitivity-long=" &
> vbLf
> szXml = szXml & "urn:schemas:httpmail:subject=Coffee ???" & vbLf
> szXml = szXml & "urn:schemas:httpmail:htmldescription=<!DOCTYPE HTML PUBLIC
> " _
> & """-//W3C//DTD HTML 4.0 Transitional//EN""><HTML DIR=ltr><HEAD><META
> HTTP-EQUIV" _
> & "=""Content-Type"" CONTENT=""text/html;
> charset=utf-8""></HEAD><BODY><DIV>" _
> & "<FONT face='Arial' color=#000000 size=2>" & stmsgbody & "</font>" _
> & "</DIV></BODY></HTML>" & vbLf
> req.Open "POST", "https://" & servername & "/exchange/" & mailbox & "/",
> False, "", ""
> req.setRequestHeader "Accept-Language:", "en-us"
> req.setRequestHeader "Content-type:", "application/x-www-UTF8-encoded"
> req.SetRequestHeader "cookie", reqsessionID
> req.SetRequestHeader "cookie", reqCadata
> req.setRequestHeader "Content-Length:", Len(szXml)
> req.Send szXml
> Wscript.echo req.responseText
>
> Cheers
> Glen
>
> "Mike647" wrote in message
> news:EF389B2A-1F44-4659-8E04-420A6A8A45B7@microsoft.com...
> >I am writing an application that needs to export calendar information to an
> > exchange server using webdav. I can successfully send information to the
> > test
> > server(no FBA) using code of the form:
> >
> > Dim xmlReq As New MSXML2.XMLHTTP40
> > xmlReq = CreateObject("Microsoft.XMLHTTP")
> > xmlReq.open("PROPPATCH", msServer & msMailbox & "/Calendar/test.eml",
> > False, msUser, msPassword)
> > xmlReq.setRequestHeader("Content-Type", "text/xml")
> > xmlReq.send(sReqXML)
> >
> > Unfortunately I can't use this code since I need to be able to use Forms
> > Based Authentication which requires me to handle cookies.
> >
> > If I use code from http://support.microsoft.com/?kbid=314191 on the same
> > test server I get the following message:
> >
> > "A first chance exception of type 'System.Net.WebException' occurred in
> > system.dll"
> >
> > "Addtional information: The remote server returned an error: (401)
> > Unauthorized."
> >
> > I have kept the actual xml request identical in both cases. The only
> > difference is in how the information was sent to the server.
> >
> > Any help would greatly be appreciated.
> >
> > Thank you,
> > Mike
>
>
>
date: Mon, 15 Aug 2005 07:54:05 -0700
author: Mike647
|
|