Класс View
Specifies a list view.
Иерархия наследования
System.Object
Microsoft.SharePoint.Client.ClientObject
Microsoft.SharePoint.Client.View
Пространство имен: Microsoft.SharePoint.Client
Сборки: Microsoft.SharePoint.Client.Silverlight (в Microsoft.SharePoint.Client.Silverlight.dll); Microsoft.SharePoint.Client.Phone (в Microsoft.SharePoint.Client.Phone.dll) Microsoft.SharePoint.Client (в Microsoft.SharePoint.Client.dll)
Синтаксис
'Декларация
Public Class View _
Inherits ClientObject
'Применение
Dim instance As View
public class View : ClientObject
Замечания
Use the DefaultView property of the List class to return the default view for a list, or the GetView() method to return a specified view. Use the GetViewFromUrl() method of the Web class to return a view for a list within a site, and use the View() property of the ViewFieldCollection class to get the parent view of the collection of view fields. Otherwise, use the Views property of the List class to return the collection of views for a list or the parent collection of views for a view.
Use an indexer to return a single view from a collection of views. For example, if the collection is assigned to a variable named collViews, use collViews[index] in C#, or collViews(index) in Visual Basic, where index is the index number of the view in the collection, the name of the view, or the GUID for the view.
Примеры
This code example orders the items on the Tasks list of the specified site in descending alphabetic order.
using System;
using Microsoft.SharePoint.Client;
namespace Microsoft.SDK.SharePointFoundation.Samples
{
class ViewExample
{
static void Main()
{
string siteUrl = "http://MyServer/sites/MySiteCollection";
ClientContext clientContext = new ClientContext(siteUrl);
Web site = clientContext.Web;
List targetList = site.Lists.GetByTitle("Tasks");
ViewCollection collView = targetList.Views;
View targetView = collView.GetByTitle("All Tasks");
string strQuery = "<OrderBy><FieldRef Name=\'Title\' Ascending=\'False\' /></OrderBy>";
targetView.ViewQuery = strQuery;
targetView.Update();
clientContext.ExecuteQuery();
Console.WriteLine("Tasks list ordered in descending alphabetic order.");
}
}
}
Потокобезопасность
Любые общедоступные элементы static (Shared в Visual Basic) этого типа являются потокобезопасными. Не гарантируется, что любые элементы экземпляров потокобезопасны.