.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

Help needed in versioning through code in document library?

Posted By:      Posted Date: September 23, 2010    Points: 0   Category :SharePoint


I have a situation where i need to move the document form one library(LB1) to another library (LB2) thorugh event handler code. For documents which are not available in LB2 it is working fine but a case where document is already existing in LB2 i need to maintain the version instead , whereas my code is replacing the document already present.

Can anybody help me getting the versioning done through code?


Many Thanks



View Complete Post

More Related Resource Links

How do I move a document library, with versioning, from one website to another.

How do I move a document library, with it's versioning, from one web site to another in MOSS 2007?

Code to move the document from List to Library



I have attachment in sharepoint list, i have more than 3000 attached document in this list. Now i want to move those document to Document libray. I want to do it by using Object model, can any one help me out on this with code. Both the List and library are in different Site collection.

Versioning being disabled by itself in one document library

Hi All,

am currently facing an issue on a document library.

My document lib has more than 2000 items and has versioning enabled. Some how the version settings are changing automatically. I mean the versioning is being disabled by itself.

This is happening only on this library all other libraries in the site and site collection are working fine.

Im using  WSS 3.0.

Can any one help with this.

Thanks in advance,

bind a document library to a windows folder without code


Is it possible to bind a SharePoint library to a windows folder, so when a file is added the folder an event is created in SharePoint?


Or do I have to write code to watch the folder and add it via a workflow?

Upload a File to a SharePoint Document Library - Part I

The following helper class demonstrates a few techniques that allow documents to be uploaded to a SharePoint document library programmatically without using the API or a custom web service. You don't need to specify a document library name, and it will create any folders specified in the URL as required. File meta data will be updated if any properties are passed.

XML Comments: Document Your Code in No Time At All with Macros in Visual Studio


Starting in Visual Studio 2005, XML documentation support will become available in Visual Basic and C++ as it has been for C#. However, making full use of the many comment tags will take a little extra work In this article, the author shows how Visual Studio macros can be used to automate the creation of XML documentation and creates macros that write large sections of comments with just a keystroke.

Tony Chow

MSDN Magazine July 2005

Wrappers: Use Our ManWrap Library to Get the Best of .NET in Native C++ Code


By now you're probably used to reaching into the .NET Framework using Managed Extensions with your C++ code. But what do you do if you have legacy apps that use older versions of the compiler, or if you want to avoid some of the CLR requirements? Well, you can wrap Framework classes in a native way so you can use them in any C++/MFC app without /clr. Paul DiLascia shows you how.

Paul DiLascia

MSDN Magazine April 2005

IE closing when user try to access the document library

<!-- /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0in; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman";} @page Section1 {size:8.5in 11.0in; margin:1.0in 1.25in 1.0in 1.25in; mso-header-margin:.5in; mso-footer-margin:.5in; mso-paper-source:0;} div.Section1 {page:Section1;} --> IE closing (crashing) when user try to access the document library in share point site.  here we are using WSS2.0.  this problem for not accursed all the users , this problem happening on some users. 

Unable to open pdf from document library MOSS 2007


When I click on a pdf document uploaded in a document library it comes up with a blank page. 

I guess it's trying to open pdf on the browser. I turned off "Display PDF in browser " option in Adobe Preferences, but it doesn't help, same issue.

I tried other browsers too, it's the same issue.

I am able to open all other pdf files local to my machine fine.

I am using IE 8 on my machine (Windows 7) and the Sharepoint server is MOSS 2007.



Can I open the "new" menu in a SharePoint Document Library using Dragon NaturallySpeaking?


When a user, who uses Dragon NaturallySpeaking, says "new" when viewing a Document Library the default content type is selected and the associated application (e.g. Microsoft Word) is launched. This scenario is okay for Content Type selection since the Microsoft Office applications will prompt for the metadata once the file is saved.

If the user needs to create new folders in the Document Library however they need to expand the "new" dropdown menu.

What is the best way for someone using Dragon NaturallySpeaking to expand the "new" menu for a Document Library in SharePoint?

Cannot copy document to other library

When I try to send a document to another SharePoint library (Send To>Other Location) I am receiving a blank message box.  Does anyone have an idea what the empty message box is about or why this error is occurring?  Thank you!

Search does not find text in Word document stored in document library on a Report Center site within



We have a document library on a site created off of the Report Center site template. We uploaded a Word 2007 document with the word zebra in the text. Using the search bar at the top of the page we selected This list: Our document library and searched for zebra. We received no results.

We tested the same thing on another site (site template Team site) within the same site collection and search worked fine.

Does the Report Center search function differently then the search functionality on the Team site?

Tamara Bredemus SharePoint Minion...working up to Maven

File Attachments from info-path forms to Sharepoint document library


Hi Experts,

How to upload file attachements from info-path forms to Sharepoint document library?

I need to add attachement from local-PC/Any User to Sharepoint Document Library.


Any help please?? Appreciated




Creating a custom column with a link to document (other than the name field) in document library



I have a document library with the standard name column linking to the document. However, we'd like to create a custom field and have that link to the document (and edit item menu).

How is this best accomplished?

Thanks in advance!


Error adding a document library to a site



I am receiving the error "Cannot complete this action.  Please try again"  when trying to add a document library to one of the sites.  This is Sharepoint 2007 SP1.  I seem to be able to do it thru designer but not the web interface.

Does anyone know how to fix this?

Check-out issue when opening a document from a document library when a read-only copy is open

We have an issue when a user has a read-only copy of a document from SharePoint open and then tries to check-out and edit another copy of the document (i.e. from the document library) the checked out copy is not connected to the web server. For the user it will look the same they will make edits, save and then close, but when they do so the document is not updated in SharePoint - it may be saved locally in their SP drafts, but the user will think that they have lost their version. We then get the checked out to another user error and you have to discard changes to get the document working again. Steps to reproduce this issue: * click on the name of a office doc on a Document Library * Make sure "Read Only" is selected and click "ok" * Minimize open document * click on the same file on the Document Library * Make sure "check out and edit" is selected and the "Use my local drafts folder" checkbox is ticked. Select OK. * Edit document and press save. Changes are never saved back in SharePoint, they are only on the local draft. We are using MOSS with SP2. Clients are on Office 2003 and 2007 Is this normal behaviour? Is there anything that can be done to prevent this from happening?

When try to open a folder in a moss 2007 document library in Explorer View, the folder does not open


When try to open a folder in a moss 2007 document library in Explorer View, the folder does not open.

I am using IE7 and the path of the folder does not contains more than 100 characters.

Also it opening on few on the machines which has IE7.


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