Category: SharePoint 2010

Provisioning files in a feature in the root directory

I was recently tasked with migrating code that was written for 2007  in a feature. The files that were originally provisioned in the feature we deployed to the root folder of the feature. The code had already been upgraded to SharePoint 2010. I needed to create a wsp using Visual Studio 2010 and package it as a feature. Out of the box when you create a new Module in VS 2010 you get a subfolder so for example you create the feature called Feature1 and a module called Mod1. The default deployment path is 14\templates\features\feature1\mod1\file.txt. What I needed was feature1\mod1\file.txt. I tried modifying all the attributes in the elements.xml file and was not able to get the files to the correct location.


In the end what i did was the following

  1. Add the file to the module in visual studio
  2. Look at the properties of the file in visual studio
  3. Under Deployment Location expand the + and clear the Path value.
  4. Ensure that the Deployment Type is Element File
  5. Deploy the file and it should be in the correct location.

Defaulting Preview Pane To First Item in List

A client of ours wanted to use the preview pane for a list view. The default view of the preview pane has the right hand pane blank. You need to select an item or hover an item from the left pane to populate the right pane. The client wanted the right hand pane to have the right hand pane default to first item in the list.

UPDATE 10/21/2013:
It looks like when people are doing a copy and paste of the code that the double quotes ” are getting converted to smart quotes. When you copy and paste make sure that you change any of the single or double quotes to plain text.

UPDATE 9/11/2013:

  • On the list view page (e.g. allitems.aspx) att ?ToolPaneView=2 to the query string. Replace ? with & if there are already properties in the query string.
  • Under the page tab click edit page
  • Add a content editor web part to the page above the list items web part.
  • Click inside the content editor web part where is says add new content.
  • From the ribbon select Edit HTML Source
  • In the resulting pop up window paste the following code.
    <script src=””></script&gt;
    function ()

              $(‘ table tr’).first().trigger(‘onfocus’);

  • Stop editing the page.
  • The preview pane should now default to the first item in the list.