Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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

share|improve this question
    
Is it a requirement to save the data in SQL, otherwise managed metadata and TaxonomyFields could be a great solution –  Robert Lindgren Mar 27 '13 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 '13 at 15:22

1 Answer 1

up vote 2 down vote accepted

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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