Unable to Insatiate Module – SharePoint Error

n

nHave you ever come across such error?  I faced.. and solved

n

nThis error is basically related to the module element and usually comes when you try to provision a file to the SharePoint site which never exists on physical path / file system of the server

n

nHere is the example case:

n

nI am trying to provision a page named stylish.aspx to pages library same as default.aspx in onet.xml

n

n

n

n<Module Name=SampleModule Url=$Resources:cmscore,List_Pages_UrlName; Path=“”>

n

n

n

n<File Url=Default.aspx NavBarHome=false Type=GhostableInLibrary>

n

n  <Property Name=Title Value=My Default Page />

n

n  <Property Name=PublishingPageLayout Value=~SiteCollection/_catalogs/masterpage/MyPageLayout.aspx, ~SiteCollection/_catalogs/masterpage/MyPageLayout.aspx; />

n

n  <Property Name=ContentType Value=$Resources:cmscore,contenttype_page_name; />

n

n</File>

n

n     

n

n<File Url=Stylish.aspx NavBarHome=false Type=GhostableInLibrary>

n

n<Property Name=Title Value=My Stylish Page />

n

n<Property Name=PublishingPageLayout

n

nValue=~SiteCollection/_catalogs/masterpage/ MyPageLayout.aspx, ~SiteCollection/_catalogs/masterpage/MyPageLayout.aspx />

n

n<Property Name=ContentType Value=$Resources:cmscore,contenttype_page_name; />

n

n</File>

n

n</Module>

n

n

n

nIf you try above case then you will get this error, unable to insatiate module ……

n

nWell what’s the problem?

n

nYes , I was trying to add page named Stylish.aspx with virtual url Stylish.aspx which never exist

n

nIf you open any site template directory under [14]\Layouts\Template\SiteTemplate then you will find default.aspx and that’s the reason why SharePoint needs that

n

nSharePoint searches file named default.aspx on file system and then provisions file to SharePoint site

n

n

n

n

n

nSolution:

n

nSo above error can be solved like using a Name attribute of File Element

n

n

n

n<Module Name=SampleModule Url=$Resources:cmscore,List_Pages_UrlName; Path=“”>

n

n

n

n<File Url=Default.aspx NavBarHome=false Type=GhostableInLibrary>

n

n  <Property Name=Title Value=My Default Page />

n

n  <Property Name=PublishingPageLayout Value=~SiteCollection/_catalogs/masterpage/MyPageLayout.aspx, ~SiteCollection/_catalogs/masterpage/MyPageLayout.aspx; />

n

n  <Property Name=ContentType Value=$Resources:cmscore,contenttype_page_name; />

n

n</File>

n

n     

n

n<File Name=Stylish.aspx Url=Default.aspx NavBarHome=false Type=GhostableInLibrary>

n

n<Property Name=Title Value=My Stylish Page />

n

n<Property Name=PublishingPageLayout

n

nValue=~SiteCollection/_catalogs/masterpage/ MyPageLayout.aspx, ~SiteCollection/_catalogs/masterpage/MyPageLayout.aspx />

n

n<Property Name=ContentType Value=$Resources:cmscore,contenttype_page_name; />

n

n</File>

n

n</Module>

n

Leave a Comment