Webs.GetColumns Method

Returns a collection of the column definitions for the columns available on the site.

Web Service: WebsWeb Reference: http://<Site>/_vti_bin/Webs.asmx

Syntax

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

Dim instance As Webs
Dim returnValue As XmlNode

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

Return Value

An XML fragment in the form of a Fields Element (List) element that can be assigned to a System.Xml.XmlNode object.

<Fields>
  <Field ID="{BA934502-D68D-4960-A54B-51E15FEF5FD3}" 
    Name="ManagersName" 
    DisplayName="Manager's Name" 
    Group="Core Contact and Calendar Columns" 
    Type="Text" Sealed="TRUE" 
    AllowDeletion="TRUE" 
    xmlns="http://schemas.microsoft.com/sharepoint/soap/" />
  <Field ID="{810DBD02-BBF5-4c67-B1CE-5AD7C5A512B2}" 
    Type="DateTime" 
    Format="DateTime" 
    Group="Core Document Columns" 
    Name="_DCDateModified" DisplayName="Date Modified" 
    SourceID="http://schemas.microsoft.com/sharepoint/v3/fields" 
    StaticName="_DCDateModified" 
    Description="The date on which this resource was last modified" 
    xmlns="http://schemas.microsoft.com/sharepoint/soap/" />
</Fields>

Remarks

Each column definition is the same as would be returned by invoking the SchemaXml method.

Example

The following example retrieves a list of all columns on the specified site, and saves that list to an XML file.

Imports System.Xml
Imports System.Web.Services.Protocols
…
Public Sub GetAllSiteColumns()
  Dim websService As New Web_Reference_Folder_Name.Webs
  websService.Credentials = System.Net.CredentialCache.DefaultCredentials

  Try
    'Retrieve site column data from Web service.
    Dim myNode As XmlNode = websService.GetColumns

    'Create XML document.
    Dim XmlDoc As New XmlDocument
    Dim d As XmlNode
    d = XmlDoc.CreateXmlDeclaration("1.0", "", "yes")
    XmlDoc.AppendChild(d)

    'Move Web service data into XML document and save.
    Dim root As XmlNode = XmlDoc.CreateElement("Fields")
    root.InnerXml = myNode.InnerXml
    XmlDoc.AppendChild(root)
    XmlDoc.Save("SiteColumns.xml")

  Catch ex As SoapException
    MessageBox.Show("Message:" + ControlChars.Lf + ex.Message & _
        ControlChars.Lf & _
      "Detail:" + ControlChars.Lf + ex.Detail.InnerText & _
        ControlChars.Lf & _
      "StackTrace:" & ControlChars.Lf + ex.StackTrace)

  Catch ex As Exception
    MessageBox.Show(ex.Message.ToString)

  End Try

End Sub

See Also

Reference

Webs Class
Webs Members
Webs Web Service

Other Resources

Introduction to Columns