.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Is there a solution to purge document versions based on date in WSS 3.0?

Posted By:      Posted Date: May 22, 2011    Points: 0   Category :C#

We use WSS 3.0 document libraries to archive reports. Most reports are run daily and just stack up as new versions to each report document. In each of these libraries, the documents have various required retention periods. We would like a way to purge the versions of the documents based on dates and the document retention period. Everything I see so far can just purge the entire document including all versions, which is undesirable. I understand we can set our version limits to a number like 365, but this is a bad solution because this setting is at the library level and we would have to set at the longest retention period, and if reports start runnning more than once a day then we would not meet the retention requirements. I have sugggested on modifying the structure of our archive, but have been tasked with finding a built-in way to trim the old versions in our current structure or find an existing solution to do this. Any suggestions would be much appreciated.

View Complete Post

More Related Resource Links

Filtering/selecting rows based on date


I have a gridview, based on thsi datasource:


<asp:SqlDataSource ID="SqlDataSourceAllLoads" runat="server" 
        ConnectionString="<%$ ConnectionStrings:tplatz_dk_dbConnectionString %>"               
        SelectCommand="SELECT DISTINCT DATEADD(day, 0, DATEDIFF(day, 0, tblDelivered.delivered_Date)) AS delivered_Date, tblDelivered.delivered_LoadNo, tblDelivered.delivered_TrailerNo, ISNULL(tblDeliveredInfo.deliveryInfo_FirmaNavn, N'?') AS Expr1 FROM tblDelivered FULL OUTER JOIN tblDeliveredInfo ON tblDelivered.delivered_LoadNo = tblDeliveredInfo.deliveryInfo_LoadNr ORDER BY delivered_Date DESC">

Using a dropdownlist, I can filter (by changing datasource) the results based on customer names in a dropdownlist. This datasource, working perfectly, looks like this:


<asp:SqlDataSource ID="sqldataSourceKundeLoads" runat="server" 
        ConnectionString="<%$ ConnectionStrings:tplatz_dk_dbConnectionString %>" 
        SelectCommand="SELECT  DATEADD(day, 0, DATEDIFF(day, 0, tblDelivered.delivered_Date)) AS delivered_Date, tblDelivered.delivered_LoadNo, tblDelivered.delivered_TrailerNo, ISNULL(tblDeliveredInfo.deliveryInfo_FirmaNavn, N'?&#

Document History Versions

A doc library with turned on function of versioning after any changes of an item. Want to turn it off and delete all history version. This will redeem grand piece of space. Tried to just turn off versioning and free unused space from sql db. Didnt work because all these versions are still there and you can see em after turning version control back. There are over 1k files in a lib and i dont want to manually crawl over each one and cut off these versions.

Alert based on date

I have a list of SSL certificates and their expiration dates.  I created a column that calculates the date 45 days before the expiration and then a view that only shows those items where the (expiration - 45) > Today. I then set an alert for any changes to items in that view.  However, I don't get an alert for items that pop into the view...I guess because the item itself did not change.  Is there a way to send an alert based on date?  My SharePoint enviroment is locked down so I can't create custom workflows or connect via Designer.

Search based on creation date

Hello All, I would like to ask which managed property I should use for searching based on creation date. It seems I can't find a managed property to do this. I created my own managed property with the right crawled properties, which works. But I think this should be something out of the box.  Please help, thank you  Anna

Export Data to Excel Based on Date Range

