Solved

delete old version sharepoint 2010

Posted on 2013-01-24
7
338 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

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

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

I used to be SharePoint evangelist in our company, so my Outlook always full of questions about how to do this, or where I can find that. One day I found such an email with the following question: "how to attach 3-State workflow (one of the workflow…
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…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

777 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