SPSite.GetWebTemplates - Méthode (UInt32)

Renvoie la collection de définitions de site qui sont disponibles pour la création de sites Web au sein de la collection de sites.

Espace de noms :  Microsoft.SharePoint
Assembly :  Microsoft.SharePoint (dans Microsoft.SharePoint.dll)

Syntaxe

'Déclaration
Public Function GetWebTemplates ( _
    LCID As UInteger _
) As SPWebTemplateCollection
'Utilisation
Dim instance As SPSite
Dim LCID As UInteger
Dim returnValue As SPWebTemplateCollection

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

Paramètres

  • LCID
    Type : System.UInt32

    Un 32 bits entier non signé qui spécifie la langue des définitions de site pour renvoyer à partir de la collection.

Valeur renvoyée

Type : Microsoft.SharePoint.SPWebTemplateCollection
Objet SPWebTemplateCollection qui représente les définitions de site.

Remarques

Les définitions de site qui sont renvoyées par la méthode GetWebTemplates incluent les définitions de site qui sont disponibles par défaut, qui sont installés dans le répertoire d'installation (\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE) de chaque serveur et ceux qui ont été stockées dans la base de données de configuration par le biais de l' opération en ligne de commande stsadm -o addtemplate.

Notez que dans un scénario spécifique, la définition de site personnalisé spécifié est introuvable. Ce scénario se produit lorsque la séquence des actions suivante se produisent :

  1. Ajouter une solution qui se compose des fonctionnalités et modèles de sites.

  2. Créez une application Web.

  3. Déployer la solution, notamment le déploiement des DLL d'application dans le répertoire bin de l'application Web nouvellement créée.

  4. Créer une nouvelle collection de sites qui repose sur la définition de site personnalisée qui a été déployée pour l'application Web.

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.

Voir aussi

Référence

SPSite classe

SPSite - Membres

GetWebTemplates - Surcharge

Microsoft.SharePoint - Espace de noms