• Status: Solved
  • Priority: High
  • Security: Public
  • Views: 105
  • Last Modified:

SharePoint 2010 Powershell

Do one of you SharePoint 2010 gurus have the Powershell script to check in or undo-checkout of all item's in a picture library.  If you used SP2010 you are probably failure with when you check them in sometimes they still show checked-out.  I know there is a -force way to do it.  I just cannot remember it.  

Goal: Loop through all the documents in a specific Picture Library in a particular site and check them all in (or undo checkout)
0
Christopher Gore
Asked:
Christopher Gore
1 Solution
 
Jamie McAllister MVPSharePoint ConsultantCommented:
Tested this and it works;

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
 
#Variables for Site URL and Library Name
$WebURL="http://YourURL/YourSite"
$LibraryName="YourPictureLib"
 
#Get Site and Library
$Web = Get-SPWeb $WebURL
$DocLib = $Web.Lists.TryGetList($LibraryName)
 
#Get all Checked out files
$CheckedOutFiles = $DocLib.Items | Where-Object { $_.File.CheckOutStatus -ne "None"}
 
#Check in All Checked out Files in the library
ForEach($item in $CheckedOutFiles)
    {

        $DocLib.GetItemById($item.Id).file.CheckIn("Checked in by Admin")
        write-host "File:'$($item.Name)' has been checked in!"        
    }

Open in new window

0
 
Christopher GoreSolutions ArchitectAuthor Commented:
Sorry.  That did not fix it.  They still show up as checked out to me.
0
 
Kamlesh RaoIT ConsultantCommented:
Hey Christopher, your comment says that the script didn't help.  At the same time you have accepted it as the solution!!!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

How do you know if your security is working?

Protecting your business doesn’t have to mean sifting through endless alerts and notifications. With WatchGuard Total Security Suite, you can feel confident that your business is secure, meaning you can get back to the things that have been sitting on your to-do list.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now