Web.GetAvailableWebTemplates - Méthode
Returns a collection of site templates available for the site.
Espace de noms : Microsoft.SharePoint.Client
Assemblys : Microsoft.SharePoint.Client.Silverlight (dans Microsoft.SharePoint.Client.Silverlight.dll); Microsoft.SharePoint.Client.Phone (dans Microsoft.SharePoint.Client.Phone.dll) Microsoft.SharePoint.Client (dans Microsoft.SharePoint.Client.dll)
Syntaxe
'Déclaration
Public Function GetAvailableWebTemplates ( _
lcid As UInteger, _
doIncludeCrossLanguage As Boolean _
) As WebTemplateCollection
'Utilisation
Dim instance As Web
Dim lcid As UInteger
Dim doIncludeCrossLanguage As Boolean
Dim returnValue As WebTemplateCollection
returnValue = instance.GetAvailableWebTemplates(lcid, _
doIncludeCrossLanguage)
public WebTemplateCollection GetAvailableWebTemplates(
uint lcid,
bool doIncludeCrossLanguage
)
Paramètres
lcid
Type : System.UInt32Specifies the LCID of the site templates to be retrieved.
If the specified LCID is not a valid LCID, the server must return an empty collection.
An LCID is a 4-byte value. The value supplied in an LCID is a standard numeric substitution for the international [RFC4646] string.
doIncludeCrossLanguage
Type : System.BooleanSpecifies whether to include language-neutral site templates.
Valeur renvoyée
Type : Microsoft.SharePoint.Client.WebTemplateCollection
Returns a WebTemplateCollection instance representing collection of site templates available for the site.
Exceptions
Exception | Condition |
---|---|
UnauthorizedAccessException | The current user has insufficient permissions. Error code: -2147024891. |
Remarques
In some instances, the specified custom site definition is not found because the custom site definition is not yet in the cache. This occurs when the following steps are made to create a new site collection based on the custom site definition:
Add a solution that consists of site templates and features.
Create a web application.
Deploy the solution, including deployment of the application DLLs to the bin directory of the newly created web application.
Create a new site collection that is based on the custom site definition that was deployed to the web application.
When this sequence occurs, steps 1, 2, and 3 work as expected, but when step 4 is performed, the application does not find the site definition for the newly deployed site. The issue arises because site templates are cached when a new web application is created.
There are four ways to work around this issue.
Perform the first three steps, as described above, run the application, and then perform step 4. This restarts the process and allows the Web application to locate the deployed custom site definition.
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 program that you created in a different process and allow it to complete step 4.
Use the SharePoint Management Shell in the code itself. The web application is able to locate the newly deployed custom site definition.
Add and deploy the solution manually by using the SharePoint UI, or by using the SharePoint Management Shell.