Re: Using Webdav for attachments in 2007
- From: "Lee Derbyshire [MVP]" <email a@t leederbyshire d.0.t c.0.m>
- Date: Tue, 2 Jun 2009 19:22:13 +0100
"MVBaker" <MVBaker@xxxxxxxxxxxxxxxx> wrote in message
news:5FB6C0D6-A311-479F-8017-5977034226A7@xxxxxxxxxxxxxxxx
"Lee Derbyshire [MVP]" wrote:
"MVBaker" <MVBaker@xxxxxxxxxxxxxxxx> wrote in message
news:D0C47A46-6F8C-497E-A646-AC918287F745@xxxxxxxxxxxxxxxx
Hi All,
I have a program that has been working on Exchange server 2003 for a
few
months now and the company upgraded to 2007. We made adjustments to the
folder paths for the location of the OWA Authentication dll, and
enabled
FBA
on the new server. With those changed in place should the same WebDav
code
work for 2007 or is WebDav just out of the question?
I'm also looking at re-coding it to use Web Services but that'll be
another
story.
TIA,
Mike
P.S. Thanks Glen for the helping with getting the attachments from the
'discussion' type. It did solve the problem and I marked it.
Yes, it will work the same. You changed the path for the auth dll, but
note
that the WebDAV (or plain GET, for attachment bodies) requests still go
to
/Exchange/ .
Lee.
Thanks for the info Lee. I've made it work from a test web page but it's
reporting a (401) unauthorized when it runs in the production machine.
What I
have is a Windows Service app that reads a list of files from a db. The
service looks for the files as attachments to incomming emails. But I
can't
get past the line that gets the WebResponse in the authentication function
(which I've included below)
Should this same authentication method work from a VB.NET exe app running
as
a service or is there something else I need to add?
Thanks for the help.
Mike
mstrProtocol = "https://"
strServerName is passed in and I've checked that it's correct
I've also checked the user name and password by logging into OWA
interactively.
AuthenticateSecureOWA function
' Construct our destination URI.
uriAuth = New System.Uri(mstrProtocol + strServerName +
"/owa/auth/owaauth.dll")
CookieJar = New CookieContainer
' Create our request object for the constructed URI.
reqAuthRequest = CType(WebRequest.Create(uriAuth),
HttpWebRequest)
reqAuthRequest.CookieContainer = CookieJar
' Create our post data string that is required by OWA
(owaauth.dll).
Dim strPostFields As String = "destination=https%3A%2F%2F" &
strServerName & "%2Fexchange%2F" & strUserName & "%2F&username=" &
strDomain
& "%5C" & strUserName & "&password=" & strPassword &
"&SubmitCreds=LogOn&forcedownlevel=0&trusted=0"
reqAuthRequest.KeepAlive = True
reqAuthRequest.Expect = ""
reqAuthRequest.Accept = "*/*"
reqAuthRequest.AllowAutoRedirect = False
reqAuthRequest.Method = "POST"
' Store the post data into a byte array.
Dim bytPostData() As Byte =
System.Text.Encoding.ASCII.GetBytes(strPostFields)
' Set the content length.
reqAuthRequest.ContentLength = bytPostData.Length
Dim tmpStream As Stream
' Create a request stream. Write the post data to the stream.
tmpStream = reqAuthRequest.GetRequestStream()
tmpStream.Write(bytPostData, 0, bytPostData.Length)
tmpStream.Close()
' Get the response from the request.this is the area that fails (401) unathorized is written to my log by
the exception catch.
Dim respAuthResp As HttpWebResponse =
reqAuthRequest.GetResponse()
' Create a stream to capture the response data
Dim tmpStreamRead As New
StreamReader(respAuthResp.GetResponseStream())
' Write returned data to a string.
Dim strResponseData As String = tmpStreamRead.ReadToEnd()
tmpStreamRead.Close()
' Close the response object.
respAuthResp.Close()
' Get our returned cookie set, store it for use elsewhere
mcookies = respAuthResp.Cookies
It's possible that the owaauth.dll is not available to anonymous users
(which it needs to be, since you haven't logged in yet). Check the IIS
permissions, and the NTFS permissions in Explorer. The IIS log will show
which resource is causing the problem, and may give a more specific error
code.
.
- Follow-Ups:
- Re: Using Webdav for attachments in 2007
- From: MVBaker
- Re: Using Webdav for attachments in 2007
- References:
- Re: Using Webdav for attachments in 2007
- From: MVBaker
- Re: Using Webdav for attachments in 2007
- Prev by Date: Re: Using Webdav for attachments in 2007
- Next by Date: Re: Using Webdav for attachments in 2007
- Previous by thread: Re: Using Webdav for attachments in 2007
- Next by thread: Re: Using Webdav for attachments in 2007
- Index(es):
Relevant Pages
|