Export (0) Print
Expand All
Expand Minimize
This topic has not yet been rated - Rate this topic

SPWeb.Created Property

Windows SharePoint Services 3

Gets a date and time value that indicates when the site was created.

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 Windows SharePoint Services.

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 Best Practices: Using Disposable Windows SharePoint Services Objects.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2014 Microsoft. All rights reserved.