Example Code: Testing Whether the Forms Tool Design Is Initialized
Applies to: SharePoint Workspace 2010 | Visual Studio 2008
The following C# sample code fragment demonstrates how to test if a Forms tool design is initialized. The code fragment:
Creates a new GrooveForms2 service and GrooveRequestHeader.
Tests the Tool.Type returned by GrooveTools.Read to ensure that the specified tool is a Forms tool accessed by the GrooveForms2 service.
Tests whether the Forms tool design is initialized.
// Create new service and header
GrooveForms2.GrooveForms2 forms2Svc = new GrooveForms2.GrooveForms2();
forms2Svc.GrooveRequestHeaderValue = new GrooveForms2.GrooveRequestHeader();
// Get the Identity2 from GrooveAccounts.Read2
GrooveAccounts.Identity2 ident = ...;
forms2Svc.GrooveRequestHeaderValue.GrooveIdentityURL = ident.URI;
// Get the request key, HTTP address, and port number.
// See examples in Reading Groove Registry Keys
string requestKey = ...;
string HTTPAddressAndPort = ...;
forms2Svc.GrooveRequestHeaderValue.GrooveRequestKey = requestKey;
GrooveTools.Tool tool = ...; // Get tool from GrooveTools.Read
// Make sure tool.Type has a urn for a GrooveForms2 tool
if (tool.Type == "urn:groove.net:platform.tools.Forms2" ||
tool.Type == "urn:groove.net:platform.tools.InfoPathForms")
{
// Get the PostURL from tool.Data
forms2Svc.Url = HTTPAddressAndPort + tool.Data;
// Must test if the design is initialized first
if (forms2Svc.IsFormsToolDesignInitialized())
{
// Forms tool design is initialized, do work here
}
}
See Also
Reference
GrooveForms2.IsFormsToolDesignInitialized Operation
GrooveForms2.ReadToolProperties Operation
Concepts
Accessing Forms Tool Design Information