Creating an appointment in an exchange calendar using webdav (slide)

Discussion in 'Java' started by Bernhard Weitlaner, Jan 26, 2006.

  1. Hello!

    I am new in webdav. I am trying for a long time to create an appointment in
    an exchange calendar (pubic folder) using webdav but without success.
    I am despairing.
    Here my programm:

    String strCalendarURI = "http://server/public/test1";
    HttpURL hrl = new HttpURL(strCalendarURI);
    hrl.setUserinfo("user", "pw");
    WebdavResource wdr = new WebdavResource(hrl);

    wdr.setDebug(1);
    Hashtable props = new Hashtable();
    props.put(new PropertyName("DAV:", "contentclass"),
    "urn:content-classes:appointment");
    props.put(new PropertyName("DAV:", "contentclass"),
    "urn:content-classes:appointment");
    props.put(new PropertyName("http//schemas.microsoft.com/exchange",
    "outlookmessageclass"), "IPM.Appointment");
    props.put(new PropertyName("urn:schemas:httpmail","subject"), "Changed
    Test Appointment Subject");
    props.put(new PropertyName("urn:schemas:httpmail","htmldescription"),
    "Let's meet here");
    props.put(new PropertyName("urn:schemas:calendar","location"), "do");
    props.put(new PropertyName("urn:schemas:calendar","dtstart"),
    "2006-01-01T10:00:00.000Z");
    props.put(new PropertyName("urn:schemas:calendar", "dtend"),
    "2006-01-01T10:30:00.000Z");
    props.put(new PropertyName("urn:schemas:calendar","instancetype"), "0");
    props.put(new PropertyName("urn:schemas:calendar","alldayevent"), "0");
    props.put(new PropertyName("urn:schemas:calendar","responserequested"),
    "1");
    props.put(new PropertyName("urn:schemas:calendar","busystatus"), "BUSY");
    props.put(new PropertyName("urn:schemas:calendar","meetingstatus"),
    "CONFIRMED");
    props.put(new PropertyName("header", "to"), "user");
    props.put(new PropertyName("urn:schemas:mapi","finvited"), "1");

    out.print("returned value ... " + wdr.proppatchMethod(props, true));


    The output:


    >>>>>>> to server ---------------------------------------------------

    PROPPATCH /public/test1 HTTP/1.1
    Authorization: Basic Qi5XZWl0bGFuZXI6c3NvYg==
    Content-Type: text/xml; charset=utf-8
    User-Agent: Jakarta Commons-HttpClient/2.0final
    Host: server
    Content-Length: 1068

    <D:propertyupdate xmlns:D="DAV:">
    <D:set>
    <D:prop>
    <responserequested xmlns="urn:schemas:calendar">
    1
    </responserequested>
    <dtend xmlns="urn:schemas:calendar">
    2006-01-01T10:30:00.000Z
    </dtend>
    <meetingstatus xmlns="urn:schemas:calendar">
    CONFIRMED
    </meetingstatus>
    <to xmlns="header">
    user
    </to>
    <instancetype xmlns="urn:schemas:calendar">
    0
    </instancetype>
    <outlookmessageclass xmlns="http//schemas.microsoft.com/exchange">
    IPM.Appointment
    </outlookmessageclass>
    <location xmlns="urn:schemas:calendar">
    do
    </location>
    <alldayevent xmlns="urn:schemas:calendar">
    0
    </alldayevent>
    <dtstart xmlns="urn:schemas:calendar">
    2006-01-01T10:00:00.000Z
    </dtstart>
    <htmldescription xmlns="urn:schemas:httpmail">
    Let's meet here
    </htmldescription>
    <finvited xmlns="urn:schemas:mapi">
    1
    </finvited>
    <D:contentclass>
    urn:content-classes:appointment
    </D:contentclass>
    <v xmlns="urn:schemas:contacts">
    1
    </v>
    <subject xmlns="urn:schemas:httpmail">
    Changed Test Appointment Subject
    </subject>
    <busystatus xmlns="urn:schemas:calendar">
    BUSY
    </busystatus>
    </D:prop>
    </D:set>
    </D:propertyupdate>
    ------------------------------------------------------------------------

    <<<<<<< from server ---------------------------------------------------
    HTTP/1.1 207 Multistatus
    Date: Wed, 25 Jan 2006 08:38:54 GMT
    Server: Microsoft-IIS/6.0
    MicrosoftOfficeWebServer: 5.0_Pub
    X-Powered-By: ASP.NET
    MS-Exchange-Permanent-URL:
    http://server/public/-FlatUrlSpace-/ddd97380fa9bf5429d9fdc31ddb24cd9-288e4
    Repl-UID: <rid:ddd97380fa9bf5429d9fdc31ddb24cd9000000000529>
    Content-Type: text/xml
    Content-Length: 617
    ResourceTag:
    <rt:ddd97380fa9bf5429d9fdc31ddb24cd9000000000529ddd97380fa9bf5429d9fdc31ddb24cd9000000000879>
    MS-WebStorage: 6.5.7638

    <a:multistatus
    xmlns:a="DAV:"
    xmlns:b="urn:schemas:calendar"
    xmlns:c="header"
    xmlns:d="http//schemas.microsoft.com/exchange"
    xmlns:e="urn:schemas:httpmail"
    xmlns:f="urn:schemas:mapi"
    xmlns:g="urn:schemas:contacts">

    <a:response>
    <a:href>
    http://server/public/test1
    </a:href>
    <a:propstat>
    <a:status>
    HTTP/1.1 200 OK
    </a:status>
    <a:prop>
    <b:responserequested>
    </b:responserequested>
    <b:dtend>
    </b:dtend>
    <b:meetingstatus>
    </b:meetingstatus>
    <c:to>
    </c:to>
    <b:instancetype>
    </b:instancetype>
    <d:eek:utlookmessageclass>
    </d:eek:utlookmessageclass>
    <b:location>
    </b:location>
    <b:alldayevent>
    </b:alldayevent>
    <b:dtstart>
    </b:dtstart>
    <e:htmldescription>
    </e:htmldescription>
    <f:finvited>
    </f:finvited>
    <a:contentclass>
    </a:contentclass>
    <g:v>
    </g:v>
    <e:subject>
    </e:subject>
    <b:busystatus>
    </b:busystatus>
    </a:prop>
    </a:propstat>
    </a:response>
    </a:multistatus>
    ------------------------------------------------------------------------

    >>>>>>> to server ---------------------------------------------------

    PROPFIND /public/test1 HTTP/1.1
    Authorization: Basic Qi5XZWl0bGFuZXI6c3NvYg==
    Content-Type: text/xml; charset=utf-8
    User-Agent: Jakarta Commons-HttpClient/2.0final
    Host: server
    Content-Length: 207
    Depth: 0

    <D:propfind xmlns:D="DAV:">
    <D:prop>
    <D:displayname>
    </D:displayname>
    <D:getcontentlength>
    </D:getcontentlength>
    <D:getcontenttype>
    </D:getcontenttype>
    <D:resourcetype>
    </D:resourcetype>
    <D:getlastmodified>
    </D:getlastmodified>
    <D:lockdiscovery>
    </D:lockdiscovery>
    </D:prop>
    </D:propfind>
    ------------------------------------------------------------------------

    <<<<<<< from server ---------------------------------------------------
    HTTP/1.1 207 Multistatus
    Date: Wed, 25 Jan 2006 08:38:54 GMT
    Server: Microsoft-IIS/6.0
    MicrosoftOfficeWebServer: 5.0_Pub
    X-Powered-By: ASP.NET
    Content-Type: text/xml
    Accept-Ranges: rows
    MS-WebStorage: 6.5.7638
    Transfer-Encoding: chunked

    <a:multistatus
    xmlns:a="DAV:"
    xmlns:b="urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/"
    xmlns:c="xml:">

    <a:response>
    <a:href>
    http://server/public/test1/
    </a:href>
    <a:propstat>
    <a:status>
    HTTP/1.1 200 OK
    </a:status>
    <a:prop>
    <a:displayname>
    test1
    </a:displayname>
    <a:getcontentlength b:dt="int">
    0
    </a:getcontentlength>
    <a:resourcetype>
    <a:collection>
    </a:collection>
    </a:resourcetype>
    <a:getlastmodified b:dt="dateTime.tz">
    2006-01-25T08:38:54.755Z
    </a:getlastmodified>
    <lockdiscovery xmlns="DAV:">
    </lockdiscovery>
    </a:prop>
    </a:propstat>
    <a:propstat>
    <a:status>
    HTTP/1.1 404 Resource Not Found
    </a:status>
    <a:prop>
    <a:getcontenttype>
    </a:getcontenttype>
    </a:prop>
    </a:propstat>
    </a:response>
    </a:multistatus>
    ------------------------------------------------------------------------

    It looks not so bad. But no appointment is created.
    Where is the problem?
    When i google for the problem i always find howtos for .NET but nearly
    nothing for java

    Thank you for your help.

    best regards
    Bernhard
    Bernhard Weitlaner, Jan 26, 2006
    #1
    1. Advertising

  2. Bernhard Weitlaner

    Erich Oswald Guest

    Re: Creating an appointment in an exchange calendar using webdav(slide)

    Bernhard Weitlaner wrote:
    > Hello!
    >
    > I am new in webdav. I am trying for a long time to create an appointment in
    > an exchange calendar (pubic folder) using webdav but without success.
    > I am despairing.
    > Here my programm:


    [snipped log]

    > It looks not so bad. But no appointment is created.
    > Where is the problem?
    > When i google for the problem i always find howtos for .NET but nearly
    > nothing for java
    >
    > Thank you for your help.
    >
    > best regards
    > Bernhard


    My experience has been that although you can connect to Exchange with
    WebDAV, a lot of things don't work the way you'd expect when you just
    read about WebDAV. Remember it's Microsoft :).

    When we developed an Exchange back-end for a SyncML-DS server, we
    found that we weren't able to create appointments with PROPPATCH
    either. What we finally did was to sniff the WebDAV traffic between
    Exchange and an Outlook Web Access (OWA) client. When we saw that OWA
    uses POST requests to create new appointments, we did the same.

    BTW, we also used the WebDAV client from Jakarta Slide, but quickly
    found the standard WebdavResource behaviour didn't correspond to our
    requirements and stopped using it. We still profited a lot from
    Slide's implementations of all WebDAV methods and of course from the
    excellent HttpClient base.
    --
    Erich
    Erich Oswald, Jan 26, 2006
    #2
    1. Advertising

  3. Re: Creating an appointment in an exchange calendar using webdav(slide)

    Hello Erich!


    Thank you for your answer.
    I was worry about that microsoft has their own standards once again.

    I need only one function of the webdav protocol. And that is to insert
    an appointment into a calendar.

    You said that you tried it with the PUT method. Does that work?
    Maybe do you have a small code sample?
    That would be great.

    Thank you very much.

    regards,
    Bernhard
    Bernhard Weitlaner, Jan 26, 2006
    #3
  4. Bernhard Weitlaner

    Erich Oswald Guest

    Re: Creating an appointment in an exchange calendar using webdav(slide)

    Bernhard Weitlaner wrote:
    > Hello Erich!
    >
    > Thank you for your answer.
    > I was worry about that microsoft has their own standards once again.
    >
    > I need only one function of the webdav protocol. And that is to insert
    > an appointment into a calendar.


    Ok, that will make things easier.

    > You said that you tried it with the PUT method. Does that work?


    Not a PUT, but a POST. In addition to your regular WebDAV properties,
    add a property "Cmd" with value "saveappt" (which in OWA is part of
    the form).

    > Maybe do you have a small code sample?
    > That would be great.


    Something like:

    PostMethod post = new PostMethod("/exchange/calendar");
    post.addParameter("Cmd", "saveappt");
    post.addParameter("urn:schemas:calendar:dtstart", "20060126T160000Z");
    ....
    try {
    httpClient.executeMethod(post);
    } catch (IOException e) {
    ...
    }

    To be honest there are a few things missing (like getting the
    httpClient), but you can look up most of these things in the source of
    the WebdavResource class.

    > Thank you very much.
    >
    > regards,
    > Bernhard


    I hope this helps.

    Erich
    --
    Erich Oswald, Jan 26, 2006
    #4
  5. Re: Creating an appointment in an exchange calendar using webdav(slide)

    Hi Erich!


    It works :). I have an appointment in my calendar.
    Thank you very much.

    Bernhard


    Erich Oswald schrieb:
    > Bernhard Weitlaner wrote:
    >> Hello Erich!
    >>
    >> Thank you for your answer.
    >> I was worry about that microsoft has their own standards once again.
    >>
    >> I need only one function of the webdav protocol. And that is to insert
    >> an appointment into a calendar.

    >
    > Ok, that will make things easier.
    >
    >> You said that you tried it with the PUT method. Does that work?

    >
    > Not a PUT, but a POST. In addition to your regular WebDAV properties,
    > add a property "Cmd" with value "saveappt" (which in OWA is part of the
    > form).
    >
    >> Maybe do you have a small code sample?
    >> That would be great.

    >
    > Something like:
    >
    > PostMethod post = new PostMethod("/exchange/calendar");
    > post.addParameter("Cmd", "saveappt");
    > post.addParameter("urn:schemas:calendar:dtstart", "20060126T160000Z");
    > ...
    > try {
    > httpClient.executeMethod(post);
    > } catch (IOException e) {
    > ...
    > }
    >
    > To be honest there are a few things missing (like getting the
    > httpClient), but you can look up most of these things in the source of
    > the WebdavResource class.
    >
    >> Thank you very much.
    >>
    >> regards,
    >> Bernhard

    >
    > I hope this helps.
    >
    > Erich
    Bernhard Weitlaner, Jan 27, 2006
    #5
  6. Bernhard Weitlaner

    Ken Guest

    How did you make it? I am working on something like yours, could give
    me some hints?
    Thanks in advance~
    Ken, Feb 3, 2006
    #6
  7. Bernhard Weitlaner

    ekor_hitam

    Joined:
    Jul 27, 2006
    Messages:
    1
    Hi,

    I have created an appointment using a POST.

    Now I would like to know the uid of the appointment just created.

    Have you already found a way to get this?

    Regards,

    Ekor.
    ekor_hitam, Aug 2, 2006
    #7
  8. Bernhard Weitlaner

    coatsy

    Joined:
    Dec 28, 2007
    Messages:
    1
    Creating appointment no longer works with Exchange 2007

    I have been using Post to create an appointment, but now we have upgraded to Exchange Server 2007 and this no longer works. Any ideas or suggestions?
    coatsy, Dec 28, 2007
    #8
  9. Bernhard Weitlaner

    RatStrydom

    Joined:
    Apr 30, 2009
    Messages:
    1
    Hi,

    I have been struggling with the same issue of getting a success (201) response, but no appointment appearing (although I have been using .Net).

    I finally found that adding the following request header "Translate: f" fixed my problem. This seems to be left out in the MSDN articles.

    I didn't end up needing to add any post parameters.

    I hope this helps someone.
    RatStrydom, Apr 30, 2009
    #9
  10. Bernhard Weitlaner

    ahsan123

    Joined:
    Jun 1, 2009
    Messages:
    2
    Hashtable props = new Hashtable();
    props.put(new PropertyName("DAV:", "contentclass"),"urn:content-classes:appointment");
    props.put(new PropertyName("DAV:", "contentclass"),"urn:content-classes:appointment");
    props.put(new PropertyName("http//schemas.microsoft.com/exchange","outlookmessageclass"), "IPM.Appointment");
    props.put(new PropertyName("urn:schemas:httpmail","subject"), "Changed Test Appointment Subject");
    props.put(new PropertyName("urn:schemas:httpmail","htmldescription"),"Let's meet here");
    props.put(new PropertyName("urn:schemas:calendar","location"), "do");
    props.put(new PropertyName("urn:schemas:calendar","dtstart"),"2009-06-02T10:00:00.000Z");
    props.put(new PropertyName("urn:schemas:calendar", "dtend"),"2009-06-02T10:30:00.000Z");
    props.put(new PropertyName("urn:schemas:calendar","instancetype" ), "0");
    props.put(new PropertyName("urn:schemas:calendar","alldayevent") , "0");
    props.put(new PropertyName("urn:schemas:calendar","responserequested"),"1");
    props.put(new PropertyName("urn:schemas:calendar","busystatus"), "BUSY");
    props.put(new PropertyName("urn:schemas:calendar","meetingstatus"),"CONFIRMED");
    props.put(new PropertyName("header", "to"), "");
    props.put(new PropertyName("urn:schemas:mapi","finvited"), "1");
    webdavresource.setContentType("text/xml");

    System.out.print("returned value ... " + webdavresource.proppatchMethod(props, true));


    HTTP/1.1 411 Length Required ????
    how can i send mail ?? or add the calendar event ?
    plz reply soon
    ahsan123, Jun 1, 2009
    #10
  11. Bernhard Weitlaner

    ahsan123

    Joined:
    Jun 1, 2009
    Messages:
    2
    help

    plz tell me how can i send mail using webdav ????
    ahsan123, Jun 2, 2009
    #11
  12. Bernhard Weitlaner

    NemanjaB

    Joined:
    Dec 15, 2010
    Messages:
    1
    There is Java API: JWebDAV for Exchange

    Go to: independentsoft.de/jwebdav
    NemanjaB, Dec 15, 2010
    #12
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. KovaiRam
    Replies:
    1
    Views:
    1,256
    KovaiRam
    Feb 1, 2005
  2. akshar108 via DotNetMonster.com

    get all word of slide through aspose.slide

    akshar108 via DotNetMonster.com, Oct 30, 2007, in forum: ASP .Net
    Replies:
    0
    Views:
    581
    akshar108 via DotNetMonster.com
    Oct 30, 2007
  3. Michael Dichtl

    WebDAV: Connect Ruby to a WebDAV Server

    Michael Dichtl, Jul 9, 2007, in forum: Ruby
    Replies:
    7
    Views:
    853
    Rob Biedenharn
    Jul 9, 2007
  4. Gerald Bauer
    Replies:
    0
    Views:
    245
    Gerald Bauer
    Aug 26, 2008
  5. banyan

    Slide-in & slide-out Scroller Help!

    banyan, Nov 16, 2005, in forum: Javascript
    Replies:
    0
    Views:
    112
    banyan
    Nov 16, 2005
Loading...

Share This Page