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?


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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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