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

I was asked a question today that I didn't have an answer to. There's a requirement to tag all documents uploaded to any document library within the web application with a selection from a choice field. IE: user uploads document, selects one of the choices as part of the check-in.

My question is weather I can use a feature to add that column to every document library within the web application. The issue of adding it to new document libraries isn't a huge deal, but retrofitting all of the existing libraries would be a bit of a chore. I built a site column so that the choices would be managed from a central place (though that's site specific not web application specific), can that be applied to document libraries via feature?

share|improve this question

2 Answers 2

up vote 2 down vote accepted

What I would do is create a new Content Type which inherits from Document and has this column applied to it. Then you could use SPServices (or whatever other option you choose) to apply this new Content Type to the existing Document Libraries. It's a one-time thing, so doing it manually is always an option, of course.

I often set up this "interstitial" Content Type which inherits from Document right up front, even if we don't have any special columns to add to it yet. This makes it easy going forward to make changes to it that apply everywhere it is used. I'll usually call it '[client name] Base Document' or something.

share|improve this answer

Since site columns belong to Site Collections, you could package your column into a feature that was "Site" scoped. I don't think you would be able package a site column into a WebApplication scoped feature (but that's probably irrelevant at the moment).

When your feature is activated on a site collection, it would add the column to the site column gallery. You could then have a feature receiver set up that automatically goes through each subsite and document library and adds your column to the library.

Because this means that your feature would need to be activated on a site collection-by-site collection basis, you could even take it a step further and automate the activation of the feature on every site collection in the web application.

Hope that makes sense.

share|improve this answer
    
Paul, I'm new to the world of feature development. Are there any resources you'd recommend to look at? I've built a couple features to deploy text into a master page, but I'm completely new to a feature receiver. –  webdes03 Mar 25 '10 at 17:52
    
A quick search gave me these references which might be ok to get started: nnihlen.com/blog/archive/2006/12/04/724.aspx code-journey.com/2009/07/05/… –  Paul Lucas Mar 25 '10 at 21:58
    

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.