SPForm Class

The SPForm class represents a form creating, displaying, or editing a list item in a list.

System.Object

   Microsoft.SharePoint.SPForm

Public Properties

The following table shows the public properties of the SPForm class, the data type of each property, and a brief description of each.

Name Data Type Description
ID System.Guid Gets the GUID that identifies the form.
ParentList Microsoft.SharePoint.SPList Gets the parent list of the form.
SchemaXml String Gets the schema in Collaborative Application Markup Language (CAML) that defines the form.
Type Microsoft.SharePoint.PAGETYPE Gets the type of the form.
Url String Gets the site-relative URL of the form.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread safe.

Remarks

Use the Forms property of the SPList class to return an SPFormCollection object that represents the collection of forms for a list, and use an indexer to return a single form from the collection. For example, if the collection is assigned to a variable named myForms, use myForms[index] in C#, or myForms(index) in Visual Basic .NET, where index is either the index number of the form in the collection or the name of the form page.

Example

The following example iterates through all the forms for the Contacts list of the current site and displays their site-relative URLs and types.

This example requires using directives (Imports in Visual Basic) for both the Microsoft.SharePoint and Microsoft.SharePoint.WebControls namespaces.

Requirements

Namespace: Microsoft.SharePoint

Platforms: Microsoft Windows Server 2003

Assembly: Windows SharePoint Services (in Microsoft.SharePoint.dll)

Security: Code Access Security