From acec70c8b959256e7aa2093666606ca9018eea11 Mon Sep 17 00:00:00 2001 From: LocalGitty <42035526+lgitty@users.noreply.github.com> Date: Sat, 7 Mar 2020 15:44:40 +0200 Subject: [PATCH] chnaged to spserver --- .../Capture7.PNG | Bin 0 -> 7337 bytes ...dCheckedOutFilesandCheckThemInSPServer.ps1 | 100 ++++++++++++++++++ .../description.md | 46 ++++++++ 3 files changed, 146 insertions(+) create mode 100644 Lists and Libraries Management/Checkout/Powershell/SPServer/Find all checked out files in SharePoint library and check them in/Capture7.PNG create mode 100644 Lists and Libraries Management/Checkout/Powershell/SPServer/Find all checked out files in SharePoint library and check them in/FindCheckedOutFilesandCheckThemInSPServer.ps1 create mode 100644 Lists and Libraries Management/Checkout/Powershell/SPServer/Find all checked out files in SharePoint library and check them in/description.md diff --git a/Lists and Libraries Management/Checkout/Powershell/SPServer/Find all checked out files in SharePoint library and check them in/Capture7.PNG b/Lists and Libraries Management/Checkout/Powershell/SPServer/Find all checked out files in SharePoint library and check them in/Capture7.PNG new file mode 100644 index 0000000000000000000000000000000000000000..4e9807f596543be531f2ec974120c46e417a11bb GIT binary patch literal 7337 zcmdUUXIK;4w|6Llh=2zaR7&hhZyGv?s5Ape5h+lNasZJM0|I(Dl!%0$ z(5r${q=!HV0cnyLLQ5zi@W%7M&+~q|?Zf*%_kNg}y=Tv?y=LvTe!o3yC0Upm3LHCo z3;+NK7#rQT1OPap>^ANw5Bm&tm;tgc9Kn``w*ctx5-aQux2HZ>9{{LIz*pK}C1E7VUKfi)C3>M`%#Q}i!gxXlSQ@tkc%K!9uik{o~*zx_A=F$~% zb9D6KKO!RoCn~QT{cW-BS$$4IT3B#ROw?q*`*f>XBC}`dFC_6r^1Mz>+i9z&gPGOk_Y^2yheV(ls$W5OmdgKRtjue3wp8h?Tg0A zZ!lHt8SF&Cz#>>RxZr^x6jTj?gC?*8{qN0}7FB<%M^HF5WZ7qedwMCtcLunMjPhsz zU9D*d-!4Q(Lsw7W9~iKW;X=rIZikY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;xIo{6Y6R3vEQVU zjI$}Z@kS#*R9uf?$o%vZ4j8BWJE`E*I zqd$~yHWkr*Aa%%*EC(xihIaOJLx z)te8O>7^=9L&SJ_1Ku<~&RyKtnjZ*>c_5_t51mZ3jZ{&k>l&P|(Bs2S@Ie93dVH5T z2{I2_Ol?%$A?&&l_5{9qA$4F!k%|EShI;&s|4LcvKf~t#MuqGDqo{ZM(BBohS#}Ql z*?_cr#nnS5>9Bw3q-|vqAK)4Dbt8|m^0-o#3O?iM9UVmxb{-8>G2j#=rP}@WkT+fU WeI;G2Y=nImV0_2yHu{#!^Zx_6{S*%X literal 0 HcmV?d00001 diff --git a/Lists and Libraries Management/Checkout/Powershell/SPServer/Find all checked out files in SharePoint library and check them in/FindCheckedOutFilesandCheckThemInSPServer.ps1 b/Lists and Libraries Management/Checkout/Powershell/SPServer/Find all checked out files in SharePoint library and check them in/FindCheckedOutFilesandCheckThemInSPServer.ps1 new file mode 100644 index 00000000..25eb11de --- /dev/null +++ b/Lists and Libraries Management/Checkout/Powershell/SPServer/Find all checked out files in SharePoint library and check them in/FindCheckedOutFilesandCheckThemInSPServer.ps1 @@ -0,0 +1,100 @@ +function Get-SPOFolderFiles +{ +param ( + [Parameter(Mandatory=$true,Position=1)] + [string]$Username, + [Parameter(Mandatory=$true,Position=2)] + [string]$Url, + [Parameter(Mandatory=$true,Position=3)] + $password, + [Parameter(Mandatory=$true,Position=4)] + [string]$ListTitle + ) + +# Create context and test the connection + $ctx=New-Object Microsoft.SharePoint.Client.ClientContext($Url) + $ctx.Credentials = New-Object System.Net.NetworkCredential($Username, $password) + $ctx.Load($ctx.Web) + $ctx.ExecuteQuery() + + + $ll=$ctx.Web.Lists.GetByTitle($ListTitle) + $ctx.Load($ll) + $ctx.ExecuteQuery() + $spqQuery = New-Object Microsoft.SharePoint.Client.CamlQuery + $spqQuery.ViewXml =""; + $itemki=$ll.GetItems($spqQuery) + $ctx.Load($itemki) + $ctx.ExecuteQuery() + + foreach($item in $itemki) + { + + Write-Host $item["FileRef"] $item.ElementType + + $file = + $ctx.Web.GetFileByServerRelativeUrl($item["FileRef"]); + $ctx.Load($file) + $ctx.Load($file.Versions) + + $ctx.Load($file.ListItemAllFields) + $Author=$file.Author + $CheckedOutByUser=$file.CheckedOutByUser + $LockedByUser=$file.LockedByUser + $ModifiedBy=$file.ModifiedBy + $ctx.Load($Author) + $ctx.Load($CheckedOutByUser) + $ctx.Load($LockedByUser) + $ctx.Load($ModifiedBy) + $ctx.Load($file.EffectiveInformationRightsManagementSettings) + $ctx.Load($file.Properties) + try + { + $ctx.ExecuteQuery() + } + catch + {} + + if($CheckedOutByUser.LoginName -ne $null){ + Write-Host $file.Name + Write-Host $CheckedOutByUser.LoginName + $file.CheckIn('Checked in automatically', 'MajorCheckIn') + $ctx.Load($file) + try + { + $ctx.ExecuteQuery() + Write-Host $file.Name " has been checked in" -ForegroundColor DarkGreen + } + catch [Net.WebException] + { + Write-Host $_.Exception.ToString() + } + + } + + + + } + } + + + + + + + + + +#Paths to SDK +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" + +#Enter the data +$AdminPassword=Read-Host -Prompt "Enter password" -AsSecureString +$username="AwesomeMachine\administrator" +$Url="http://ThisIsSharePoint/sites/site1" +$ListTitle="Documents" + + + +Get-sPOFolderFiles -Username $username -Url $Url -password $AdminPassword -ListTitle $ListTitle \ No newline at end of file diff --git a/Lists and Libraries Management/Checkout/Powershell/SPServer/Find all checked out files in SharePoint library and check them in/description.md b/Lists and Libraries Management/Checkout/Powershell/SPServer/Find all checked out files in SharePoint library and check them in/description.md new file mode 100644 index 00000000..c6d6dd02 --- /dev/null +++ b/Lists and Libraries Management/Checkout/Powershell/SPServer/Find all checked out files in SharePoint library and check them in/description.md @@ -0,0 +1,46 @@ +The script requires SharePoint Online SDK. + + + +What does it do? + +The script finds all the checked out files in a single library and checks them in. + + + +How to use? + +1. Download and open the file. + +2. Refer the paths to the SDK: + + + +PowerShell +#Paths to SDK +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" + + +3. Enter your credentials, the url of the site and the name of the list + +PowerShell +#Enter the data +$AdminPassword=Read-Host -Prompt "Enter password" -AsSecureString +$username="AwesomeMachine\administrator" +$Url="http://ThisIsSharePoint/sites/site1" +$ListTitle="Documents" + +4. Save the file, close, and run the script in Powershell. + + + +The files will have the following check-in in their version history: + + + +If you want to change the comment's content, modify the following line in the script: + +PowerShell +$file.CheckIn('Checked in automatically', 'MajorCheckIn') +