Published: May 2010
A module is a collection of file instances, which are instances of files that are provisioned in a site. To provision a file into Microsoft SharePoint Foundation Web sites, you must use the Module element within a Feature or site definition. The Module element allows you to add one or more files to a SharePoint Foundation Web site or document library.
The Module element contains File elements that define which files to provision, and that can also contain definitions for the set of Web Parts to add. If you provision files to a subdirectory through the Module element, SharePoint Foundation automatically ensures that the directory structure is created to match your files.
Through the Module element you can opt either to provision a file into a document library or to add a file outside of a document library. In the case of adding a file to a document library, you must specify the Type attribute as GhostableInLibrary on the File element. This setting tells SharePoint Foundation to create a list item to go with your file when it is added to the library. If you are instead provisioning a file outside of a document library, specify the Type attribute as Ghostable.
Microsoft SharePoint Foundation supports provisioning a maximum 1000 files through Features, whether it be 1000 modules each with 1 file, or 1 module with 1000 files.
Modules have the following possible scopes:
Web Application: No
Site Collection: Yes
Web Site: Yes
When a module is activated in the site, the files in the module are provisioned in the site. When a module is activated at the site collection scope, the files in the module are provisioned in the top-most site of the site collection. A module requires the Create Subsites permission. When a module is activated, it does not check to see if the list exists before creating folders in the site. A Feature event receiver should check to make sure the list exists before creating the folder.
When a feature that contains a module is deactivated, the files associated with the module are not removed from the site.
For more information about the file format for file sets, see Modules.