Web Class

Represents a Microsoft SharePoint Foundation Web site.

Inheritance Hierarchy

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

Namespace:  Microsoft.SharePoint.Client
Assemblies:   Microsoft.SharePoint.Client.Silverlight (in Microsoft.SharePoint.Client.Silverlight.dll);  Microsoft.SharePoint.Client (in Microsoft.SharePoint.Client.dll)

Syntax

'Declaration
<ScriptTypeAttribute("SP.Web", ServerTypeId := "{a489add2-5d3a-4de8-9445-49259462dceb}")> _
Public Class Web _
    Inherits SecurableObject
'Usage
Dim instance As Web
[ScriptTypeAttribute("SP.Web", ServerTypeId = "{a489add2-5d3a-4de8-9445-49259462dceb}")]
public class Web : SecurableObject

Examples

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);
        }
    }
}

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

Web Members

Microsoft.SharePoint.Client Namespace