Reordering/Ranking SharePoint List Items

August 6, 2010 22 comments

SharePoint link list has a feature which lets you Re-Order list items and this is done using List Actions.

image

This in turn uses ReOrder.aspx page to reorder list items. Here is a summary how this functionality it implemented.

  • Links list contains a field called “Order” which is an internal field and default view is sorted by it.
  • Reorder.aspx uses this Order field to update and reorder list items in that view.
  • Default view is sorted by Order field and reflects the new order.

Now code that runs in Reorder page doesn’t really care about most list types and location since it uses list GUID to modify the order and the Order field is part of each and every list template but for some reason SharePoint has blocked this feature from all the other list templates, like most other things. But given the list GUID Reorder page is able to sort list items. So why doesn’t it work ?  Because Order field being an Internal field is also hidden from other list templates, so while it is possible to reorder we are unable to create a view which will use this order to sort list items.

There are tons of posts around this method and dropping in data view web part to sort list items and solutions which implement their own ordering feature. I prefer a much simpler approach (according to me at least) . Unhide the damn order field and create a view.

I have created a feature which does exactly that.

“List Order”  is feature which enables list re ordering for your custom list. The feature is enabled on “Web” level and enables this action item for all the lists for that particular site. The feature has 2 parts to it:

1. Custom List Action item:  This provides the action item to link to list –reorder page.

image

2. “By Order” View:  When feature is activated, it creates a view on the supported list called “By Order” which is sorted by the “Order” field. (Note: This is only applies to existing lists and wont reflect on  newly created list. however you can create your own views and select the sort by “order” field)

image

Now the feature once activates will provide the Action Item and View to all the supported list types for that particular site. I haven’t tested this feature with huge list or many other scenarios, but I assume it would work similarly to a link list and I don’t see a use case for manually reordering lists with more than 50 items in it.

Screenshots:

1. Reorder Action item on custom list:

image

2. “By Order” view before reordering of list items

image

3. Reorder page

image

4. “Order By” view after refresh

image

Note: It is currently configured to work with following list templates:

  1. Generic List
  2. Contacts List
  3. Task List
  4. Gantt List

You can change them if you like from the source code.

Downloads:

Feature WSP Download
Source code Download

CQWP (Content Query Web Part) Display all fields + values

October 30, 2009 2 comments

Moved from old blogging site

Below is the code which I use frequently for my XSL development in CQWP. This xsl code gets all the data and values, this helps you identify all the data before you move on with visual html development. Initially I used this custom xslt to display all the field names in Content Query Web part. I modified it to see values along with field name. Its simple needs no explanation.


<xsl:template name="AllFields" match="Row[@Style='AllFields']" mode="itemstyle">
 <xsl:param name="CurPos"/>
 <xsl:variable name="SafeLinkUrl">
 <xsl:call-template name="OuterTemplate.GetSafeLink">
 <xsl:with-param name="UrlColumnName" select="'LinkUrl'"/>
 </xsl:call-template>
 </xsl:variable>
 <xsl:variable name="SafeImageUrl">
 <xsl:call-template name="OuterTemplate.GetSafeStaticUrl">
 <xsl:with-param name="UrlColumnName" select="'ImageUrl'"/>
 </xsl:call-template>
 </xsl:variable>
 <xsl:variable name="DisplayTitle">
 <xsl:call-template name="OuterTemplate.GetTitle">
 <xsl:with-param name="Title" select="@Title"/>
 <xsl:with-param name="UrlColumnName" select="'LinkUrl'"/>
 </xsl:call-template>
 </xsl:variable>
 <xsl:variable name="LinkTarget">
 <xsl:if test="@OpenInNewWindow = 'True'" >_blank</xsl:if>
 </xsl:variable>
 <div id="linkitem" class="item">
 <xsl:for-each select="@*">
 <span style ="font:bold">    <xsl:value-of select="name()" /> </span>  : <xsl:value-of select="."/> <br/>
 </xsl:for-each>
 </div>
 </xsl:template>

<p>&nbsp;</p>

——————————————

Categories: Content Query, Field, SharePoint, XSL, XSL Tags: ,

Zune 4.0 Marketplace (slowness) fix

September 28, 2009 17 comments

This is a fix for slow Zune marketplace on Win 7, I have tested this on my Win 7 64 bit. Marketplace works fine on my Vista 32 bit and xp 32 bit. You can try this for your Vista 64 bit too. You can find users reporting on this forum http://forums.zune.net/2/8/526815/ShowPost.aspx

The Fix
Turn off Automatically detect LAN settings in your IE.
Steps

  1. Open IE
  2. Click on Tools–> Internet Options
  3. Click on “Connections” Tab
  4. Click button “Lan Settings”
  5. Un-Check ” Automatically detect settings” (this is/was set by default in my Win 7 installation)
  6. Restart IE and Zune (if you had it open)

I found an article for slow saving of documents in SharePoint from Windows 7 client and this was the fix and thought these were related.

Screenshots

Masking SharePoint Created By and Modified By( Making list Anonymous)

September 18, 2009 1 comment

 

Note: This is for SharePoint environment not configured for anonymous users, usually intranet environment.

Scenario: I have had few request coming where users ask for an Anonymous feature for discussion board or custom list. Few solutions I came across were all around custom Input form and restrictive access to users and hidden views. All of the above seems doable, but I doubt all scenarios are covered for instance RSS Feeds and Web service calls.
OOB SharePoint has a functionality for Survey list which "Show user names in survey results?  " which basically in OM is SPlist.ShowUser = boolean value which is available for all SharePoint list but does it function as expected, Answer is yes.

I decided update my previous Client Tool, Show-Hide fields, which uses web services to Hide List Fields on different Form Pages, it made sense to add additional functionality of Masking User names as well.

