Hammendorp.net

Blogging about SharePoint and other development

Lat's say you want to show the results of your own document content type, but when you search all possible options show up. What you can do then is to add a rule to your search scope.

Go to site settings > Scopes > Click on your custom scope

The click on the 'add rule' option and in the next screen choose the 'Property Query' option. Then choose the 'contentclass' option in the 'Property Query' section. As a value for this property you must fill out the value STS_ListItem_<your list template ID>. For example if you used the template ID 10150 in your list feature, the contenclass must be equal to STS_ListItem_10150. The behaviour option must be set to Require.

After recrawling, the search result is narrowed to only your list items.



In a recent project I wanted to show two views of one list. The problem is that by default the title of the List node is copied into title[1] and title[2]. To solve this, you must include the <webpart> in the view element. So I opened the ONET.xml of the site definition. In the Configuration/Lists section I added my list feature:


<Lists>

 <List FeatureId="&lt;myGuid>" Title="My List" Type="12345" Url="Lists/MyList" />

</Lists>

Then in the Modules/Module/File section in the ONET.xml we need to add the View element:


<View List="Lists/My List" BaseViewID="1" WebPartZoneID="Header" WebPartOrder="1" Type="HTML">

 <![CDATA[

  <WebPart xmlns="http://schemas.microsoft.com/WebPart/v2">

   <Title>My first custom title</Title>

   <Assembly>Microsoft.SharePoint, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Assembly>

   <TypeName>Microsoft.SharePoint.WebPartPages.ListViewWebPart</TypeName>

  </WebPart>

 ]]>

</View>


<View List="Lists/My List" BaseViewID="2" WebPartZoneID="Header" WebPartOrder="2" Type="HTML">

 <![CDATA[

  <WebPart xmlns="http://schemas.microsoft.com/WebPart/v2">

   <Title>My second custom title</Title>

   <Assembly>Microsoft.SharePoint, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Assembly>

   <TypeName>Microsoft.SharePoint.WebPartPages.ListViewWebPart</TypeName>

  </WebPart>

 ]]>

</View>

As you can see, in the CDATA you can find an element Title which you can use for your own custom title!

Have fun!



I was working with LINQ (which is cool) and I found this site: http://msdn.microsoft.com/en-us/vcsharp/aa336746.aspx

Always nice to have a good reference site for examples.

Have fun!



Bas Hammendorp

I am Bas Hammendorp, working as SharePoint developer at PGGM Zeist

Month List

Sign in