473,729 Members | 2,099 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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=tru e 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
(GetRequestStre am property of HTTPRequest object) to the private calendar
folder.

thanks for your assistance
Nov 19 '05 #1
3 4020
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=tru e
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 (GetRequestStre am 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.d e
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 InvalidOperatio nException("Con nection Already open");
if (Url == "" || Url==null)
throw new ArgumentNullExc eption("URL must be specified");
System.Uri uriObj = new System.Uri(Url) ;
if (!((uriObj.Sche me == System.Uri.UriS chemeHttp) || (uriObj.Scheme ==
System.Uri.UriS chemeHttps)))
throw new ArgumentOutOfRa ngeException("U RL 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 ArgumentOutOfRa ngeException("M ethod argument type not defined");

lgbIsAsync = Asynch;

lgRequest = (HttpWebRequest )WebRequest.Cre ateDefault(uriO bj);
lgRequest.Metho d = Method;
lgRequest.Conte ntType = "text/xml";
if (User != "")
lgRequest.Crede ntials = new System.Net.Netw orkCredential(U ser, Password);
else
//lgRequest.Crede ntials = CredentialCache .DefaultCredent ials;
lgRequest.Crede ntials =
CredentialCache .DefaultCredent ials.GetCredent ial(uriObj, "Windows
Integrated");
uriObj = null;
lgReadyState = eReadyState.LOA DING;
}
// 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.LOA DING)
throw new InvalidOperatio nException("Sen ding a message is not allowed at
this ReadyState");
if (body != null)
{
if(lgbIsAsync)
{
lgMsg = body;
IAsyncResult res = lgRequest.Begin GetRequestStrea m(new
AsyncCallback(R eqCallback),lgR equest);
lgReadyState = eReadyState.LOA DED;
}
else
{
UTF8Encoding encoding = new UTF8Encoding();
byte[] buffer = encoding.GetByt es(body);
lgRequest.Conte ntLength = buffer.Length;
Stream stream = lgRequest.GetRe questStream(); // exception 501 (point one)
stream.Write(bu ffer,0,buffer.L ength);
stream.Close();
lgResponse = (HttpWebRespons e)lgRequest.Get Response(); // sometimes
exception 501 at this point
lgReadyState = eReadyState.COM PLETED;
}
}
}

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

Public Shared Sub SendPersonalUrl aubAppointment( 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 strAppURLKalend er As String = "http://" + userServer +
"/Exchange/" + Mailbox + "/Kalender/" + System.Guid.New Guid.ToString + ".EML"
Dim strAppURLCalend er As String = "http://" + userServer +
"/Exchange/" + Mailbox + "/calendar/" + System.Guid.New Guid.ToString + ".EML"

Dim s As New SenderAppointme nt

With s.objProp.objPr ops
.MailSubject = itm.Urlaub
.OLEndDate = itm.OutlookEndD ate
.OLStartDate = itm.OutlookStar tDate
.TextDescriptio n = "Ich bin auf " + itm.Urlaub
End With

Dim ser As New XmlSerializer(G etType(SenderAp pointment))
Dim xml As New XMLHTTP.XMLHttp Request
Dim m As New MemoryStream
Dim sw As New XmlTextWriter(m , System.Text.Enc oding.UTF8)
Dim sr As New StreamReader(m)

ser.Serialize(m , s)
Try
xml.Open("PROPP ATCH", strAppURLKalend er, False, User, Pwd)
Catch ex1 As Exception
xml.Open("PROPP ATCH", strAppURLCalend er, False, User, Pwd)
End Try

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

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

Dim strResult As String = xml.GetResponse XML.InnerXml
xml.Dispose()

sw.Close()
End Sub

//str
"<?xml version="1.0"?>
<propertyupda te xmlns:xsd="http ://www.w3.org/2001/XMLSchema"
xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance" xmlns="DAV:">
<set>
<prop>
<contentclass>u rn:content-classes:appoint ment</contentclass>
<outlookmessage class
xmlns="http://schemas.microso ft.com/exchange/">IPM.Appointme nt</outlookmessagec lass>
<location xmlns="urn:sche mas:calendar:" />
<dtstart
xmlns="urn:sche mas:calendar:"> 2005-09-01T00:00:00.000 0000+02:00</dtstart>
<dtend
xmlns="urn:sche mas:calendar:"> 2005-09-02T00:00:00.000 0000+02:00</dtend>
<instancetype xmlns="urn:sche mas:calendar:"> 0</instancetype>
<busystatus xmlns="urn:sche mas:calendar:"> OOF</busystatus>
<meetingstatu s xmlns="urn:sche mas:calendar:"> TENTATIVE</meetingstatus>
<alldayevent xmlns="urn:sche mas:calendar:"> 0</alldayevent>
<responsereques ted xmlns="urn:sche mas:calendar:"> 1</responserequest ed>
<method xmlns="urn:sche mas:calendar:"> REQUEST</method>
<sequence xmlns="urn:sche mas:calendar:"> 0</sequence>
<priority xmlns="urn:sche mas:httpmail:"> 0</priority>
<read xmlns="urn:sche mas:httpmail:"> 1</read>
<subject xmlns="urn:sche mas:httpmail:"> URLAUB</subject>
<textdescriptio n xmlns="urn:sche mas: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=tru e
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 (GetRequestStre am 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.d e

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 InvalidOperatio nException("Con nection Already open");
if (Url == "" || Url==null)
throw new ArgumentNullExc eption("URL must be specified");
System.Uri uriObj = new System.Uri(Url) ;
if (!((uriObj.Sche me == System.Uri.UriS chemeHttp) || (uriObj.Scheme ==
System.Uri.UriS chemeHttps)))
throw new ArgumentOutOfRa ngeException("U RL 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 ArgumentOutOfRa ngeException("M ethod argument type not defined");

lgbIsAsync = Asynch;

lgRequest = (HttpWebRequest )WebRequest.Cre ateDefault(uriO bj);
lgRequest.Metho d = Method;
lgRequest.Conte ntType = "text/xml";
if (User != "")
lgRequest.Crede ntials = new System.Net.Netw orkCredential(U ser, Password);
else
//lgRequest.Crede ntials = CredentialCache .DefaultCredent ials;
lgRequest.Crede ntials =
CredentialCache .DefaultCredent ials.GetCredent ial(uriObj, "Windows
Integrated");
uriObj = null;
lgReadyState = eReadyState.LOA DING;
}
// 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.LOA DING)
throw new InvalidOperatio nException("Sen ding a message is not allowed at
this ReadyState");
if (body != null)
{
if(lgbIsAsync)
{
lgMsg = body;
IAsyncResult res = lgRequest.Begin GetRequestStrea m(new
AsyncCallback(R eqCallback),lgR equest);
lgReadyState = eReadyState.LOA DED;
}
else
{
UTF8Encoding encoding = new UTF8Encoding();
byte[] buffer = encoding.GetByt es(body);
lgRequest.Conte ntLength = buffer.Length;
Stream stream = lgRequest.GetRe questStream(); // exception 501 (point one)
stream.Write(bu ffer,0,buffer.L ength);
stream.Close();
lgResponse = (HttpWebRespons e)lgRequest.Get Response(); // sometimes
exception 501 at this point
lgReadyState = eReadyState.COM PLETED;
}
}
}

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

Public Shared Sub SendPersonalUrl aubAppointment( 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 strAppURLKalend er As String = "http://" + userServer +
"/Exchange/" + Mailbox + "/Kalender/" + System.Guid.New Guid.ToString + ".EML"
Dim strAppURLCalend er As String = "http://" + userServer +
"/Exchange/" + Mailbox + "/calendar/" + System.Guid.New Guid.ToString + ".EML"

Dim s As New SenderAppointme nt

With s.objProp.objPr ops
.MailSubject = itm.Urlaub
.OLEndDate = itm.OutlookEndD ate
.OLStartDate = itm.OutlookStar tDate
.TextDescriptio n = "Ich bin auf " + itm.Urlaub
End With

Dim ser As New XmlSerializer(G etType(SenderAp pointment))
Dim xml As New XMLHTTP.XMLHttp Request
Dim m As New MemoryStream
Dim sw As New XmlTextWriter(m , System.Text.Enc oding.UTF8)
Dim sr As New StreamReader(m)

ser.Serialize(m , s)
Try
xml.Open("PROPP ATCH", strAppURLKalend er, False, User, Pwd)
Catch ex1 As Exception
xml.Open("PROPP ATCH", strAppURLCalend er, False, User, Pwd)
End Try

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

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

Dim strResult As String = xml.GetResponse XML.InnerXml
xml.Dispose()

sw.Close()
End Sub

//str
"<?xml version="1.0"?>
<propertyupda te xmlns:xsd="http ://www.w3.org/2001/XMLSchema"
xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance" xmlns="DAV:">
<set>
<prop>
<contentclass>u rn:content-classes:appoint ment</contentclass>
<outlookmessage class
xmlns="http://schemas.microso ft.com/exchange/">IPM.Appointme nt</outlookmessagec lass>
<location xmlns="urn:sche mas:calendar:" />
<dtstart
xmlns="urn:sche mas:calendar:"> 2005-09-01T00:00:00.000 0000+02:00</dtstart>
<dtend
xmlns="urn:sche mas:calendar:"> 2005-09-02T00:00:00.000 0000+02:00</dtend>
<instancetype xmlns="urn:sche mas:calendar:"> 0</instancetype>
<busystatus xmlns="urn:sche mas:calendar:"> OOF</busystatus>
<meetingstatu s xmlns="urn:sche mas:calendar:"> TENTATIVE</meetingstatus>
<alldayevent xmlns="urn:sche mas:calendar:"> 0</alldayevent>
<responsereques ted xmlns="urn:sche mas:calendar:"> 1</responserequest ed>
<method xmlns="urn:sche mas:calendar:"> REQUEST</method>
<sequence xmlns="urn:sche mas:calendar:"> 0</sequence>
<priority xmlns="urn:sche mas:httpmail:"> 0</priority>
<read xmlns="urn:sche mas:httpmail:"> 1</read>
<subject xmlns="urn:sche mas:httpmail:"> URLAUB</subject>
<textdescriptio n xmlns="urn:sche mas: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=tru e
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 (GetRequestStre am 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.d e

Nov 19 '05 #4

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

Similar topics

6
953
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
2022
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 until the Exchange 2003 SDK came out. Here's the code. Hopefully someone else can find this useful. #region DisplayExchangeContacts private void DisplayExchangeContacts() {
2
2791
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. Hopefully, I can explain this adequately. Prior to the upgrade the following code was working properly. FYI: The site was running in the context of the domain administrator, and was also using the Administrator account to create a CredentialCache...
0
3870
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. I've been looking at webdav as a solution to this, but i dont know much about how to use webdav or it with exchange server. Right now i'm working with VB.NET I found a sample project at...
1
3945
by: Gerhard | last post by:
How can I create a new contact in exchange server from a vb.net web application?
4
1507
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 problem: E-mails can only be send when Outlook is opened on the computer where IIS is working. If Outlook is closed, every logon method call shows dialog with username, server name and password (although I have entered correct user profile name and...
0
3398
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 SecurityException. This is my code to get the appointments: protected void getAfspraken() { NetworkCredential credential = new NetworkCredential("bhees","1234567", "oaicttest"); WebdavSession session = new...
7
3489
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 the 'send' button, (only 'reply' etc as if it was a received message). I'm using exchange explorer to see the difference in webDAV properties
5
3570
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 searching for a few hours and can't find a clear example on how to do it. i've already seen code blocks using webdav, directory services, but always related with creating active directory users or mail enabling users, not exactly what i'm looking for....
0
8923
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9428
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9285
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9151
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8155
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6722
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4529
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4796
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2165
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.