XCLN: How to Create an Appointment Folder Using WebDAV (259853)



The information in this article applies to:

  • Microsoft Exchange 2000 Server

This article was previously published under Q259853

SUMMARY

This article describes how to create an appointment folder in the default public folder store by using Distributed Authoring Version (DAV) command MKCOL. The http://schemas.microsoft.com/exchange/outlookfolderclass property of this folder is set to IPF. You create an appointment by sending an Extensible Markup Language (XML) body in the request.

MORE INFORMATION

To test the code:
  1. Create a public folder named Aspapps under Public Folders. Copy and paste the following code to Notepad, modify the code to reflect your server name, and then save the code in the Aspapps folder as the Mkcolappt.asp file.
    <%@ language=vbscript %>
    <%
    option explicit
    '----------------------------------------------------------------------
    'Example: Create an appointment folder in the MAPI public folder tree
    '----------------------------------------------------------------------
    Dim newFolderURL
    
    Dim XMLreq 'XML activeX object to process the request to create the folder
    Dim sReq 'XML request string 
     
    newFolderURL = "http://ServerName/public/MKCOLAppt"     
    
    'Use XML to create the new folder 
    set XMLreq = createobject("microsoft.xmlhttp")
    
    XMLreq.open "MKCOL", newFolderURL, false
    XMLreq.setrequestheader "Content-Type", "text/xml"
    
    sReq =  "<?xml version='1.0'?>"
    sReq = sReq & "<a:propertyupdate xmlns:a='DAV:' xmlns:ex='http://schemas.microsoft.com/exchange/'>"
    sReq = sReq & "<a:set><a:prop>"
    sReq = sReq & "<ex:outlookfolderclass>IPF.Appointment</ex:outlookfolderclass>"
    sReq = sReq & "</a:prop></a:set></a:propertyupdate>"
    
    'send the request to set the search criteria
    XMLreq.send(sReq)
    
    
    'display the results
    if (XMLreq.status >= 200 and XMLreq.status < 300) then
      Response.Write("<P>Success!   " & "Results = " & XMLreq.status & ": " & XMLreq.statusText  & "</P>")
    else
      Response.Write("<P>Request Failed.  Results = " & XMLreq.status & ": " & XMLreq.statusText & "</P>")
    end if
    	
    %>
    					
  2. Run the .asp file in Microsoft Internet Explorer by using the following path:

    http://server_name/public/aspapps/mkcolappt.asp

After you perform these steps, an appointment folder named MKCOLAppt is created under Public Folders.

Modification Type:MinorLast Reviewed:4/25/2005
Keywords:kbinfo KB259853