As part of an internship assignment, I'm working with SharePoint 2013. I'm completely new to SharePoint in general.

Part of this assignment is a labeling system. The idea is that users can add labels to specific documents. There's two types of labels we want: Global and Personal.

I've asked a somewhat similar question before, you can see it here: Filling an SP column with SQL data I managed to set up a BDC connection to an SQL server containing some labels, in Visual Studio. However, I'm having trouble filling a custom Document Library with this data.

What I'd like to have is a Document Library that lets me execute C# code when the page loads, so I can fill certain columns with BDC data. Beyond that, I would like to write stuff back to the database as well. For example, a user uploads a new document and adds some labels, the C# code collects the documents GUID and the user's login and writes these back to the database along with the assigned labels.

The examples I've tried (to no avail) involved stuff like manually redirecting users to new masterpages, which all seemed needlessly complicated and had a "bad smell" if you will, making me feel like I'm overlooking something... Does anyone know of a simple tutorial how to get something like this done?

Thanks in advance

  • Is it a requirement to save the data in SQL, otherwise managed metadata and TaxonomyFields could be a great solution Mar 27, 2013 at 15:09
  • Yes, I do want to save the data in SQL. I experimented with the managed metadata already, however it isn't powerful enough to achieve what I want, as far as I've seen. Specifically, for the Personal labels part. The idea there is that each user has a private set of labels it can assign to documents. The method of adding the metadata terms to documents seemed very clunky to me, as well. I was hoping to create a dropdown list on the list itself where users can select labels they want to assign to a document, instead of having to go into the edit screen.
    – David
    Mar 27, 2013 at 15:22

1 Answer 1


You can use Event Receivers to accomplish what you are wanting. Basically Event Receivers can be fired whenever a new document is uploaded or an existing one changed. In your Event Receivers you could write data to SQL, to your item, etc.

Microsoft has LOTS of documentation on Event Receivers: http://msdn.microsoft.com/en-us/library/ee231563.aspx

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.