473,323 Members | 1,560 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,323 software developers and data experts.

Exchange WebDAV - PUT Request - 501 not implemented

Hi,

I try to create a calender-item in the personal calendar folder from an
ASP.NET application using XML-HTTP Request (WebDAV).

System: Windows 2003 SP1, Exchange 2003 SP1

Configuration IIS: Default Web Site stopped, OWA running on a second virtual
site, my application is running on a third virtual site.

OWA is configured for Integrated Windows Authentication only, my application
the very same. The application uses impersonate=true without a userName.

The problem:
Some times access succeeds. Some times access fails with exception 501 - not
implemented. The exception occurs during the attempt to open a request stream
(GetRequestStream property of HTTPRequest object) to the private calendar
folder.

thanks for your assistance
Nov 19 '05 #1
3 3993
maria.s wrote:
Hi,

I try to create a calender-item in the personal calendar folder from
an ASP.NET application using XML-HTTP Request (WebDAV).

System: Windows 2003 SP1, Exchange 2003 SP1

Configuration IIS: Default Web Site stopped, OWA running on a second
virtual site, my application is running on a third virtual site.

OWA is configured for Integrated Windows Authentication only, my
application the very same. The application uses impersonate=true
without a userName.

The problem:
Some times access succeeds. Some times access fails with exception
501 - not implemented. The exception occurs during the attempt to
open a request stream (GetRequestStream property of HTTPRequest
object) to the private calendar folder.


Post your code. 501 usually means that a particular HTTP method (e.g.
PUT or DELETE) isn't implemented by the server.

Cheers,
--
http://www.joergjooss.de
mailto:ne********@joergjooss.de
Nov 19 '05 #2
These are the methods from our XMLHTTPRequest class

public void Open(string Method, string Url, bool Asynch, string User, string
Password)
{
// check parameters
if (lgRequest != null)
throw new InvalidOperationException("Connection Already open");
if (Url == "" || Url==null)
throw new ArgumentNullException("URL must be specified");
System.Uri uriObj = new System.Uri(Url);
if (!((uriObj.Scheme == System.Uri.UriSchemeHttp) || (uriObj.Scheme ==
System.Uri.UriSchemeHttps)))
throw new ArgumentOutOfRangeException("URL Scheme is not http or https");

//if (Method==null || (Method.ToUpper()!="POST" && Method.ToUpper()!="GET"
&& Method.ToUpper()!="PUT" && Method.ToUpper()!="PROPFIND" &&
Method.ToUpper()!="PROPPATCH" && Method.ToUpper()!="SEARCH"))
if (Method==null)
throw new ArgumentOutOfRangeException("Method argument type not defined");

lgbIsAsync = Asynch;

