Obtenga plantillas de sitio en SharePoint Online usando PowerShell
Requisito: Obtener plantillas de sitio en SharePoint Online mediante PowerShell.
¿Cómo obtener plantillas de sitios en SharePoint Online?
Las plantillas de sitio son los componentes básicos de los sitios en SharePoint Online. Definen la estructura, los datos, la funcionalidad y la apariencia del sitio. SharePoint Online proporciona diferentes plantillas de sitio listas para usar para crear sitios rápidamente. La sección "Selección de plantilla" en la página de creación de sitio le brinda la lista de plantillas de sitio en SharePoint Online.
- Inicie sesión en el Centro de administración de SharePoint https://Sudominio-admin.sharepoint.com/ >> Expandir Sitios >> Sitios activos.
- Haga clic en el botón "Crear" en la barra de herramientas >> Elija "Otras opciones".
- Haga clic en "Elegir plantilla" y luego seleccione "Más plantillas" en el menú desplegable.
- Esto lo llevará a la página de creación del sitio Clásico para seleccionar entre una variedad de plantillas.
Necesita la plantilla del sitio para crear sitios en SharePoint. Elegir la plantilla del sitio desde la interfaz de usuario web está bien, pero ¿cómo obtener las plantillas del sitio en SharePoint Online desde PowerShell?
PowerShell para obtener la plantilla del sitio en SharePoint Online
Necesita el ID de la plantilla del sitio al crear un sitio o una colección de sitios en SharePoint Online. Aquí está PowerShell para obtener plantillas de sitios en SharePoint Online, y el cmdlet Get-SPOWebTemplate le brinda la lista de plantillas de sitios de SharePoint Online.
#Variables for Admin Center & Site Collection URL
$AdminCenterURL = "https://crescent-admin.sharepoint.com/"
#Connect to SharePoint Online
Connect-SPOService -url $AdminCenterURL -Credential (Get-Credential)
#Get site template list
Get-SPOWebTemplate
Esto recupera la lista de ID de plantilla de sitio de SharePoint Online para PowerShell:
Si bien el cmdlet de PowerShell anterior le brinda la lista de todas las plantillas de sitios OOTB, ¿cómo obtener plantillas de sitios personalizadas?
SharePoint Online: obtenga plantillas de sitio personalizadas mediante PowerShell
A continuación se explica cómo obtener plantillas de sitios en SharePoint Online usando PowerShell:
#Load SharePoint Online Assemblies
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll"
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"
#Set parameter values
$SiteURL = "https://crescenth.sharepoint.com"
$Cred= Get-Credential
$Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.Username, $Cred.Password)
#Setup the context
$Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
$Ctx.Credentials = $Credentials
#Get the Custom Site Template
$SiteTemplates = $Ctx.Site.GetWebTemplates("1033","0")
$Ctx.Load($SiteTemplates)
$Ctx.ExecuteQuery()
#Remove all users from the group
ForEach($Template in $SiteTemplates)
{
$Template | Select Name, ID, Description
}
PnP PowerShell para obtener plantillas de sitios de SharePoint Online
El cmdlet "Get-PnPWebTemplates" de SharePoint Online recupera todas las plantillas web predeterminadas. Usemos PnP PowerShell para obtener plantillas de sitios en SharePoint en línea, incluidas plantillas de sitios personalizadas.
#Config Variables
$SiteURL = "https://Crescent.sharepoint.com/"
#Connect to PnP Online
Connect-PnPOnline -Url $SiteURL -Interactive
#Get the Context & Web Objects
$ClientContext = Get-PnPContext
$Web = Get-PnPWeb
#Get All Web Templates
$WebTemplateCollection = $Web.GetAvailableWebTemplates(1033,0)
$ClientContext.Load($WebTemplateCollection)
$ClientContext.ExecuteQuery()
#Get the Template Name and Title
$WebTemplateCollection | Select ID, Name, Title
Esto le proporciona la lista de ID de plantilla de sitio de SharePoint Online mediante PnP PowerShell.
Lista de ID de plantilla de sitio de SharePoint Online para PowerShell
Aquí está la lista de plantillas, junto con su ID, disponibles en SharePoint Online:
| Id | Name | Title |
|---|---|---|
| 0 | GLOBAL#0 | Global template |
| 1 | STS#3 | Team site (no Microsoft 365 group) |
| 1 | STS#0 | Team site (classic experience) |
| 1 | STS#1 | Blank Site |
| 1 | STS#2 | Document Workspace |
| 2 | MPS#0 | Basic Meeting Workspace |
| 2 | MPS#1 | Blank Meeting Workspace |
| 2 | MPS#2 | Decision Meeting Workspace |
| 2 | MPS#3 | Social Meeting Workspace |
| 2 | MPS#4 | Multipage Meeting Workspace |
| 3 | CENTRALADMIN#0 | Central Admin Site |
| 4 | WIKI#0 | Wiki Site |
| 9 | BLOG#0 | Blog |
| 15 | SGS#0 | Group Work Site |
| 16 | TENANTADMIN#0 | Tenant Admin Site |
| 17 | APP#0 | App Template |
| 18 | APPCATALOG#0 | App Catalog Site |
| 2764 | ACCSRV#0 | Access Services Site |
| 2757 | ACCSVC#0 | Access Services Site Internal |
| 2757 | ACCSVC#1 | Access Services Site |
| 7 | BDR#0 | Document Center |
| 6001 | CONTENTCTR#0 | Content Center |
| 3400 | TBH#0 | In-Place Hold Policy Center |
| 95 | DEV#0 | Developer Site |
| 3300 | EDISC#0 | eDiscovery Center |
| 3300 | EDISC#1 | eDiscovery Case |
| 1611 | EXPRESS#0 | Express Team Site |
| 10043 | FunSite#0 | SharePoint Online Tenant Fundamental Site |
| 14483 | OFFILE#0 | (obsolete) Records Center |
| 14483 | OFFILE#1 | Records Center |
| 2009 | EHS#0 | Express Hosted Site |
| 2009 | EHS#2 | Public Publishing Portal |
| 2009 | EHS#1 | Team Site – SharePoint Online configuration |
| 40 | OSRV#0 | Shared Services Administration Site |
| 3100 | PPSMASite#0 | PerformancePoint |
| 3200 | BICenterSite#0 | Business Intelligence Center |
| 6221 | PWA#0 | Project Web App Site |
| 6215 | PWS#0 | Microsoft Project Site |
| 6000 | REVIEWCTR#0 | Review Center |
| 301 | RedirectSite#0 | Redirect Site |
| 3500 | POLICYCTR#0 | Compliance Policy Center |
| 20 | SPS#0 | SharePoint Portal Server Site |
| 21 | SPSPERS#0 | SharePoint Portal Server Personal Space |
| 21 | SPSPERS#2 | Storage And Social SharePoint Portal Server Personal Space |
| 21 | SPSPERS#3 | Storage Only SharePoint Portal Server Personal Space |
| 21 | SPSPERS#4 | Social Only SharePoint Portal Server Personal Space |
| 21 | SPSPERS#5 | Empty SharePoint Portal Server Personal Space |
| 21 | SPSPERS#6 | Storage And Social SharePoint Portal Server Personal Space |
| 21 | SPSPERS#7 | Storage And Social SharePoint Portal Server Personal Space |
| 21 | SPSPERS#8 | Storage And Social SharePoint Portal Server Personal Space |
| 21 | SPSPERS#9 | Storage And Social SharePoint Portal Server Personal Space |
| 21 | SPSPERS#10 | Storage And Social SharePoint Portal Server Personal Space |
| 21 | SPSPERS#11 | Consumer OneDrive |
| 21 | SPSPERS#12 | JIT OneDrive Business |
| 22 | SPSMSITE#0 | Personalization Site |
| 30 | SPSTOC#0 | Contents area Template |
| 31 | SPSTOPIC#0 | Topic area template |
| 32 | SPSNEWS#0 | News Site |
| 39 | CMSPUBLISHING#0 | Publishing Site |
| 53 | BLANKINTERNET#0 | Publishing Site |
| 53 | BLANKINTERNET#1 | Press Releases Site |
| 53 | BLANKINTERNET#2 | Publishing Site with Workflow |
| 33 | SPSNHOME#0 | News Site |
| 34 | SPSSITES#0 | Site Directory |
| 36 | SPSCOMMU#0 | Community area template |
| 38 | SPSREPORTCENTER#0 | Report Center |
| 47 | SPSPORTAL#0 | Collaboration Portal |
| 50 | SRCHCEN#0 | Enterprise Search Center |
| 51 | PROFILES#0 | Profiles |
| 52 | BLANKINTERNETCONTAINER#0 | Publishing Portal |
| 54 | SPSMSITEHOST#0 | My Site Host |
| 56 | ENTERWIKI#0 | Enterprise Wiki |
| 6115 | PROJECTSITE#0 | Project Site |
| 59 | PRODUCTCATALOG#0 | Product Catalog |
| 62 | COMMUNITY#0 | Community Site |
| 63 | COMMUNITYPORTAL#0 | Community Portal |
| 64 | GROUP#0 | Team site |
| 65 | POINTPUBLISHINGHUB#0 | PointPublishing Hub |
| 66 | POINTPUBLISHINGPERSONAL#0 | Personal blog |
| 66 | POINTPUBLISHINGPERSONAL#1 | Personal blog |
| 67 | POINTPUBLISHINGTOPIC#0 | PointPublishing Topic |
| 68 | SITEPAGEPUBLISHING#0 | Communication site |
| 69 | TEAMCHANNEL#0 | Team Channel |
| 69 | TEAMCHANNEL#1 | Team Channel |
| 90 | SRCHCENTERLITE#0 | Basic Search Center |
| 90 | SRCHCENTERLITE#1 | Basic Search Center |
| 10100 | TenantAdminSpo#0 | SharePoint Online TenantAdmin |
| 30003 | TestSite#0 | Test Site |
| 61 | visprus#0 | Visio Process Repository |
| 1015 | SAPWorkflowSite#0 | SAP Workflow Site |
Si desea encontrar la plantilla de sitio de un sitio existente, utilice: ¿Cómo encontrar la plantilla de sitio en SharePoint Online usando PowerShell?

