0

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?

2 Answers 2

2

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.

2

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.

3

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.