lgRequest = (HttpWebRequest)WebRequest.CreateDefault(uriObj);
lgRequest.Method = Method;
lgRequest.ContentType = "text/xml";
if (User != "")
lgRequest.Credentials = new System.Net.NetworkCredential(User, Password);
else
//lgRequest.Credentials = CredentialCache.DefaultCredentials;
lgRequest.Credentials =
CredentialCache.DefaultCredentials.GetCredential(u riObj, "Windows
Integrated");
uriObj = null;
lgReadyState = eReadyState.LOADING;
}
// here are two points at which the exception may occur (but five minutes
later it may work)
public void Send(string body)
{
if (lgReadyState != eReadyState.LOADING)
throw new InvalidOperationException("Sending a message is not allowed at
this ReadyState");
if (body != null)
{
if(lgbIsAsync)
{
lgMsg = body;
IAsyncResult res = lgRequest.BeginGetRequestStream(new
AsyncCallback(ReqCallback),lgRequest);
lgReadyState = eReadyState.LOADED;
}
else
{
UTF8Encoding encoding = new UTF8Encoding();
byte[] buffer = encoding.GetBytes(body);
lgRequest.ContentLength = buffer.Length;
Stream stream = lgRequest.GetRequestStream(); // exception 501 (point one)
stream.Write(buffer,0,buffer.Length);
stream.Close();
lgResponse = (HttpWebResponse)lgRequest.GetResponse(); // sometimes
exception 501 at this point
lgReadyState = eReadyState.COMPLETED;
}
}
}

This ist the method from our business layer (contents of str=xml data of
appointment below)

Public Shared Sub SendPersonalUrlaubAppointment(ByVal itm As Urlaubsmeldung,
ByVal User As String, ByVal Pwd As String, ByVal Subject As String, ByVal
Mailbox As String, ByVal userServer As String)

Dim strAppURLKalender As String = "http://" + userServer +
"/Exchange/" + Mailbox + "/Kalender/" + System.Guid.NewGuid.ToString + ".EML"
Dim strAppURLCalender As String = "http://" + userServer +
"/Exchange/" + Mailbox + "/calendar/" + System.Guid.NewGuid.ToString + ".EML"

Dim s As New SenderAppointment

With s.objProp.objProps
.MailSubject = itm.Urlaub
.OLEndDate = itm.OutlookEndDate
.OLStartDate = itm.OutlookStartDate
.TextDescription = "Ich bin auf " + itm.Urlaub
End With

Dim ser As New XmlSerializer(GetType(SenderAppointment))
Dim xml As New XMLHTTP.XMLHttpRequest
Dim m As New MemoryStream
Dim sw As New XmlTextWriter(m, System.Text.Encoding.UTF8)
Dim sr As New StreamReader(m)

ser.Serialize(m, s)
Try
xml.Open("PROPPATCH", strAppURLKalender, False, User, Pwd)
Catch ex1 As Exception
xml.Open("PROPPATCH", strAppURLCalender, False, User, Pwd)
End Try

xml.SetRequestHeader("Content-Type", "text/xml")
m.Position = 0

Dim str As String = sr.ReadToEnd
xml.Send(str)

Dim strResult As String = xml.GetResponseXML.InnerXml
xml.Dispose()

sw.Close()
End Sub

//str
"<?xml version="1.0"?>
<propertyupdate xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="DAV:">
<set>
<prop>
<contentclass>urn:content-classes:appointment</contentclass>
<outlookmessageclass
xmlns="http://schemas.microsoft.com/exchange/">IPM.Appointment</outlookmessageclass>
<location xmlns="urn:schemas:calendar:" />
<dtstart
xmlns="urn:schemas:calendar:">2005-09-01T00:00:00.0000000+02:00</dtstart>
<dtend
xmlns="urn:schemas:calendar:">2005-09-02T00:00:00.0000000+02:00</dtend>
<instancetype xmlns="urn:schemas:calendar:">0</instancetype>
<busystatus xmlns="urn:schemas:calendar:">OOF</busystatus>
<meetingstatus xmlns="urn:schemas:calendar:">TENTATIVE</meetingstatus>
<alldayevent xmlns="urn:schemas:calendar:">0</alldayevent>
<responserequested xmlns="urn:schemas:calendar:">1</responserequested>
<method xmlns="urn:schemas:calendar:">REQUEST</method>
<sequence xmlns="urn:schemas:calendar:">0</sequence>
<priority xmlns="urn:schemas:httpmail:">0</priority>
<read xmlns="urn:schemas:httpmail:">1</read>
<subject xmlns="urn:schemas:httpmail:">URLAUB</subject>
<textdescription xmlns="urn:schemas:httpmail:">Ich bin auf
URLAUB</textdescription>
</prop>
</set>
</propertyupdate>"
"Joerg Jooss" wrote:
maria.s wrote:
Hi,

I try to create a calender-item in the personal calendar folder from
an ASP.NET application using XML-HTTP Request (WebDAV).

System: Windows 2003 SP1, Exchange 2003 SP1

Configuration IIS: Default Web Site stopped, OWA running on a second
virtual site, my application is running on a third virtual site.

OWA is configured for Integrated Windows Authentication only, my
application the very same. The application uses impersonate=true
without a userName.

The problem:
Some times access succeeds. Some times access fails with exception
501 - not implemented. The exception occurs during the attempt to
open a request stream (GetRequestStream property of HTTPRequest
object) to the private calendar folder.


Post your code. 501 usually means that a particular HTTP method (e.g.
PUT or DELETE) isn't implemented by the server.

Cheers,
--
http://www.joergjooss.de
mailto:ne********@joergjooss.de

Nov 19 '05 #3
First: it's a PROPPATCH (sorry for communication a PUT first) and ..

If I call it from my develompment environment (Win XP, IIS 5) (not from the
IIS on the Exchange server itself) it works all time.

If I put the application into the same Web Site as OWA an exception 400 (Bad
Request) occurs. (OWA doesn't run in the Default Web Site)

Maybe its something with the configuration? But I have no more idea where to
look.

"maria.s" wrote:
These are the methods from our XMLHTTPRequest class

public void Open(string Method, string Url, bool Asynch, string User, string
Password)
{
// check parameters
if (lgRequest != null)
throw new InvalidOperationException("Connection Already open");
if (Url == "" || Url==null)
throw new ArgumentNullException("URL must be specified");
System.Uri uriObj = new System.Uri(Url);
if (!((uriObj.Scheme == System.Uri.UriSchemeHttp) || (uriObj.Scheme ==
System.Uri.UriSchemeHttps)))
throw new ArgumentOutOfRangeException("URL Scheme is not http or https");

//if (Method==null || (Method.ToUpper()!="POST" && Method.ToUpper()!="GET"
&& Method.ToUpper()!="PUT" && Method.ToUpper()!="PROPFIND" &&
Method.ToUpper()!="PROPPATCH" && Method.ToUpper()!="SEARCH"))
if (Method==null)
throw new ArgumentOutOfRangeException("Method argument type not defined");

lgbIsAsync = Asynch;

lgRequest = (HttpWebRequest)WebRequest.CreateDefault(uriObj);
lgRequest.Method = Method;
lgRequest.ContentType = "text/xml";
if (User != "")
lgRequest.Credentials = new System.Net.NetworkCredential(User, Password);
else
//lgRequest.Credentials = CredentialCache.DefaultCredentials;
lgRequest.Credentials =
CredentialCache.DefaultCredentials.GetCredential(u riObj, "Windows
Integrated");
uriObj = null;
lgReadyState = eReadyState.LOADING;
}
// here are two points at which the exception may occur (but five minutes
later it may work)
public void Send(string body)
{
if (lgReadyState != eReadyState.LOADING)
throw new InvalidOperationException("Sending a message is not allowed at
this ReadyState");
if (body != null)
{
if(lgbIsAsync)
{
lgMsg = body;
IAsyncResult res = lgRequest.BeginGetRequestStream(new
AsyncCallback(ReqCallback),lgRequest);
lgReadyState = eReadyState.LOADED;
}
else
{
UTF8Encoding encoding = new UTF8Encoding();
byte[] buffer = encoding.GetBytes(body);
lgRequest.ContentLength = buffer.Length;
Stream stream = lgRequest.GetRequestStream(); // exception 501 (point one)
stream.Write(buffer,0,buffer.Length);
stream.Close();
lgResponse = (HttpWebResponse)lgRequest.GetResponse(); // sometimes
exception 501 at this point
lgReadyState = eReadyState.COMPLETED;
}
}
}

This ist the method from our business layer (contents of str=xml data of
appointment below)

Public Shared Sub SendPersonalUrlaubAppointment(ByVal itm As Urlaubsmeldung,
ByVal User As String, ByVal Pwd As String, ByVal Subject As String, ByVal
Mailbox As String, ByVal userServer As String)

Dim strAppURLKalender As String = "http://" + userServer +
"/Exchange/" + Mailbox + "/Kalender/" + System.Guid.NewGuid.ToString + ".EML"
Dim strAppURLCalender As String = "http://" + userServer +
"/Exchange/" + Mailbox + "/calendar/" + System.Guid.NewGuid.ToString + ".EML"

Dim s As New SenderAppointment

With s.objProp.objProps
.MailSubject = itm.Urlaub
.OLEndDate = itm.OutlookEndDate
.OLStartDate = itm.OutlookStartDate
.TextDescription = "Ich bin auf " + itm.Urlaub
End With

Dim ser As New XmlSerializer(GetType(SenderAppointment))
Dim xml As New XMLHTTP.XMLHttpRequest
Dim m As New MemoryStream
Dim sw As New XmlTextWriter(m, System.Text.Encoding.UTF8)
Dim sr As New StreamReader(m)

ser.Serialize(m, s)
Try
xml.Open("PROPPATCH", strAppURLKalender, False, User, Pwd)
Catch ex1 As Exception
xml.Open("PROPPATCH", strAppURLCalender, False, User, Pwd)
End Try

xml.SetRequestHeader("Content-Type", "text/xml")
m.Position = 0

Dim str As String = sr.ReadToEnd
xml.Send(str)

Dim strResult As String = xml.GetResponseXML.InnerXml
xml.Dispose()

sw.Close()
End Sub

//str
"<?xml version="1.0"?>
<propertyupdate xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="DAV:">
<set>
<prop>
<contentclass>urn:content-classes:appointment</contentclass>
<outlookmessageclass
xmlns="http://schemas.microsoft.com/exchange/">IPM.Appointment</outlookmessageclass>
<location xmlns="urn:schemas:calendar:" />
<dtstart
xmlns="urn:schemas:calendar:">2005-09-01T00:00:00.0000000+02:00</dtstart>
<dtend
xmlns="urn:schemas:calendar:">2005-09-02T00:00:00.0000000+02:00</dtend>
<instancetype xmlns="urn:schemas:calendar:">0</instancetype>
<busystatus xmlns="urn:schemas:calendar:">OOF</busystatus>
<meetingstatus xmlns="urn:schemas:calendar:">TENTATIVE</meetingstatus>
<alldayevent xmlns="urn:schemas:calendar:">0</alldayevent>
<responserequested xmlns="urn:schemas:calendar:">1</responserequested>
<method xmlns="urn:schemas:calendar:">REQUEST</method>
<sequence xmlns="urn:schemas:calendar:">0</sequence>
<priority xmlns="urn:schemas:httpmail:">0</priority>
<read xmlns="urn:schemas:httpmail:">1</read>
<subject xmlns="urn:schemas:httpmail:">URLAUB</subject>
<textdescription xmlns="urn:schemas:httpmail:">Ich bin auf
URLAUB</textdescription>
</prop>
</set>
</propertyupdate>"
"Joerg Jooss" wrote:
maria.s wrote:
Hi,

I try to create a calender-item in the personal calendar folder from
an ASP.NET application using XML-HTTP Request (WebDAV).

System: Windows 2003 SP1, Exchange 2003 SP1

Configuration IIS: Default Web Site stopped, OWA running on a second
virtual site, my application is running on a third virtual site.

OWA is configured for Integrated Windows Authentication only, my
application the very same. The application uses impersonate=true
without a userName.

The problem:
Some times access succeeds. Some times access fails with exception
501 - not implemented. The exception occurs during the attempt to
open a request stream (GetRequestStream property of HTTPRequest
object) to the private calendar folder.


Post your code. 501 usually means that a particular HTTP method (e.g.
PUT or DELETE) isn't implemented by the server.

Cheers,
--
http://www.joergjooss.de
mailto:ne********@joergjooss.de

Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: dave | last post by:
I am looking for code resources on how to read ms exchange calendar with vb.net. Can anyone point me in the right direction to some code samples thx
0
by: George Durzi | last post by:
Hey all, I finally found the necessary resources in the Exchange 2003 SDK to "pull" Contacts out of Exchange and display them on a WebForm. I have been trying to do this forever, and couldn't...
2
by: George Durzi | last post by:
We recently upgraded to Exchange2K3/W2K3 from Exchange2K/W2K, and some of my c# code that I used to access users' contacts using WebDAV has stopped working. I'm getting a 401 unauthorized error....
0
by: Brian Henry | last post by:
I want to pull my contact list (personal one) from the exchange server into a local text file. I know how to write stuff into a text file, just getting it from an exchange server is my problem....
1
by: Gerhard | last post by:
How can I create a new contact in exchange server from a vb.net web application?
4
by: Radek | last post by:
Hi, I would like to send mails using MS Exchange from ASP.NET application. Is it possible to achieve this with CDO 1.21? Currently I'm using Redemption (version 4.2) and I have the following...
0
by: arjen1984 | last post by:
I am now working on C# with WebDAV on Exchange now to get appointments. When I work local on the domain where the server is, i can get the appointments no problem. When I work outside of it, i get an...
7
by: Wiebe Tijsma | last post by:
Hi, I'm using C# + webDAV to create a draft message to be sent in a user's Drafts folder. I can create the message successfully, however when I open the message in outlook, it doesn't show...
5
by: krasman | last post by:
hi everyone, i hope you might help me on this one. i need to create a contact in a exchange public folder using dotnet (vb or c#) and exchange 2003, without using outlook object model. i'm...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.