Example Code: Reading Forms and Form Fields
Applies to: SharePoint Workspace 2010 | Visual Studio 2008
This C# code demonstrates how to find a specific form in a tool by its Form ID. The ReadForms operation returns the Form ID as a string, not as a double. The following code fragment:
Reads the forms in the tool.
Finds the form with the specified ID.
Read the fields of that form.
// First create the GrooveForms2 service and
// verify that the tool is initialized.
// Iterate through the forms in the Forms tool
GrooveForms2.Form[] forms = forms2Svc.ReadForms();
for (int i =0; i < forms.Length; i++)
{
GrooveForms2.Form form = forms[i];
// Test to see if expected form exists
if (form.ID == "2.1697193868839881E+086")
{
// Set the HTTP Post URL to form URI
forms2Svc.Url = HTTPAddressAndPort + form.URI;
// Read form fields
GrooveForms2.FormsField[] fields = forms2Svc.ReadFormFields();
for (int j=0; j < fields.Length; j++)
{
GrooveForms2.FormsField field = fields[j];
string name = field.Name;
string type = field.DataType;
// ...
}
// Found form, do not need to check others
break;
}
}
See Also
Reference
GrooveForms2.ReadForms Operation
GrooveForms2.ReadFormFields Operation
Concepts
Example Code: Testing Whether the Forms Tool Design Is Initialized
Accessing Forms Tool Design Information