Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

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


View products that this article applies to.

This article was previously published under Q306989

↑ Back to the top


Summary

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.

↑ Back to the top


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/domain.com/public%20folders" 
    
    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" 
    oCon.Open 
    
    '---------------------------------------------------- 
    '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" 
    
    oRec.Fields.Update 
    oRec.Close
    
    '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:
    <%@Language=VBScript%>
    <html>
    <body>
    
    <% 
    dataurl = request.querystring("dataurl")
    Set c = Server.CreateObject("ADODB.Connection")
    c.ConnectionString = dataurl
    c.Provider = "ExOledb.Datasource"
    c.Open
    Set r = Server.CreateObject("ADODB.Record")
    r.Open dataurl, c, 3 
    %>
    
    <form class="form" method="post" action="<%=request.querystring("dataurl")%>?Cmd=save">
    
    <h3>Message</h3>
    Subject:<input type="text" name="urn:schemas:mailheader:subject" value="<%=r("urn:schemas:mailheader:subject")%>"
    
    <input type="submit" value="Save">
    </form>
    
    <% 
    r.Close
    c.Close 
    %>
    </body>
    </html>
    					
  5. When you open an item within Outlook Web Access with the registered content class, it should use the custom Exchange Web Form.

↑ Back to the top


References

↑ Back to the top


Keywords: KB306989, kbmsg, kbhowto

↑ Back to the top

Article Info
Article ID : 306989
Revision : 6
Created on : 7/2/2004
Published on : 7/2/2004
Exists online : False
Views : 304