PowerShell kullanarak SharePoint'te İçerik Türü Merkezi oluşturma


SharePoint'teki İçerik türü merkezi, içerik türlerini yönetmek için merkezi bir konumdur. İçerik türü hub'ına abone olan herhangi bir web uygulaması bu mağazadaki içerik türlerini kullanabilir. Merkezi Yönetim web kullanıcı arayüzünü kullanarak SharePoint'te bir içerik türü merkezi oluşturma başka bir makalede açıklanmaktadır: SharePoint 2013'te İçerik Türü Merkezi Nasıl Oluşturulur?, Şimdi PowerShell kullanarak SharePoint 2013'te bir içerik türü merkezi oluşturalım.

SharePoint'te İçerik Türü Merkezi Oluşturmak için PowerShell Komut Dosyası:

SharePoint'te içerik türü merkezi oluşturmak üç adımdan oluşur:

  1. İçerik türü merkezi için açık bir Yönetilen yol oluşturun (isteğe bağlı)
  2. İçerik türü merkezi için üst düzey bir site koleksiyonu oluşturun
  3. İçerik türü hub dağıtım özelliğini etkinleştirin
  4. MMS Hizmet Uygulamasında İçerik Türü Hub URL'sini Ayarlama

PowerShell kullanarak SharePoint 2013'te içerik türü merkezi oluşturmak için kullanılan komut dosyası:


Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

#Configuration Parameters
$WebAppURL="https://intranet.crescent.com"
$ManagedPath="CTypeHub"
$HubOwner="Crescent\SPAdmin"

$WebApp = Get-SPWebApplication $WebAppURL

###  Step 1: Create Managed Path ###
#Check if the managed path exist already
$ManagedPathExists = Get-SPManagedPath -WebApplication $WebAppURL -Identity $ManagedPath -ErrorAction SilentlyContinue
 
 if ($ManagedPathExists -eq $null)
 {
    #Go ahead and create the managed path
    $CTypeHubPath=New-SPManagedPath -RelativeURL $ManagedPath -WebApplication $WebAppURL -Explicit
    Write-host "Managed Path Created!" -f Green
 }
 else
 {
    Write-Host "Managed path $ManagedPath already exists!" -f Yellow
 }

###  Step 2: Create Site Collection for Content type hub ###
#Check if ContentType hub site already exists
$CTypeHubURL = $WebAppURL+"/"+$ManagedPath

$CTypeHubExists = Get-SPSite $CTypeHubURL -ErrorAction SilentlyContinue

if($CTypeHubExists -eq $null)
{
    #Create site collection
    $CTypeHub = New-SPSite -Url $CTypeHubURL -Template 'STS#0' -OwnerAlias $HubOwner -Name "Content Type hub" 
}
else
 {
    Write-Host "Content Type Hub Site $CTypeHubURL already exists!" -f Yellow
 }

###  Step 3: Activate Content Type hub feature  ###
#Check if ContentType hub feature is already enabled
$Feature = Get-SPFeature -site $CTypeHubURL -Identity "ContentTypeHub" -ErrorAction SilentlyContinue 

If($Feature -eq $null) 
{      
    #Activate feature
    Enable-SPFeature -Identity "ContentTypeHub" -url $CTypeHubURL -Force -ErrorAction SilentlyContinue 
    Write-Host "Activated Content Type hub feature" -F Green 
}
else
{
    write-host "Content Type Hub Feature already enabled!" -F Yellow
}
###  Step 4: Set Content Type Hub URL in MMS Service App
#Set the Content Type Hub URL in MMS Application
$MMS = Get-SPServiceApplication | Where-Object {$_.TypeName -eq "Managed Metadata Service"}  

Set-SPMetadataServiceApplication -Identity $MMS -HubUri $CTypeHubURL

#Update the Managed Metadata Service Proxy to consume from the content type hub
$MMSProxy = Get-SPServiceApplicationProxy | Where-Object {$_.TypeName -eq "Managed Metadata Service Connection"}

Set-SPMetadataServiceApplicationProxy -Identity $MMSProxy -ContentTypeSyndicationEnabled -ContentTypePushdownEnabled

Yönetilen Meta Veri hizmeti uygulamasında içerik türü hub URL'sini değiştirmeyle ilgili başka bir gönderi: PowerShell kullanarak Meta Veri Hizmeti Uygulamasını Yönetme İçerik Türü Merkezini Değiştirme

İlgili makaleler