Library tutorials & articles

SharePoint, Document Library and SQL Server

Introduction

It’s been years now, SharePoint 2007 is about to appear in the market, SharePoint 2003 seems to be something that is history now (Exaggerating …). Many companies have adopted SharePoint during the last one year. Good thing is that I have seen lots of small businesses acquiring SharePoint during the last one year. SharePoint’s popularity is growing day by day and it is considered to be a top level portal product.

Document Libraries are collections of files that you can share with team members on a web based on Windows SharePoint services. Want to know more about Document Libraries?? Read more about Document Libraries on this site:

http://office.microsoft.com/en-au/assistance/ha011412871033.aspx

This link will show you how to create and use a document library. You can extend the functionality of these document libraries by using the “Event Handler Toolkit” that can be downloaded from the Microsoft site:

http://www.microsoft.com/downloads/details.aspx?familyid=4B2C2F1B-D74A-482A-903A-45BB44C5DEC4&displaylang=en

Suppose, whenever a document is added in the document library, you want to store the name of the document and the time it was added, in the database. How can you do that? Why would you do that? You can capture events fired in the document library. When ever a document is added, updated, deleted, etc, you can capture the event and add your own business logic or simply capture document information and store it in the database. Why would you store document information in the database? Well, there can be many reasons. You may want to create reports for the senior management who may want to look at the documents added to the library from time to time. You may want to track the document history or you may want to add a workflow to your document library. All this can be done by using the “Event Handler Toolkit”.

Before, we proceed, let me tell you the purpose of writing this. There are many excellent articles on the internet that show you how to capture document library events and do processing but still many people come to me and ask me the same question again and again and the question is related to the capturing of document information and storing it in SQL Server. Seeing the demand, I decided to write a small article that will show you how you can capture the document information in the library and store it in SQL Server. You can do so many things, for example:

  1. When a document is added, you can copy or move it to another document library.
  2. You can delete a document.
  3. You can capture document information and store it in SQL Server.
  4. You can update document information by updating the properties associated with the document.
  5. You can add workflow mechanism to your document library. For example, when a document is added to the document library, you send an email to the approver and ask him to approve the document. Document, after getting approval from approver 1, goes to approver 2 and so on.

These are only some of the important things that you can do with Document Library EventHandler. I wish I could show you all of the above in my article but unfortunately that is not possible due to shortage of time but I promise I will try my best to update this tutorial from time to time and add more content to it. In this article, we will see how you can capture document information when a document is inserted in the library and store this information in a DB.

Comments

  1. 16 Feb 2009 at 05:39
    Hi, Your article caught me eye whilst I was browsing trying to learn about Sharepoint. I am BA not a developer and am trying to work out how to implement SharePoint. One of our directors was under the impression that SharePoint doucments are stored within the database rather than on a file store similar to Lotus Notes. I have not been able to find any information to verify this. My questions are: 1. Can you confirm where SharePoint stores the documents - database or network/file store directory? 2. How difficult is it to migrate/extract documents from SharePoint if you decide in the future to move to another product?
  2. 03 Oct 2008 at 18:56
    Hi, Great article. Is it possible to use the event handlers and copy the document to sql server? I need to take a document that is uploaded into a document library and copy the document to sql server for our external users to access through an asp.net web application.
  3. 30 Jun 2008 at 06:39

    Hi,

     

    I have one questsion, if you can reply. which format sql server store sharepoint files?

    second how sqlserver manage versions history?

    help will be appreciated.

    Thanks,

    Ars

  4. 27 Feb 2008 at 16:33

    Hello,

    I am new to SharePoint, I am reseraching for my company the option of useing SharePoint Shared Document library for our docmentation system.  We are a small company and need to create a standard shared docuemnt repository for our IT department.

    Can anyone answere the following questions?

     Thanks

     Is there icensing fee's for a share point shared document library?

     Can you create retention rules / periods on dcouments stored in the shared document library?

    Is the shared document library?

    What type of files can be stored in the shared document library? word, PDF, excell, powerpoint, onenote, miscrosoft project, visio?

     

  5. 30 May 2007 at 08:14

    Hi,

    This article is very useful for me as a beginner to Sharepoint.  I need a favour, there is a requirement to have a form that collects some input like description, remarks, expiry date etc and add a document to the library.  It requires edit feature and delete feature too.  Can you please guide me how to achieve in sharepoint, THANKS IN ADVANCE.

    Please mail at reachbaala@yahoo.com

    Thanks, Bala

     

     

  6. 01 Jan 1999 at 00:00

    This thread is for discussions of SharePoint, Document Library and SQL Server.

Leave a comment

Sign in or Join us (it's free).

S.S. Ahmed S.S. Ahmed is a senior IT Professional and works for a web and software development firm. Ahmed is a Microsoft Office SharePoint Server MVP. Ahmed specializes in creating database driven dynamic we...

Related podcasts

  • Stack Overflow: Podcast #28

    This is the twenty-eighth episode of the StackOverflow podcast, where Joel and Jeff discuss Windows Azure, SQL Server 2008 full text search, Bayesian filtering, porn detection, and project management — among other things. Jeff met the inestimable Joey DeVilla aka Accordion Guy...

Events coming up

  • Mar 18

    Louisville .NET Meetup - March Meetup

    Louisville, United States

    We will meet on Thursday March 18th @ Quilogy. They are located at 10350 Ormsby Park Place. Doors will open at 6:30. This month we will feature a speaker meeting. There will also be door prizes! Please RSVP.SharePoint as a Development PlatformAbstract:Why or Why Not should you use SharePoint as a Development Platform?This is a common question I get asked all the time when I visit a customer.

We'd love to hear what you think! Submit ideas or give us feedback