Поделиться через


Класс Web

Represents a Microsoft SharePoint Foundation Web site.

Иерархия наследования

System.Object
  Microsoft.SharePoint.Client.ClientObject
    Microsoft.SharePoint.Client.SecurableObject
      Microsoft.SharePoint.Client.Web

Пространство имен:  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 Web _
    Inherits SecurableObject
'Применение
Dim instance As Web
public class Web : SecurableObject

Замечания

Many methods and properties in the Microsoft.SharePoint.Client namespace can return a single website. You can use the Webs property of the Web class to return all the immediate child websites beneath a website, excluding children of those child websites. You can also use the AllWebs property of the Site class to return all websites within the site collection; or use the GetSubwebsForCurrentUser() method of Web to return all websites for the current user.

Use an indexer to return a single website from the collection. For example, if the collection is assigned to a variable named collWebSites, use collWebSites[index] in C#, or collWebSites(index) in Visual Basic, where index is the index number of the site in the collection, the display name of the website, or the GUID for the site.

Примеры

This code example displays information about a subweb.

using System;
using Microsoft.SharePoint.Client;

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

            ClientContext clientContext = new ClientContext(siteUrl);
            Web site = clientContext.Web;

            clientContext.Load(site);
            clientContext.ExecuteQuery();

            Console.WriteLine("Site information: \n\n");
            Console.WriteLine("Title: {0}", site.Title);
            Console.WriteLine("ID: {0}", site.Id);
            Console.WriteLine("Language: {0}", site.Language);
            Console.WriteLine("UI Version: {0}", site.UIVersion);
            Console.WriteLine("Description: {0}", site.Description);
            Console.WriteLine("Created: {0}", site.Created);
        }
    }
}

Потокобезопасность

Любые общедоступные элементы static (Shared в Visual Basic) этого типа являются потокобезопасными. Не гарантируется, что любые элементы экземпляров потокобезопасны.

См. также

Справочные материалы

Элементы Web

Пространство имен Microsoft.SharePoint.Client