SPWeb.Created 属性

Gets or sets a date and time value that indicates when the site was created. (Read-only in 沙盒解决方案.)

命名空间:  Microsoft.SharePoint
程序集:  Microsoft.SharePoint(位于 Microsoft.SharePoint.dll 中)

语法

声明
Public Property Created As DateTime
    Get
    Set
用法
Dim instance As SPWeb
Dim value As DateTime

value = instance.Created

instance.Created = value
public DateTime Created { get; set; }

属性值

类型: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.

Dim siteCollection As New SPSite("http://Server_Name/sites/Site_Name")
Dim webSites As SPWebCollection = siteCollection.OpenWeb().GetSubwebsForCurrentUser()

For i  As  Integer = 0 To webSites.Count - 1
    Response.Write((SPEncode.HtmlEncode(webSites(i).Name) + " :: " + webSites(i).Created.ToString() + "<BR>"))

    webSites(i).Dispose()
Next
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>");

        collWebsites[intIndexWebsites].Dispose();
    }
}

备注

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.

另请参阅

引用

SPWeb 类

SPWeb 成员

Microsoft.SharePoint 命名空间