Forms.GetForm Method

Returns the schema of a form for a specified list based on the name of the list and the URL of the form.

Web Service: FormsWeb Reference: http://<Site>/_vti_bin/Forms.asmx

Syntax

<SoapDocumentMethodAttribute("http://schemas.microsoft.com/sharepoint/soap/GetForm", RequestNamespace:="http://schemas.microsoft.com/sharepoint/soap/", ResponseNamespace:="http://schemas.microsoft.com/sharepoint/soap/", Use:=SoapBindingUse.Literal, ParameterStyle:=SoapParameterStyle.Wrapped)> _
Public Function GetForm ( _
    listName As String, _
    formUrl As String _
) As XmlNode

Dim instance As Forms
Dim listName As String
Dim formUrl As String
Dim returnValue As XmlNode

returnValue = instance.GetForm(listName, formUrl)
[SoapDocumentMethodAttribute("http://schemas.microsoft.com/sharepoint/soap/GetForm", RequestNamespace="http://schemas.microsoft.com/sharepoint/soap/", ResponseNamespace="http://schemas.microsoft.com/sharepoint/soap/", Use=SoapBindingUse.Literal, ParameterStyle=SoapParameterStyle.Wrapped)] 
public XmlNode GetForm (
    string listName,
    string formUrl
)

Parameters

  • listName
    String that contains the internal name of the list.
  • formUrl
    String that contains the site-relative URL of the form to retrieve (for example, Lists/List_Name/NewForm.aspx).

Return Value

An XML fragment in the following form that contains the URL, type, and Web Part zone ID for the form and that can be assigned to a System.Xml.XmlNode object:

<Form Type="NewForm" Url="NewForm.aspx" WebPartZoneID="Main" 
   xmlns="http://schemas.microsoft.com/sharepoint/soap/" />

Example

The following code example displays information about a specified form.

This example requires that a using (Visual C#) or Imports (Visual Basic) directive be included for the System.Xml namespace.

Dim formService As New Web_Reference_Folder_Name.Forms()
formService.Credentials = System.Net.CredentialCache.DefaultCredentials

Dim ndForm As XmlNode = formService.GetForm("List_Name", _
    "Lists/List_Name/NewForm.aspx")

MessageBox.Show(ndForm.OuterXml)
Web_Reference_Folder_Name.Forms formService = 
    new Web_Reference_Folder_Name.Forms();
formService.Credentials= System.Net.CredentialCache.DefaultCredentials;

XmlNode ndForm = formService.GetForm("List_Name",
    "Lists/List_Name/NewForm.aspx");

MessageBox.Show(ndForm.OuterXml);

See Also

Reference

Forms Class
Forms Members
Forms Web Service