Views.GetViewCollection Method
Returns the display names, internal names, and URLs for the collection of views of the specified list.
Namespace: [Views Web service]
Web service reference: http://Site/_vti_bin/Views.asmx
Syntax
'Declaration
<SoapDocumentMethodAttribute("https://schemas.microsoft.com/sharepoint/soap/GetViewCollection", RequestNamespace := "https://schemas.microsoft.com/sharepoint/soap/", _
ResponseNamespace := "https://schemas.microsoft.com/sharepoint/soap/", _
Use := SoapBindingUse.Literal, ParameterStyle := SoapParameterStyle.Wrapped)> _
Public Function GetViewCollection ( _
listName As String _
) As XmlNode
'Usage
Dim instance As Views
Dim listName As String
Dim returnValue As XmlNode
returnValue = instance.GetViewCollection(listName)
[SoapDocumentMethodAttribute("https://schemas.microsoft.com/sharepoint/soap/GetViewCollection", RequestNamespace = "https://schemas.microsoft.com/sharepoint/soap/",
ResponseNamespace = "https://schemas.microsoft.com/sharepoint/soap/",
Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
public XmlNode GetViewCollection(
string listName
)
Parameters
listName
Type: System.StringA string that contains the internal name of the list.
Return Value
Type: System.Xml.XmlNode
A fragment in Introduction to Collaborative Application Markup Language (CAML) in the following form that contains the view properties and can be assigned to a System.Xml.XmlNode object.
<GetViewCollectionResult>
<Views>
<View DisplayName="Allitems" Name="{C1036607-EC8A-11d3-82AA-0050048394B0}"
Url="List\Events\Allitems.aspx" />
<View DisplayName="Summary" Name="{F1036607-EC8A-11d3-82AA-5556047394B0}"
Url="List\Events\Summary.aspx" />
...
</Views>
</GetViewCollectionResult>
Examples
The following code example uses the GetViewCollection method to display information about the views for a list. This example requires that a using (C#) or Imports (Microsoft Visual Basic) directive be included for the System.Xml namespace.
Dim viewService As New Web_Reference_Folder.Views()
viewService.Credentials = System.Net.CredentialCache.DefaultCredentials
Dim node As XmlNode = viewService.GetViewCollection("List_Name")
MessageBox.Show(node.OuterXml)
Web_Reference_Folder.Views viewService = new Web_Reference_Folder.Views();
viewService.Credentials= System.Net.CredentialCache.DefaultCredentials;
XmlNode node = viewService.GetViewCollection("List_Name");
MessageBox.Show(node.OuterXml);