Hi All,Today sharing one small thing but interesting one. I learned this new thing so sharing J
Scenario: We have our custom site definition. We are provisioning instance of Link list in <Lists> element in site definitionWe need to add XsltListViewer web part (XsltListViewWebPart) on front page for the above Link list. So we have module element to provision the front page and added XSLT Viewer web part having order 2. This module is added into web level feature and not in Onet.xml.
Problem: Whenever we were creating site this XsltListViewer web part appearing over the top means having order 0 for it. It’s not coming over the order mentioned for it, i.e. 2.
After doing lots of research it’s found that this is related to order of execution in Onet.xml. In following order parsing of Onet.xml happens:
- Site Features
- Stapled Site Features
- Web Features
- Stapled Web Features
- <Lists> element
- <Modules> element
But surprisingly SharePoint doesn’t throw an exception over there or doesn’t fail the site creation process but latter adds it as a top web part in the respective zone i.e. having order 0.
Possible approaches to avoid this kind of problem:
1. Provision the list instance in web level feature and set the dependency of this feature over the feature which provision the pages.
We used this approach and the web part is placed on correct order.
<module> element executes lastly. Till the time <Lists> are provisioned.
Enjoy reading JFeel free to comment / feedback if any or if you have any query J