Hi friends, i have noticed one strange thing in file provisioning using feature. Let’s see how slash will affect the provisioning.
Case 1 Using forward slash
I write my element manifest (module.xml) like below
[xml]
<?xml version="1.0" encoding="utf-8" ?>
<Elements Id="913FC07E-5953-4813-98F8-241847ED588D" xmlns="http://schemas.microsoft.com/sharepoint/">
<Module Name="MyCustomPage" Url="_layouts/MyCustomPage">
<File Url="Default.aspx" Type="Ghostable" />
</Module>
</Elements>
[/xml]
When i use Url attribute like Url=”_layouts/MyCustomPage” then feature provision or you can say put my file into site, by creating _layouts folder under root of the site like below (I checked in SPDesigner)
http://sandip:6666
|- _layouts
|- MyCustomPage
|- Default.aspx
Case 2 Using backward slash
I write my element manifest (module.xml) like below
[xml]
<?xml version="1.0" encoding="utf-8" ?>
<Elements Id="913FC07E-5953-4813-98F8-241847ED588D" xmlns="http://schemas.microsoft.com/sharepoint/">
<Module Name="MyCustomPage" Url="_layouts\MyCustomPage">
<File Url="Default.aspx" Type="Ghostable" />
</Module>
</Elements>
[/xml]
In this case i got one error while feature activation
Cannot create folder “_layouts\MyCustomPage”. at Microsoft.SharePoint.Library.SPRequestInternalClass.EnableModuleFromXml(String bstrFeatureDirectory, String bstrUrl, String bstrXML)
at Microsoft.SharePoint.Library.SPRequest.EnableModuleFromXml(String bstrFeatureDirectory, String bstrUrl, String bstrXML)
In this case in thought feature try to provision or put a Default.aspx file into _layouts directory on 12 hive file directory but that is not case here, i manually create MyCustomPage directory in _layouts. No results, i got same error even i m site collection admin as well as farm admin. I found syntax issue in Url , there should not be special letter like “\”. Please see Module schema here
One conclusion we can make from this
Provisioning is only for the files that needs to go in to the Site directories not 12 hive file directories