Quantcast
Channel: SharePoint 2010 - Development and Programming forum
Viewing all articles
Browse latest Browse all 11571

sort order in list wrong: in CAML and in view

$
0
0

Hello,

When I order my list with document sets by ID, the order is wrong. It is wrong in the list and with caml.

This is my view (I just set the sort on the ID column):

The first 4 objects are created by the Client Object Model; the last 4 are created by a SharePoint webpart that I developped myself...

My code for creating document sets in COM is something like this:

ListItemCreationInformation newItemInfo = new ListItemCreationInformation
{
     UnderlyingObjectType = FileSystemObjectType.Folder,
     LeafName = _strLeafname // = date in format YYYYMMDDhhmmss
};

ListItem newListItem = myList.AddItem(newItemInfo);

newListItem["ContentTypeId"] = targetDocumentSetContentType.Id.ToString();
newListItem["Title"] = title;
newListItem.Update();

clientContext.Load(myList);
clientContext.ExecuteQuery();

The code in the webpart is this:

SPContentType docsetCt = myLst.ContentTypes[p.GetFromResourcefile("xxxxxxxxxxxxxx")];
Hashtable properties = new Hashtable
{
	{"DocumentSetDescription", ""},
        {"Title", txtTitle.Text}
};

SPFolder parentFolder = myLst.RootFolder;
int newId = GetLastId(myLst) + 1;
DocumentSet ds = DocumentSet.Create(parentFolder, newId.ToString(CultureInfo.InvariantCulture),                            docsetCt.Id, properties, true);

ds.Item["Title"] = title
ds.Item.Update();

why is the sort order wrong?

if i do this query in the U2U Caml builder, the order is also wrong

<OrderBy><FieldRef Name='ID' Ascending='FALSE' /></OrderBy>

if i order by "created", the order is also wrong....

i don't get it....


Viewing all articles
Browse latest Browse all 11571

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>