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 (Visual Basic のShared ) メンバーはいずれもスレッド セーフです。インスタンス メンバーはスレッド セーフになるという保証はありません。

関連項目

参照先

View メンバー

Microsoft.SharePoint.Client 名前空間