Share via


SPSite.GetWebTemplates-Methode (UInt32)

Gibt die Auflistung von Websitedefinitionen, die zum Erstellen von Websites innerhalb der Websitesammlung verfügbar sind.

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

Syntax

'Declaration
Public Function GetWebTemplates ( _
    LCID As UInteger _
) As SPWebTemplateCollection
'Usage
Dim instance As SPSite
Dim LCID As UInteger
Dim returnValue As SPWebTemplateCollection

returnValue = instance.GetWebTemplates(LCID)
public SPWebTemplateCollection GetWebTemplates(
    uint LCID
)

Parameter

  • LCID
    Typ: System.UInt32

    Eine 32-Bit-Ganzzahl, die angibt, die Sprache von den Websitedefinitionen aus der Auflistung zurückgegeben.

Rückgabewert

Typ: Microsoft.SharePoint.SPWebTemplateCollection
Ein SPWebTemplateCollection -Objekt, die Websitedefinitionen darstellt.

Hinweise

Die Websitedefinitionen, die von der GetWebTemplates -Methode zurückgegeben werden umfassen Websitedefinitionen, die standardmäßig, die in der Setup-Verzeichnis (\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE) von jedem Server installiert sind, und die, die in der Konfigurationsdatenbank über die Befehlszeilenvorgang stsadm -o addtemplategespeichert wurden verfügbar sind.

Beachten Sie, dass in einem bestimmten Szenario die angegebenen benutzerdefinierten Websitedefinition nicht gefunden wird. In diesem Szenario tritt ein, die in der folgenden Sequenz von Aktionen beim auftreten:

  1. Fügen Sie eine Lösung, die von Websitevorlagen und Features besteht.

  2. Erstellen Sie eine Webanwendung.

  3. Bereitstellen der Lösung, einschließlich der Bereitstellung der Anwendung DLLs in das Verzeichnis bin der neu erstellten Webanwendung.

  4. Erstellen einer neuen Websitesammlung, die auf die benutzerdefinierte Websitedefinition basiert, die in der Webanwendung bereitgestellt wurde.

When this sequence occurs, steps 1, 2, and 3 work fine, but when step 4 is called the application does not find the site definition for the newly deployed site. However, if you stop after step 3, then re-run the application and then call step 4 by itself, the proper custom site definition is found without any problems. The original problem is caused because site templates are cached when a new Web application is created. Therefore, if a custom site definition is deployed with a new Web application, it will not be found because it is not yet in the cache.

There are four ways to work around this problem.

  1. Call all the first three steps, as described above, and then re-run the application and call only step 4. This restarts the process and allows the Web application to locate the deployed custom site definition.

  2. Create a console application that creates a site collection using the template for the custom site definition. Then, call the sequence of four steps that are listed above; however, when you come to step 4 (create site collection), load the console executable that you created in a different process and allow it to complete step 4.

  3. Use the Stsadm.exe command in the code itself. In this approach, the Web application is able to locate the newly deployed custom site definition.

  4. Add and deploy the solution manually by using the SharePoint UI, or by using the Stsadm.exe command prompt.

Siehe auch

Referenz

SPSite Klasse

SPSite-Member

GetWebTemplates-Überladung

Microsoft.SharePoint-Namespace