When you want to create site using custom site definition and want to use Content Query WebPart, Export definition of your web part from existing site. You will find list is defined by Id called ListGuid. But the ListGuid is never the same when you create a new List. You need to do the the following steps before adding exported web part to your onet.xml:
- Remove ListGuid
<Property name="ListGuid" type="string"></Property> - Add ListName and WebUrl (if they are not exist)
<Property name=”ListName” type=”string”>Posts</Property>
<Property name=”WebUrl” type=”string”>~site/</Property>
Note:
- ~site represent current site. you can use ~sitecollection to represent current site collection.
- ~site/ I added slash because if we are in root WebUrl will be blank and CQWP will not be rendered.
No comments:
Post a Comment