简体   繁体   中英

Exchange WebDAV 400 Bad Request: Why?

I have been using WebDAV in PHP directly using XML. I have managed to create emails with attachments and so forth, but when i try to create a contact, I keep getting "400 Bad Request". Here is the webdav query and how i'm executing it:

 <?xml version="1.0"?>
    <g:propertyupdate 
    xmlns:g="DAV:" 
    xmlns:c="urn:schemas:contacts:" 
    xmlns:e="http://schemas.microsoft.com/exchange/" 
    xmlns:mapi="http://schemas.microsoft.com/mapi/" 
    xmlns:x="xml:" 
    xmlns:cal="urn:schemas:calendar:" 
    xmlns:mail="urn:schemas:httpmail:">
    <g:set>
    <g:prop>
    <g:contentclass>urn:content-classes:person</g:contentclass>
    <e:outlookmessageclass>IPM.Contact</e:outlookmessageclass>
    <c:givenName>JoLynn</c:givenName>
    <c:middlename>Julie</c:middlename>
    </g:prop>
    </g:set>
    </g:propertyupdate>

And response:

HTTP/1.1 400 Bad Request
Connection: close
Date: Mon, 05 Jul 2010 08:41:43 GMT
Server: Microsoft-IIS/6.0
MicrosoftOfficeWebServer: 5.0_Pub
X-Powered-By: ASP.NET
Content-Type: text/html
Content-Length: 1709
MS-WebStorage: 6.5.7638

And sending the data: $h->fetch($url, 0, null, $exchange_username, $exchange_password, "PROPPATCH")

Any help greatly appreciated!¬

I started with Troy Wolf's example code at http://www.troywolf.com/articles/php/exchange_webdav_examples.php

嗯,我固定了它,忘了随请求一起发送一些标头(内容类型,深度和转换标头是准确的!)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM