Microsoft KB Archive/306989

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

Article ID: 306989

Article Last Modified on 7/2/2004

-

APPLIES TO


 * Microsoft Exchange Server 2000 Service Pack 1

-



This article was previously published under Q306989



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.



MORE INFORMATION
To register a form, follow these steps:   Paste the following code in a new Visual Basic Module. Private Sub main '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(&quot;Exoledb.StoreGuidFromUrl.1&quot;)

'Get the GUID for the registration process.

'ToDO: Uncomment line below if registering the form in the private store. 'Guid = igetSG.StoreGuidFromUrl(&quot;http://servername/exchange/Anystoreitem&quot;)

'Anystoreitem is just that, any store item in the store will get you the 'store url. It might be something like: &quot;user1/inbox&quot;

'Private store 'ToDO: Uncomment line below if registering the form in the private store. 'regURL = &quot;http://servername/exchange/SystemMailbox&quot; & Guid

'Non-MAPI TLH 'ToDO: Uncomment line below if registering the form in a non-MAPI TLH. 'regURL = &quot;http://servername/vroot&quot;

'Default Public Folder (MAPI TLH) 'ToDO: Uncomment line below if registering the form in a MAPI TLH. 'regURL = &quot;http://servername/exadmin/admin/domain.com/public%20folders&quot;

If Trim(regURL) = &quot;&quot; Then Exit Sub End If

'Fill the default schema folder with form registrations.

Set oCon = CreateObject(&quot;ADODB.Connection&quot;) oCon.ConnectionString = regURL + &quot;/##SchemaURI##/microsoft/exchangeV1&quot; oCon.Provider = &quot;ExOledb.Datasource&quot; oCon.Open

' 'Register the default page for the folder.

Set oRec = CreateObject(&quot;ADODB.Record&quot;) oRec.Open &quot;CustomPFRpt4.reg&quot;, oCon, 3, 0 oRec.Fields(&quot;DAV:contentclass&quot;) = &quot;urn:schemas-microsoft-com:office:forms#registration&quot;

'ToDo: Change content class to your custom content class. oRec.Fields(&quot;urn:schemas-microsoft-com:office:forms#contentclass&quot;) = &quot;urn:content-classes:message&quot; oRec.Fields(&quot;urn:schemas-microsoft-com:office:forms#cmd&quot;) = &quot;open&quot;

'ToDo: Change to appropriate URL. oRec.Fields(&quot;urn:schemas-microsoft-com:office:forms#formurl&quot;) = &quot;http://servername/public/pf/form.asp&quot;

'ToDo: Change to appropriate URL. oRec.Fields(&quot;urn:schemas-microsoft-com:office:forms#executeurl&quot;) = &quot;http://servername/public/pf/form.asp&quot;

oRec.Fields.Update oRec.Close

'Further instructions.

MsgBox &quot;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.&quot;

End Sub  Search for &quot;ToDo&quot; in the code and modify the code for your environment. Make a reference to Microsoft ActiveX Data Objects 2.5 Library.  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%>

<% dataurl = request.querystring(&quot;dataurl&quot;) Set c = Server.CreateObject(&quot;ADODB.Connection&quot;) c.ConnectionString = dataurl c.Provider = &quot;ExOledb.Datasource&quot; c.Open Set r = Server.CreateObject(&quot;ADODB.Record&quot;) r.Open dataurl, c, 3 %>

?Cmd=save&quot;>

Message Subject:&quot;



<% r.Close c.Close %>                    When you open an item within Outlook Web Access with the registered content class, it should use the custom Exchange Web Form.</li></ol>

<div class="references_section">