SharePoint Online: PowerShell'i kullanarak Kullanıma Alma Gerektir Seçeneğini Yapılandırma


Gereksinim: SharePoint Online'da zorunlu kullanıma alma ayarlarını yapılandırın.

SharePoint Online'daki kullanıma almayı zorunlu kıl seçeneği, birden fazla kullanıcı aynı anda bir belgeyi açmaya ve düzenlemeye çalıştığında kaydetme çakışmalarını önlemeye yardımcı olur. Temel olarak Teslim Alma, bir belgenin diğer kullanıcılar tarafından düzenlenmesini engellemenin hızlı bir yoludur.

SharePoint Online'da Belge Kitaplıkları için Kullanıma Alma Gerektirme Nasıl Etkinleştirilir?

Varsayılan olarak “Ödeme iste” seçeneği KAPALI durumdadır. Bir belge kitaplığı için kullanıma alma gereksinimi seçeneğini AÇIK veya KAPALI duruma getirebiliriz. İşte nasıl:

  1. SharePoint Online belge kitaplığınıza gidin.
  2. Ayarlar dişlisine tıklayın >> “Kütüphane Ayarları”nı seçin
  3. Belge Kitaplığı Ayarları sayfasında Sürüm oluşturma ayarlarına tıklayın
  4. Sayfanın en altına doğru kaydırın. Kullanıma Alma Gereksin bölümünün altında, "Belgelerin düzenlenmeden önce teslim alınması istensin mi?" sorusu için "Evet"i seçin. Çıkışı etkinleştirme seçeneği. Benzer şekilde, SharePoint Online'da teslim almayı devre dışı bırakmak için “Hayır” seçeneğini seçin.

  5. Değişikliklerinizi kaydetmek için “Tamam”a tıklayın.

Bu, belge kitaplığının kullanıma alınmasını zorunlu kılar. SharePoint Online site koleksiyonundaki tüm belge kitaplıkları için kullanıma alma zorunluluğunu etkinleştirmek veya devre dışı bırakmak isterseniz ne olur? Bunu web kullanıcı arayüzünden yapmanın bir yolu yok.

PowerShell, SharePoint Online'da Kullanıma Alma Gerektirmeyi Ayarlayacak

Bu PowerShell betiği, SharePoint Online'da belirli bir site koleksiyonundaki tüm belge kitaplıkları için Kullanıma Alma Gerektirmeyi etkinleştirir:


#Load SharePoint CSOM 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"
 
Function Set-SPORequireCheckout([String] $SiteURL,[Boolean] $RequireCheckout)
{
    Try {
        #Setup the context
        $Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
        $Ctx.Credentials = $Credentials
          
        #Get the web and Its subsites from given URL
        $Web = $Ctx.web
        $Ctx.Load($Web)
        $Ctx.Load($Web.Lists)
        $Ctx.Load($web.Webs)
        $Ctx.executeQuery()
  
        #Filter Document Libraries from Lists collection
        $DocumentLibraries = $Web.Lists | Where {$_.BaseType -eq "DocumentLibrary" -and $_.Hidden -eq $False}
 
        Write-host -f Yellow "Processing Site:" $SiteURL
        #Loop through each document library and set require checkout option
        Foreach ($DocumentLibrary in $DocumentLibraries)
        {
            #Require documents to be checked out before they can be edited 
            $DocumentLibrary.ForceCheckout=$RequireCheckout
            $DocumentLibrary.Update()
            $Ctx.ExecuteQuery() 
            Write-host -f Green "`t Require Checkout has been Configured for" $DocumentLibrary.Title
        }
   
        #Iterate through each subsite of the current web
        ForEach ($Subweb in $Web.Webs)
        {
            #Call the function recursively
            Set-SPORequireCheckout $Subweb.url $RequireCheckout
        }
    }
    Catch {
        write-host -f Red "Error:" $_.Exception.Message
    }
}
 
#Config Parameters
$SiteCollURL="https://Crescent.sharepoint.com"
$RequireCheckout = $True

#Setup Credentials to connect
$Cred= Get-Credential
$Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.Username, $Cred.Password)

#Call the function to Set Require Checkout for All document libraries in the site collection
Set-SPORequireCheckout $SiteCollURL $RequireCheckout

SharePoint Online'da Ödeme Nasıl Devre Dışı Bırakılır?

Bir belge kitaplığı için “Ödemeyi zorunlu kıl” seçeneği zaten etkinse, bu PnP PowerShell betiğiyle bunu bir site koleksiyonundaki tüm kitaplıklar için toplu olarak devre dışı bırakabiliriz.


#Function to Disable Checkout Option for all libraries in a web
Function Disable-PnPRequireCheckout
{
    param
    (
        [parameter(Mandatory = $true, ValueFromPipeline = $True)]$Web
    )
      
    Try {
        Write-host "Processing Web:"$Web.URL -f Magenta
        Connect-PnPOnline -Url $Web.URL -Interactive

        #Array to exclude system libraries
        $SystemLibraries = @("Form Templates", "Pages", "Preservation Hold Library","Site Assets", "Site Pages", "Images",
                            "Site Collection Documents", "Site Collection Images","Style Library","Drop Off Library")
          
        $Libraries = Get-PnPList -Includes BaseType, Hidden, EnableVersioning -ErrorAction Stop
        #Get All document libraries
        $DocumentLibraries = $Libraries | Where {$_.BaseType -eq "DocumentLibrary" -and $_.Hidden -eq $False -and $_.Title -notin $SystemLibraries}
          
        #Disable Checkout
        ForEach($Library in $DocumentLibraries)
        {
            If($Library.ForceCheckout)
            {
                #Powershell to disable checkout for the library
                Set-PnPList -Identity $Library -ForceCheckout $false
                Write-host -f Green "`tRequire Check-out disabled on '$($Library.Title)'"
            }
            Else
            {
                Write-host -f Yellow "`tRequire Check Out is already set to 'No' at '$($Library.Title)'"
            }
        }
    }
    Catch {
        Write-host -f Red "`tError:" $_.Exception.Message
    }
}
   
#Parameters
$SiteURL = "https://crescent.sharepoint.com/sites/marketing"
 
#Connect to PnP Online
Connect-PnPOnline -URL $SiteURL -Interactive
 
#Call the function for each web
Get-PnPSubWeb -Recurse -IncludeRootWeb | ForEach-Object { Disable-PnPRequireCheckout $_ }

SharePoint'te kullanıma almayı zorunlu kıl seçeneğinin ayarlanmasını tartışan başka bir makale: SharePoint'te kullanıma almayı zorunlu kılmayı yapılandırma

İlgili makaleler