Possible to create a document library for my web part on installation?
-
16-10-2019 - |
Question
I have a web part that need to have its own document library. Is there any way for me to check to see if that document library exists and if not create it, when the WSP is installed?
Solution
Yes, you would do this via a Feature Receiver for the Feature that deploys the web part.
For more information on creating a Feature Receiver see: http://msdn.microsoft.com/en-us/library/ff872401.aspx#InsideSP14_Ch3_AAFR
Here's a simple example that shows how to create a document library in code: http://www.eblogin.com/eblogin/post/2011/03/15/sp-CreateDocLibrary.aspx
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange