.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

Change document version number via database

Posted By:      Posted Date: October 13, 2010    Points: 0   Category :SharePoint

Hi all,

I was blocked by an issue of document version number. The customer wants to move a document from one document library to another. After the document is moved, version number should be kept the same and metadata values of each version should also be kept.

File.MoveTo(string newUrl) method can move file and keep the same version number but lose the metadata in previous versions. Only the latest version has metadata values. Also this method cannot move file cross site collections.


Following is my solution:

1. Upload all the versions along with metadata to the new location and then delete the old file.

2. Update document version number in database directly.

Finally the solution works well, but I don't know if step2 will impact any other default logic in SharePoint system. Below is the logic to update version number.

            SqlConnection cn = new SqlConnection(connStr);
            SqlCommand cmd;
            string cmdTxt;


            cmd = cn.CreateCommand();

View Complete Post

More Related Resource Links

Version number syncronisation between document libraries

When I perform a Move or Copy operation from one Document Library to another in SP 2010 (using Send To or Manage Copies feature) SP resets the version number to 0.1 even if the version number in the source library is 4.2 (for example). All other Metadata is copied correctly. Is their anyway to keep version numbers in sync between document libraries? Seems like quite an obvious requirement to me but could not see any other info on the net about this.. thanks in advance

Database Service number does not change

I notice when I check to make sure the SP3 took I still see SQLExpress\9.0.3042 instead of 9.0.4035 for SP 3. The server management studio changed has to 9.0.4035 but not the database. Can some explain this?

huge number of data from database ... so how to minimize load time


Hi ...

I have used the above method to configure my crystal report ...

Its working fine , But i have huge number of data in database ....

So , it take long time to load the report ...

So , i have decided to show only the last 50 records inserted into the database , not all the 500 records to be loaded every time.

Plz help me with this issue  ...


Also , Plz explain me abt index legend in crystal report.

Change database fields automatically according to date

Hi, I'm currently developing a software application for my client. Part of the project is to keep track of his stock's shipping status. The client must insert the stock's pick-up date, expected time of departure (ETD) and expected time of arrival (ETA). The stocks will be called out using Grid View and the status, being one of the keys of the database, will be shown. Before the current date reaches pick-up date, the status must show "in warehouse", and after the current date reaches pick-up date and is before ETD, status must show that its "on the way to the port", and after ETD and before ETA, "in freight", and finally after ETA, "arrived". What datatype should I use for the database and where should I program it so that it changes automatically accordingly ?

Change SSP and Search database names

While creating SSP, besides the Admin site and MySite content databases, two more databases get created. They are usually named MySSP_DB and MySSP_Search_DB. If later we have a need to change these database names, what is the procedure? Thanks

SharePoint Version 2.0 (WSS 2.0 SP3) Content Database restore to new farm

Is it possible to use an SQL backup from a sharepoint Version 2 SP3 database to restore the content on a new server farm and attach to a new web applicaiton. NOTE: This is WSS 2.0. In WSS 3.0 this is a very simple task, but it is not the same in WSS 2.0 (the add content database option CANNOT be used to attach to an existing content database like it does in WSS 3.0). The options I have found appear to say you need the configuration database from the old server then it can be done. I am migrating from an outsourced deployment, so I do not have access to that. Plan B is to do a sharepoint STSADM backup. THis seems to be a more likey way to do it.

Updating a Document Version

If a document is updated from version 1 to version 2, what happens to version 1? Can i get to it to open it? If so where? I know you can view the History, but you cannot open a previous version. I am just thinking from an auditing point of view, if the auditor wanted to see version 7, can i show them the document?

Check for valid version number

Hi,I want to check whether given string is a valid version or not. If any string is in form of then it should return true, else if it contains any text or which is not any version format, it should return false.Any idea on this. Thanks for your help.

How to save word document in sql database?

Hi all, I have created a word document in my application (.Net). How can I save the word document (containing tables and some HTML formats) in a database and retrieve it for later use? Thank you in advance,

How to get previous version of content database

Hi,   Setps I did.... 1. Created Site collection with url http://server.80/Site1 2. taken the back up of dev server site collection and trying to restore with this new site collection 3. But, i restored in http://server.80/ How to get the content databse back up of http://server.80/  Pls its very urgent......................   Thanks in Adv..................

change password from the database

I have created login page(login.aspx) using login cotrol, now my lead asked me to provide an option "Change Password" so that end-user can change his password any time.I have created different form named as ChangePassword if you click lable ChangePassword on login.aspx page a pop-up window appears with changepassword control.how can i make this work using same(login) table. i searched around for code around i did not find.I used this link to create login page http://www.vbdotnetheaven.com/UploadFile/raj1979/VBLoginControl07242008114552AM/VBLoginControl.aspx Can any one help me,thanks

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 ?

Trying to include version history table inside Word document

Running MOSS 2007 with SP1, Office 2007.   I'm trying to create a table (doesn't have to be a table though) of a document's version history inside the document. This would be the history information kept by SharePoint. Since we can't even easily get just the current version number into the document I'm having problems and thought I'd see if anybody has a bright idea.   First, a couple facts. From Word 2007 it is possible to view the Document Library version information by clicking on the Office Button > Server > View Version History. This brings up the following: Click for screenshot   My goal is to get that version information displayed IN the document so when it is printed there is a document history. I tried using IRM label policies, but this only displays the current version and you can't include the comments.   After some digging I found the following code sample on MSDN:   Code SnippetDim dlvVersions As Office.DocumentLibraryVersions    Dim dlvVersion As Office.DocumentLibraryVersion    Dim strVersionInfo As String    Set dlvVersions = ActiveDocument.DocumentLibraryVersions    If dlvVersions.IsVersioningEnabled Then        strVersionInfo = "This document has " & dlvVersions.Count & " versions: " & vbCrLf        For Each dlvVersion In dlvVersions            strVersionInfo = strVersionInfo & _                " - Versi

vb.net - change version information

I'm using .net 2005 I would like to edit the Version Information of File Version,Description,Copyright,Company, Product Version Can i able to do it? where and how to set up ?    

"max-template-document-size" change not working as expected

Hi There I have a 2 node MOSS 2007 deployment hosting 5 webapps. The one web app I am having a problem with is a customised solution from a 3rd party. The product users need to save sites as templates, to which they get an error saying that the template is too large. I have run the max-template-document-size stsadm command and increased the value from 5mb to 50mb but it seems the change is not taking effect. The error page says the limit is still 5mb. When I use stsadm getproperty it shows that the value has in fact increased. I have made sure that I am doing this on the correct webapp. The save as template operation works if I do not select the "save content" option. The sites have no content so the cannot be greater than 50mb. Am I missing something extremely obvious?

How can I change the height of the rows in a document library webpart view to minimize the space bet

In SP2010 documents listed in a document library view (attached as webpart) are quite far from each other (height of each row is too big). How can I change the height that spaces between the documents are limited to a minimum, hence more documents are visible on my screen. (e.g. if I have many documents in my document library and add a webpart to my page that should show all documents, I would see more documents if the height of the row would be smaller (e.g. 16px) and spaces minimized. Moreover how can I make a smaller height for each row the default height?

how to change the web application Database connection form Windows authentication to SQL Server acco

Hi, I have a web application created and Database connection authentication was given as Windows authentication. how can i change it to a SQL server account in MOSS 2007. Thanks in advance.
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