Click to Rate and Give Feedback
MSDN
MSDN Library
Web Development
SDK Documentation
Web Services
Webs Web Service
Webs Class
Webs Methods
 GetColumns Method
Community Content
In this section
Statistics Annotations (0)
Collapse All/Expand All Collapse All
Webs.GetColumns Method (Webs)
Returns a collection of the column definitions for the columns available on the site.

Web Service: WebsWeb Reference: http://<Site>/_vti_bin/Webs.asmx
Visual Basic (Declaration)
<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
Visual Basic (Usage)
Dim instance As Webs
Dim returnValue As XmlNode

returnValue = instance.GetColumns
C#
[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.
Xml
<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>

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

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

Visual Basic
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
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement | Site Feedback
Page view tracker