This documentation is archived and is not being maintained.

Registering an Exchange Web Form Using PROPPATCH

Exchange Server 2003

Registering an Exchange Web Form Using PROPPATCH

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

This example assumes a Web page with a button that triggers the DoDocRegister function. Log on as a user authorized to write to the store before you run the code.

See Authentication and Security Using WebDAV for more information.

function DoDocRegister(strurl)
{
  // Initialize the XMLHTTP request object.
  var m_httpsaverequest = new ActiveXObject("microsoft.xmlhttp");

  // Build the XML request body.
  var bstrRequestXML = "<?xml version='1.0'?><a:propertyupdate xmlns:a='DAV:' xmlns:b='urn:schemas:mailheader:'>";
  bstrRequestXML +="<a:set><a:prop>";
  bstrRequestXML +="<a:contentclass>urn:schemas-microsoft-com:office:forms#registration</a:contentclass>";
  bstrRequestXML += "</a:prop></a:set></a:propertyupdate>";

  // Open the request object with the PROPPATCH method and
  // specify that it will be sent asynchronously.
  m_httpsaverequest.open("PROPPATCH", strurl, false);

  // Set the Content-Type request header to "text/xml".
  m_httpsaverequest.setRequestHeader("Content-type", "text/xml");

  // Send the PROPPATCH method request with the XML body.
  m_httpsaverequest.send(bstrRequestXML);

  // An error occurred on the server.
  if(m_httpsaverequest.status >= 500)
  {
    this.document.writeln("Status: " + m_httpsaverequest.status);
    this.document.writeln("Status text: An error occurred on the server.");
  }

  // The method request was successful.
  else if (m_httpsaverequest.status >= 200 && m_httpsaverequest.status < 300)
  {
    this.document.writeln("Status: " + m_httpsaverequest.status);
    this.document.writeln("Status text: " + m_httpsaverequest.statustext);

    // Get the response XML body.
    var bstrXML = m_httpsaverequest.responseXML;
  }

  else
  {
    this.document.writeln("Status: " + m_httpsaverequest.status);
    this.document.writeln("Status text: " + m_httpsaverequest.statustext);
  }

  m_httpsaverequest = null;
}

The following XML example illustrates useful fields in XML format that you need to register a form. For an explanation of each of the fields, see Form Definition Properties. The form uses a custom content class named myclass. Processing is handled by an ASP file named Process.asp.

<prop>
<b:contentclass>urn:schemas-microsoft-com:office:forms#registration</b:contentclass>
<f:formurl>process.asp</f:formurl>
<f:cmd></f:cmd>
<f:contentclass>urn:contentclasses:myclass</f:contentclass>
<f:executeurl>process.asp</f:executeurl>
<f:browser>*</f:browser>
<f:contentstate>*</f:contentstate>
<f:language>*</f:language>
<f:majorver>=5</f:majorver>
<f:minorver>*</f:minorver>
<f:platform>*</f:platform>
<f:request>GET</f:request>
</prop>
Show: