PowerShell kullanarak SharePoint'te Belge Kitaplığı oluşturma
Gereksinim: PowerShell'i kullanarak SharePoint 2013/2016'da bir belge kitaplığı oluşturun.
SharePoint'te Yeni Belge Kitaplığı Oluşturmak için PowerShell Komut Dosyası:
PowerShell kullanarak SharePoint'te belge kitaplığı oluşturmanın bir yolunu mu arıyorsunuz? Bu yazıda size SharePoint'te yeni bir belge kitaplığı oluşturmak için PowerShell'i nasıl kullanacağınızı göstereceğim. Bu, belge kitaplıkları oluşturma sürecini otomatikleştirmek için yararlı olabilir.
PowerShell kullanarak SharePoint 2013'te belge kitaplığının nasıl oluşturulacağı aşağıda açıklanmıştır:
Add-PSSnapin Microsoft.SharePoint.Powershell -ErrorAction SilentlyContinue
#PowerShell Function to Create a Document Library in SharePoint
Function Create-DocumentLibrary
{
Param
(
[Microsoft.SharePoint.SPWeb]$Web,
[String] $LibraryName,
[String] $Description
)
#Get the Document Library template
$ListTemplate = [Microsoft.Sharepoint.SPListTemplateType]::DocumentLibrary
#Check if the library already exists
if(($web.Lists.TryGetList($LibraryName)) -eq $null)
{
#Create the Library
$Web.Lists.Add($LibraryName,$Description,$ListTemplate) > Null
#Set Properties of Library such as OnQuickLaunch, etc
$Library = $Web.Lists[$LibraryName]
$Library.OnQuickLaunch = $true
$Library.Update()
Write-Host "Document library created successfully!" -f Green
}
else
{
Write-Host "Document Library '$LibraryName' already exists!" -f Red
}
}
#Get the Web
$web = Get-SPWeb "https://intranet.crescent.com/"
#Call the function to create a library
Create-DocumentLibrary $web "Team Documents" "Library to Share Team Documents"
Bu PowerShell betiği, SharePoint 2013'te bir belge kitaplığı oluşturur.
