SPWeb.Created property

Gets or sets a date and time value that indicates when the site was created. (Read-only in sandboxed solutions.)

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

public DateTime Created { get; set; }

Property value

Type: System.DateTime
A System.DateTime object that indicates when the site was created, specified in Coordinated Universal Time (UTC) format and not in system time or time zone settings in Microsoft SharePoint Foundation.

The Created property applies only to sites that are returned by using one of the GetSubwebsForCurrentUser methods of the SPWeb class. It returns an SPException object if it is applied to a site collection that is not obtained by using one of these methods.

The following code example displays the name and creation date of each subsite within a specified site collection of which the current user is a member.

This example requires using directives (Imports in Microsoft Visual Basic) for the Microsoft.SharePoint namespace and the Microsoft.SharePoint.Utilities namespace.

using (SPSite oSiteCollection = new SPSite("http://Server_Name/sites/Site_Name"))
    SPWebCollection collWebsites = oSiteCollection.OpenWeb().GetSubwebsForCurrentUser(); 

    for (int intIndexWebsites = 0; intIndexWebsites < collWebsites.Count; intIndexWebsites++)
        Response.Write(SPEncode.HtmlEncode(collWebsites[intIndexWebsites].Name) + " :: " +  collWebsites[intIndexWebsites].Created.ToString() + "<BR>");


Certain objects implement the IDisposable interface, and you must avoid retaining these objects in memory after they are no longer needed. For information about good coding practices, see Disposing Objects.