How To Register an Exchange Web Form Globally in the Exchange Store

Article translations Article translations
Article ID: 306989
This article was previously published under Q306989
This article has been archived. It is offered "as is" and will no longer be updated.
Expand all | Collapse all


This code sample demonstrates how to register an Exchange Web Form globally in an Exchange mailbox store, a MAPI public folder tree, or a non-MAPI public folder tree.

More information

To register a form, follow these steps:
  1. Paste the following code in a new Visual Basic Module.
    Private Sub main()<BR/>
    'NOTE: Search for ToDo and when appropriate modify
    'the line of code below the ToDo comment.
    'ToDo: Uncomment line below if registering the form in the private store.
    'Set igetSG = CreateObject("Exoledb.StoreGuidFromUrl.1") 
    'Get the GUID for the registration process.
    'ToDO: Uncomment line below if registering the form in the private store.
    'Guid = igetSG.StoreGuidFromUrl("http://servername/exchange/Anystoreitem") 
    'Anystoreitem is just that, any store item in the store will get you the 
    'store url. It might be something like: "user1/inbox"
    'Private store  
    'ToDO: Uncomment line below if registering the form in the private store.
    'regURL = "http://servername/exchange/SystemMailbox" & Guid 
    'Non-MAPI TLH
    'ToDO: Uncomment line below if registering the form in a non-MAPI TLH.
    'regURL = "http://servername/vroot" 
    'Default Public Folder (MAPI TLH) 
    'ToDO: Uncomment line below if registering the form in a MAPI TLH.
    'regURL = "http://servername/exadmin/admin/" 
    If Trim(regURL) = "" Then 
        Exit Sub 
    End If  
    'Fill the default schema folder with form registrations. 
    Set oCon = CreateObject("ADODB.Connection")
    oCon.ConnectionString = regURL +  "/##SchemaURI##/microsoft/exchangeV1"  
    oCon.Provider = "ExOledb.Datasource" 
    'Register the default page for the folder.
    Set oRec = CreateObject("ADODB.Record") 
    oRec.Open "CustomPFRpt4.reg", oCon, 3, 0
    oRec.Fields("DAV:contentclass") = "urn:schemas-microsoft-com:office:forms#registration" 
    'ToDo: Change content class to your custom content class.
    oRec.Fields("urn:schemas-microsoft-com:office:forms#contentclass") = "urn:content-classes:message" 
    oRec.Fields("urn:schemas-microsoft-com:office:forms#cmd") = "open" 
    'ToDo: Change to appropriate URL.
    oRec.Fields("urn:schemas-microsoft-com:office:forms#formurl") = "http://servername/public/pf/form.asp"
    'ToDo: Change to appropriate URL.
    oRec.Fields("urn:schemas-microsoft-com:office:forms#executeurl") = "http://servername/public/pf/form.asp" 
    'Further instructions.
    MsgBox "Copy Form.ASP into the folder that is referenced when setting the urn:schemas-microsoft-com:office:forms#formurl. Enable script execution on the directory."
    End Sub
  2. Search for "ToDo" in the code and modify the code for your environment.
  3. Make a reference to Microsoft ActiveX Data Objects 2.5 Library.
  4. Run the code. Copy your custom form into a public folder and enable script execution on this public folder. If you have not created a custom form, you can use the following code:
    dataurl = request.querystring("dataurl")
    Set c = Server.CreateObject("ADODB.Connection")
    c.ConnectionString = dataurl
    c.Provider = "ExOledb.Datasource"
    Set r = Server.CreateObject("ADODB.Record")
    r.Open dataurl, c, 3 
    <form class="form" method="post" action="<%=request.querystring("dataurl")%>?Cmd=save">
    Subject:<input type="text" name="urn:schemas:mailheader:subject" value="<%=r("urn:schemas:mailheader:subject")%>"
    <input type="submit" value="Save">
  5. When you open an item within Outlook Web Access with the registered content class, it should use the custom Exchange Web Form.


"Binding Messages to Custom Forms"


Article ID: 306989 - Last Review: October 26, 2013 - Revision: 2.0
kbnosurvey kbarchive kbhowto kbmsg KB306989

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from