Solved

delete old version sharepoint 2010

Posted on 2013-01-24
7
348 Views
Last Modified: 2013-01-31
the code to delete old version is found in the link below. i have a siite and a subsite only. but when i do this code, it only does one location in the subsite and that's it. it doesn't go to any other places. any idea? thanks

Get-SPWebApplication | Get-SPSite -Limit All | Get-SPWeb -Limit All | ForEach-Object { ForEach($list in $_.Lists) { If($list.EnableVersioning -eq $true) { $list.MajorVersionLimit = 1; $list.Update(); ForEach($item in $list.Items) { $item.URL; $item.SystemUpdate() } } } }


http://iedaddy.com/2011/11/sharepoint-powershelldelete-old-versions-of-documents-and-items/
0
Comment
Question by:StewSupport
  • 4
  • 3
7 Comments
 
LVL 38

Expert Comment

by:Justin Smith
ID: 38816675
You are saying only one list is affected?  How many lists do you have?  Is versioning enabled on all of them?
0
 

Author Comment

by:StewSupport
ID: 38816690
yes because if i go to the main site and go to settings then go to recycle bin, i see so many in there
0
 
LVL 38

Accepted Solution

by:
Justin Smith earned 500 total points
ID: 38816955
I'm not following.  What does the recycle bin have to do with anything?

This script only affects lists that have Versioning enabled.  Do you have more than one list with Versioning enabled?
0
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

 

Author Comment

by:StewSupport
ID: 38817244
If it stores in recycle bin wouldn't that store in the db?
0
 
LVL 38

Expert Comment

by:Justin Smith
ID: 38818420
Yes but the script isn't going to loop through the recycle bin. Why would you want to?
0
 

Author Comment

by:StewSupport
ID: 38818646
back to your question, i have 100+ lists on the site and 3 lists on sub site but it only loop through 1 list in subsite
0
 
LVL 38

Expert Comment

by:Justin Smith
ID: 38818834
I assume you have verified that versioning is in fact enabled on all the lists?  Because your script isn't going to touch it unless its enabled.
0

Featured Post

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Summary In SharePoint 2010 it is easy to create custom color themes to jazz up a site. Theme colors can also be created in PowerPoint 2010 with a few clicks. But how do the chosen colors actually look in the SharePoint site? The attached PowerPoint…
These days socially coordinated efforts have turned into a critical requirement for enterprises.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question