I have data from multiple tables that I would like to display in a gridview via a stored procedure.  I need to select the data based on a date range and display it.  Once displayed I need to include a button that would allow the user to export the gridview data to an excel spreadsheet.  Does anyone have an out of the box solution or know of a tutorial I can use to accomplish this feat?  I am currently using 2.0 for this project. I am newish to .net. Thanks in advance. Here is my stored procedure that calls the data from multiple tables.USE [DATABASENAME] GO /****** Object: StoredProcedure [dbo].[GetUsersAll] Script Date: 09/03/2010 08:20:23 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER PROCEDURE [dbo].[GetUsersAll] AS SELECT aspnet_Users.UserName, aspnet_Membership.Email, Team.Name, MemberTeamRole.InsertDate, MemberTeamRole.ManagerApprovedDate, MemberTeamRole.RegistrarApprovedDate, MemberTeamRole.RoleName, MemberInfo.firstname, MemberInfo.lastname FROM aspnet_Membership INNER JOIN aspnet_Users ON aspnet_Membership.UserId = aspnet_Users.UserId INNER JOIN MemberInfo ON aspnet_Users.UserId = MemberInfo.memberid LEFT OUTER JOIN MemberTeamRole ON aspnet_Membership.UserId = MemberTeamRole

How to display the number of versions that an item/document currently has?

Hello, If I enable versioning on a list, is there a way to display the number of versions in the version history for each item? Now I have to open the version history for each item to see how many versions there are. I need a quick overview in e.g. the view to see which items contain a lot of versions. Is that possible ?

How to design centralized document management solution for Intranet

Our need: -SharePoint Server 2010 based Intranet with the document management solution.(about 200-300 documents) -All documents are centralized to one place -Managed metadata are added to every document. Metadata are used to search as well. -Folders are needed because of user permissions. Not everybody can open all documents. -Automatic item copy process to desired target place are desired to help end-user My design I planned this way, but did not work in practise. I created 1 centralized document library with several folders based on category. I user Content query webpart to display documents in other sites. This works fine. I wanted to automatic process to move added documents based on metadata. Example: When document include managed metadata "personnel" or "HR", the document is move to the folder named "Personnel". I made 2 different tests, but neither of them filled all requirements: 1. Using Content organizer, I was not able to make conditions based on metadata, but was able to move documents to the folders. 2. Using Workflow, I was able to make conditions based on metadata, but not able to move documents to the folders.   I failed to use metadata to move items to the Folder. Do you have any idea to me? I'm open to any ideas.Kenny_I

Event handler to delete minor versions in document libraries

Hi Is there a way we can capture the deletion of minor versions in document libraries using any event handler. May not be using the delete all the minor versions but at least when we use the option to delete the selected minor version. I do not see the ItemUpdating and ItemUpdated getting fired in this case. Thanks wpwije  

Word Document date property defaulting to an incorrect value.

Within a SharePoint document library we have a custom column that is a date (Inactive date). If you look at the properties from within SharePoint on a document the date is empty. If you open the document in Word 2007 and look at the properties the date has acquired a value, always the same value 30/11/1999. If you save the document and look at the properties in SharePoint again it now has the value.  Unfortunately in Business terms this now shows that the document is “In Active”. I traced the date back to the template document on the library. I edited the template document by removing the date and saving it. If I then create a new document and save it again the properties in SharePoint show an empty date. However if I then open the document again in Word the date appears. This problem does not occur with word 2003. How can I stop the date defaulting to this value when a document is opened in Word?

Dynamic list item title based on date created & regional settings?

I have a list of things that doesn't *need* a title.  However, because sharepoint uses Title for links, RSS etc  I tried generating a title in an event handler.   This would work great if I wasn't basing it on a date field: public override void ItemAdding(SPItemEventProperties properties) { DateTime dt = Convert.ToDateTime(properties.AfterProperties["TestDate"]); properties.AfterProperties["Title"] = dt.ToShortDateString(); base.ItemAdding(properties); } In testing, this sets the title to "8/9/2010" when I selected 8/10/2010 in the date picker.  I figure this is because of the regional settings of my test user.  I can probably correct the title value for 'test user' but that won't fix 'test user in mongolia' who would still see two different values. So What I would like is to have the Title always display the value MyDate in the uesr's locale.  So the field needs to be dynamic not only at edit/update time, but at display time. Does anybody know if this can be accomplished, and more specifically how?

Is it possible move documents based on managed metadata to Document sets

I would like to all documents who have managed metadata "personnel" to the Document Set "HR". Is this possible with workflow?Kenny_I

Use letters instead of numbers for document versions

Is it possible to use letters instead of numbers for document versions? In sharepoint, drafts are numbered 0.1, 0.2,... 1.1, 1.2, 1.3, etc. and published versions are 1.0, 2.0, etc. But due to company's procedures we should use a different system using letters (A, B, C...). Is that possible? If not, would it be possible to add some property to the documents to add the version letter? I know it may be difficult because the letter can be calculated just after sharepoint assigned the version number... :-(

How do you filter a list in a Meeting workspace based on the meeting date?

I have a customer who is using a meeting workspace, and has a list on said workspace (we'll call it "Meeting Instance List"). The workspace houses this list, and of course after each meeting, the workspace, in essence, resets itself in preparation for the next meeting - so it looks like it removes the items from the list, when in actuality, they are there, just on the previous meeting instances. Some of his stakeholders are finding this limiting because they perceive it as losing historical information (you know how some folks can be, if they don't see it, they think it's gone). His solution is to replace the non-series list, with a series list, and incorporate legacy records from another older list. Only problem is, now there's not a way to filter the series list so that it shows items from a parcticular meeting date. For instance - the [Today] variable will only return a current system date value. Surely there ought to be a similar variable that would all you to filter the list based on meeting date, right?

Creating a workflow condition based on document type

Hello! I'm creating a workflow for a Document Library. I only want the action in the workflow to be executed on the condition that the document is of a certain document type. Any suggestions how I should do that? Thanks!

Running sum calculation based off date dimension?

I have a fairly simple calculated measure which does a running sum of a particular measure : --This does a running sum of the Net Measure up until the previous date (basically a "Starting Count" for a period. Sum(PeriodsToDate([Change Date].[Year - Month - Date].Levels(0), [Change Date].[Year - Month - Date].PrevMember), [Measures].[Net]) The problem is I have added a second hierarchy in the date dimension that includes quarter called [Year - Quarter - Month - Date]. Is there anyway around not having to create a seperate running sum calculated measure to use this new hierarchy? The PrevMember in the initial calculated measure works, although it reports the wrong number when used in conjunction with the Quarter hierarchy because it gets the PrevMember in the other hierarchy. What is the best practice for this situation?Craig

Set read only permissions on a document based on review status

I have a document library that has excel files that users create using a Content Type template.  Then there is a workflow that runs on it and allows the user to change state of the document to Strted, Prepared, Reviewed.  I want that once the status is set to reviewed, a workflow runs and changes the permissions on the document to read only.  The user is part of a group... so not sure how to handle the permission.  Any advice?

file creation date after uploading document to document library


Hi i am writing a event receiver to get the file creation date after the document is uploaded to the document library.

When a document library is uploaded to a document library the created date is overwriten by the uploaded date.


issues 1) i am not getting the folder path to get the filecreation date for system.io.file.getcreation() method

  public override void ItemAdded(SPItemEventProperties properties)

        properties.ListItem["Created"] =CreationTime(date);
        properties.ListItem["Title"] = itemurl;
      catch (Exception ex)


public CreationTime(SPItemEventProperties properties) {

 using (SPSite site = new SPSite("http://test"))

        SPWeb oWebsiteSrc = site.OpenWeb();

        SPFileCollection fileCollection = oWebsiteSrc.Files ;
        //get the filelocation of the current document library
        string filepath = fileCollection.Web.Lists["test"].Folders.ToString();
        SPList oList = site.AllWebs["jtest"].Lists["test"];
        SPFolder folder=oWebsiteSrc.Files.Folder;

        SPListItem fileitems =oWebsiteSrc.Lists["test"].Items[0] ;
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend