index > Team Foundation Server - Version Control > GetItems for folders not sorting?

GetItems for folders not sorting?


I noticed some wierd behaviour in the GetItems method. I used ItemType.Folders and RecursionLevel.Full.

What I wanted to do was get a list of folders under a given root. I wanted to use this to create a windows app with a treeview which mimiced the TFS Source Control Explorer.

But the list of folders returned is not sorted. It was trivial to export the folder names to an array and then sort it, but this seems like a bug?

P.S.: Originally posted in Build Automation but was told to post here.
DQM

Hello,

As far as I know it is not sorted; I am not sure it is a bug as it is not obvious what default sorting should be (ABC asc?). So in our Sidekick applications the sorting is performed internally in the application, not in TFS. Additionally, if you have both folders and files (with ItemType All), you will also have to sort that according to your app requirements.

Regards, Eugene




Blog at http://teamfoundation.blogspot.com
eugene.z
Like Eugene said, the output isn't sorted because different clients will want to use different IComparers depending on locale, etc.

Besides, if you're going to be displaying them in a GUI, you'll need to have a sorter associated with your WinForm control anyway so that the display remains sorted as it updates. Tim has a good blog post on how to do this: http://blogs.msdn.com/hippietim/archive/2006/03/20/555893.aspx
Richard Berg MSFT
Ok, thanks for clarifying. I assumed that the list returned would be sorted in the same order as folder names in Team Explorer GUI.

In my case I needed only the ServerItem values so extracting and sorting that was not a problem.
DQM
As Chandru noted in the other thread, sorting is
Richard Berg MSFT
reply 5

You can use google to search for other answers

 

More Articles

Massive confusion here...
Error using MSSCCI provider. <file>.sln not successfully w...
Unablke to connect to source control
VSS Converter error
Sql Server Error When Performing Merge
Heeeeeelp!! i cant unlock a file locked by other user!!
Reporting against TfsVersionControl
Version Control Folder
TF command to switch TFS servers?
Adding CC list to work item/bug?
Welcome to Bokebb   New Update   Joins the collection  
 

New Articles

TFS Folder Renames...
Tracing back a branch
Forward integrating (parent-to-child) bu…
Date Time Field in Source Control Explorer
GetItems for folders not sorted?
VSS and TFS coexisting
Check In: Operation not performed
Branch with DLL's files
Check In Comment
Merge problem in BetaR
Working folder confusion???
Workspaces - could not be found in your …
Compare between 2 label
TFS Proxy returns error in the middle of…
Team Projects Check-in Policy for manage…

Hot Articles

Get by ChangeSet Not Working; Bug?
Re-sizing and Sorting Columns in Work It…
VS SP1
multiple users on some specific work spa…
Problem with source control (Data is Nul…
Source branching questionnaire
Checkin problem in TFS MSSCCI Final
How-to Remove or reattach TFS Version Co…
Revision history in source file
Merging work-items
Check-in policy errors / suggestions / q…
Souce code comments
Changes since a label was applied
TFS source control path length limitation.
Perforce vs TFS?

Recommend Articles

Source tree collapses - get specific ver…
Project Alerts Feature Request - Limitin…
PIN and UNPIN event migration problem
Two different ID's seems to see the same…
Checkin changes on behalf of another user
Branching advice
problems with shared checkout - merge to…
TFS API - using ASP.net to checkout the …
Check-out error
Error when merging in TS
Writing Filters (VSEFL)
Upgraded from VSS, Web app bindings not …
Mapping Source Control Folder from Comma…
Msscci and sprax enterprise architect
Delete folder changes check in