SPList Properties


SPList.Ordered Property (Microsoft.SharePoint)
Gets or sets a Boolean value that specifies whether the option to allow users to reorder items in the list is available on the Edit View page for the list.

Namespace: Microsoft.SharePoint
Assembly: Microsoft.SharePoint (in microsoft.sharepoint.dll)
Syntax

Visual Basic (Declaration)
Public Property Ordered As Boolean
Visual Basic (Usage)
Dim instance As SPList
Dim value As Boolean

value = instance.Ordered

instance.Ordered = value
C#
public bool Ordered { get; set; }

Property Value

true if the option is available on the Edit View page; otherwise, false.
Remarks

The Ordered property is true by default for links lists. Setting this property to true for a list of base type Survey, IssueTracking, DocumentLibrary, or DiscussionBoard throws a System.NotSupportedException exception.

Example

The following code example adds to the Edit View page of the specified list the option to allow users to reorder items.

Visual Basic
Dim site As SPWeb = SPContext.Current.Web
Try
    Dim list As SPList = site.Lists("List_Name")
    list.Ordered = True
    list.Update()
Finally
    site.Dispose()
End Try
C#
SPWeb oWebsite = SPContext.Current.Web;
SPList oList = oWebsite.Lists["List_Name"];
oList.Ordered = true;
oList.Update();
See Also

Tags :


Community Content

Mpellos
How to set from UI?
This seems to be a very useful property as it allows to create views of the list where the user can manually set the order of the items. However, I cannot seem to find a way to set this property for a specific existing list, apart from doing it through code. Isn't there a UI setting for this? What other choices are there for changing this property?

One more thing. By setting the property to true, a user cannot simply change the order of the items. He first has to enable the view so that it can be reordered. The property of the view for doing that is SPView.OrderedView, but that is a readonly property and therefore cannot be set programmaticaly, only through the UI. Peculiar...

Any answers are more than welcome!
Tags :

Page view tracker