SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'd like to create a library that my webpart uses to store documents. I would prefer to have this library only be visible through my webpart and by admins. Is this possible?

If so, how would I go about creating my library when the webpart is installed?

share|improve this question
up vote 3 down vote accepted

By "installed" I presume you mean when the feature containing the web part is activated. In this case you can do this programmatically through the feature receiver, or declaratively. This subject is documented extensively elsewhere.

You can set permissions on the list to limit who can see it. In your web part you can use elevated priviledges to access the list, for example using the SPSecurity.RunWithElevatedPrivileges method.

share|improve this answer

Your Answer


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.