Share via


Webs.GetColumns method

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

Namespace:  WebSvcWebs
Assembly:  STSSOAP (in STSSOAP.dll)

Syntax

'Declaration
<SoapDocumentMethodAttribute("https://schemas.microsoft.com/sharepoint/soap/GetColumns", RequestNamespace := "https://schemas.microsoft.com/sharepoint/soap/",  _
    ResponseNamespace := "https://schemas.microsoft.com/sharepoint/soap/",  _
    Use := SoapBindingUse.Literal, ParameterStyle := SoapParameterStyle.Wrapped)> _
Public Function GetColumns As XmlNode
'Usage
Dim instance As Webs
Dim returnValue As XmlNode

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

Return value

Type: System.Xml.XmlNode
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="https://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="https://schemas.microsoft.com/sharepoint/v3/fields" 
    StaticName="_DCDateModified" 
    Description="The date on which this resource was last modified" 
    xmlns="https://schemas.microsoft.com/sharepoint/soap/" />
</Fields>

Remarks

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

Examples

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

WebSvcWebs namespace

Other resources

Introduction to Columns