Метод SPSite.GetWebTemplates (UInt32)

Возвращает коллекцию определений сайтов, которые доступны для создания веб-сайтов в семействе сайтов.

Пространство имен:  Microsoft.SharePoint
Сборка:  Microsoft.SharePoint (в Microsoft.SharePoint.dll)

Синтаксис

'Декларация
Public Function GetWebTemplates ( _
    LCID As UInteger _
) As SPWebTemplateCollection
'Применение
Dim instance As SPSite
Dim LCID As UInteger
Dim returnValue As SPWebTemplateCollection

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

Параметры

  • LCID
    Тип: System.UInt32

    32-Разрядных целых, задающий язык определения сайта для возвращения из коллекции.

Возвращаемое значение

Тип: Microsoft.SharePoint.SPWebTemplateCollection
SPWebTemplateCollection объект, представляющий определения сайта.

Замечания

Определения сайтов, возвращаемых методом GetWebTemplates включают в себя определения сайтов, которые доступны по умолчанию устанавливаются в каталоге установки (\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE) на каждом сервере и те, которые хранятся в базе данных конфигурации с помощью программы командной строки операции stsadm -o addtemplate.

Обратите внимание на то, что в конкретном случае указанного настраиваемого определения сайта не найден. Этот сценарий возникает, когда происходит следующая последовательность действий:

  1. Добавьте решение, которое состоит из шаблонов сайтов и функций.

  2. Создайте веб-приложение.

  3. Развертывание решения, включая развертывание библиотеки DLL приложения в каталог bin веб-приложения, созданного.

  4. Создание нового семейства сайтов на основе настраиваемого определения сайта, который был развернут в веб-приложение.

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.

См. также

Справочные материалы

SPSite класс

Элементы SPSite

Перегрузка GetWebTemplates

Пространство имен Microsoft.SharePoint