Web.GetSubwebsForCurrentUser 方法

Returns the collection of child sites of the current site based on the specified query.

命名空间:  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 Function GetSubwebsForCurrentUser ( _
    query As SubwebQuery _
) As WebCollection
用法
Dim instance As Web
Dim query As SubwebQuery
Dim returnValue As WebCollection

returnValue = instance.GetSubwebsForCurrentUser(query)
public WebCollection GetSubwebsForCurrentUser(
    SubwebQuery query
)

参数

返回值

类型:Microsoft.SharePoint.Client.WebCollection
Returns WebCollection.

备注

If the query is not valid, the server must return an empty collection.

示例

This code example displays the titles of the child sites of the specified site.

using System;
using Microsoft.SharePoint.Client;

namespace Microsoft.SDK.SharePointFoundation.Samples
{
    class WebGetSubwebsExample
    {
        static void Main()
        {
            string siteUrl = "http://MyServer/sites/MySiteCollection";

            ClientContext clientContext = new ClientContext(siteUrl);
            Web site = clientContext.Web;
            WebCollection collWeb = site.GetSubwebsForCurrentUser(null);

            clientContext.Load(collWeb);
            clientContext.ExecuteQuery();

            Console.WriteLine("Child sites: \n\n");
            foreach (Web oneWeb in collWeb)
               Console.WriteLine(oneWeb.Title);
        }
    }
}

另请参阅

引用

Web 类

Web 成员

Microsoft.SharePoint.Client 命名空间