It works exactly the same but has an additional Check box for Masking User Information thus.  On how to use the tool check the link here https://spyralout.com/releasestoolscode/moss-showhide-fields-using-web-services/

 

Below are screenshots for Masking User Info

List

image

Tool :

 

image

 

Click Update and Result

image

Download Link :

http://spiralout.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=22305

Extending SPFF

August 7, 2009 1 comment

Paul Grenier has created a wonderful script SPFF for manipulating Sharepoint form fields from URL. I have used javascript for field data manipulations a lot and his script makes it a breeze to implement. The fact that he has covered various forms of OOB fields is by itself worth having this as part of your toolbox.

You can download and read (extensive) documentation from codeplex http://spff.codeplex.com/

Extending SPFF:

Why?

I like URL based field manipulation, but it is not always enough and why just stick to one point of entry. If you are an user using Javascript for form manipulation you already hands on and wouldnt mind going crazy with the whole implementation script based implementation.

What:

1. There is a fix which lets you hide and set values for the fields from URL.

2. Now you can call these operation from your own Javascript code.

Download It is still uploaded as a path and waiting for approval.

E.g:

Setting values based on Drop Down values. We will use OOB task list.

In this example when a user selects “Status” as completed it will automatically set the percentage field to “100%”

image

image

Steps:

1. Follow instruction on how to load this Javascript and adding Content Editor to New/ Edit Form pagefrom Pauls codeplex page.

2. In Content Editor Source Editor Add the code below

<script language="javascript" type="text/javascript">
 _spBodyOnLoadFunctionNames.push("modifyflds");

function modifyflds()
 {
 $("select[title^=Status]").bind("change",statusChange);

}

function statusChange()
 {
 var Selected =$("select[title^=Status]").val() ;
 if(Selected=="Completed")
 $.spff({field:'% Complete',value:'100',lock:true});

}
 </script>

In the code above we are adding an “on Change” event handler on “Status” field. In the function we check if the field is completed using SPFF we set % Complete to 100%

Adding SharePoint Search plug-in for Firefox

June 16, 2009 4 comments

If you use Firefox search plugin and want to add your SharePoint intranet as part of the Firefox Search drop down, follow the steps below

First the screen shots of what we trying to accomplish

image

image

image

1. first create a blank xml file

2. Copy the text below and replace “sharepointurl.com” with your sharepoint url

 <searchplugin xmlns="http://www.mozilla.org/2006/browser/search/"><shortname>Sharepoint</shortname> <description>Search Internal Site.</description> <inputencoding>utf-8</inputencoding> <img height="16" width="16" />data:image/x-icon;base64,R0lGODlhMAAwAPcAANHORjF5xrtGJ5qWJtxlIyRZqhdYs8hGF8rZvXNxK7u0FChTmmfLZnPcc8jU6oHsgeHdM3zrfOiFRLfH5Cpzw8G7FXGZOeN6N6g5Jf39/ae73XDjcPH1+mvha9fbzB1SpY2LTvmZQ+vHwlrVWpPykozxjBthudVoNujmQ9NYHry6m2e6XvL48eXiKqmjL9iTiszlx9deIiNtwWTdZbi9pDlpsunmNdvs1xREmcnDLLbZrt2hmeqCOMhVJ9jUNNLNGFWqS0BttRRJpbxGN8vFFXzSdzZyvZrzmVPCU/ujT+3162KHMYnsiDVmq1WgOtnUHOC4r0ytSyVOlZWTNOby47WtGLm1OsVMIpXrk1yzTcpcMTp/yvKKN+l6LagoFvLc2WraaralS2eoNSJpvpyy2VzEW0SDyuTq9feTPKa1yOXCu/v089XQGU2LzomGK3G1Y/OZUvXk4thzQZ74nVCxT5a1KcvFG/37+ud2KeBsJbEqF6CcLE68Trg7KwY9oL7dt6T6o6wbCLs1E9jh8E6jQ6qiHmXVZSBhtvn6/dzZGyxmtkylSj95wMXgvriyK7U8H1a/VZ0zKff59czJO1/LXt7bKeNwJitaoK7VpYPbgNHMJ4mj0q+sI1i3VtnUJESIzYPvg3jJbV/YYFTOVZiv2HTndHzhe4PjglmuUc7IFqmnPaovHNPozq9BJ81QHNbSKcM9FB9lvPnu7SlfrN7aH8bAFFezVTBuvM/JHI/1jvCEL+/z+e7Py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BAi/UcGbtCIRvj0D0DtqldhcAMlrHEhGUDEMHaxCw6wlQPDGIZbEUEQSVDhrndVgl6VwAJJdKMbZ82IYAdL2MIa9rAECQgAOw==</img> <url template="http://sharepointurl.com/searchcenter/Pages/Results.aspx" method="GET" type="text/html">
<param value="{searchTerms}" name="k" /></url><searchform>http://sharepointUrl.com/searchcenter/</searchform> </searchplugin>

3. Save it under [Firefox install dir]\searchplugins\  as sharepoint.xml  usually “C:\Program Files\Mozilla Firefox\searchplugins”

4. Restart firefox

To use with with People search replace url with /SearchCenter/Pages/peopleresults.aspx

For IE you can use this site for custom search plugins http://www.microsoft.com/windows/ie/searchguide/en-en/default.mspx

Code Console Web Part

May 13, 2009 1 comment

Interesting project by Einar Otto Stangvik, Basically you can execute server side code using webpart directly using browser with SharePoint.

I should say  I haven’t tested it out but I can think of couple of ways it can be useful.

Click here for original blog post

http://einaros.blogspot.com/2009/05/codeconsole-web-part-for-sharepoint.html

Follow

Get every new post delivered to your Inbox.