[Last Call] Learn how to a build a cloud-first strategyRegister Now


tfs getitems new files

Posted on 2009-04-22
Medium Priority
Last Modified: 2013-12-17
i'm making a vs addin and want to get files from our tfs. this command gives me all sql-files from the workspace instead of just the files which have changed. how can i just get the new ones?
VCService.GetItems(new ItemSpec("$/*.sql", RecursionType.Full), VersionSpec.Latest, DeletedState.NonDeleted, ItemType.File, true);

Open in new window

Question by:1eEurope
  • 3
  • 2
LVL 96

Expert Comment

by:Bob Learned
ID: 24213284
Hmmm...you must be talking about the VersionControlServer.GetItems method...and it appears that you are calling the overloaded method with this signature:

VersionControlServer.GetItems Method (String, VersionSpec, RecursionType, DeletedState, ItemType, Boolean)

Are these assumptions correct?

Author Comment

ID: 24213409
LVL 96

Expert Comment

by:Bob Learned
ID: 24213438
See, upon further reflection, I had the wrong signature...

It looks more like you are using this form:

VersionControlServer.GetItems Method (ItemSpec, VersionSpec, DeletedState, ItemType, Boolean)

What indication do you have that makes you feel that this is getting more than you need.  With that command and VersionSpec.Latest, it was my understanding that TFS would only get the items that changed, and replace those.

Author Comment

ID: 24213766
it returns a itemset of over 7500 entries which is pretty much all the files in the workspace. to download them i would have to make requests. maybe tfs compares files on download and not when i get the itemset. the status says ther where 0 operations and 0 errors. i want to know before i download because i dont always want to update everything.
Workspace workspace = VCService.GetWorkspace(workSpace);
request[0] = new GetRequest(new ItemSpec(tmp.itemId.ToString(), RecursionType.OneLevel), VersionSpec.Latest);
GetStatus status = workspace.Get(request, GetOptions.GetAll);

Open in new window


Accepted Solution

1eEurope earned 0 total points
ID: 24382336
there is apparently no method to get only the changed files. what i do now is go threw the itemset from
VersionControlServer.GetItems() and compare the file creationtime with the checkintime.
foreach (Item it in itemSet.Items)
                        file = new FileInfo(workspace.GetLocalItemForServerItem(it.ServerItem));
                        if (it.ServerItem != "" && it.CheckinDate.ToUniversalTime() > file.CreationTimeUtc)

Open in new window


Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Simulator games are perfect for generating sample realistic data streams, especially for learning data analysis. It is even useful for demoing offerings such as Azure stream analytics, PowerBI etc.
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Integration Management Part 2
Suggested Courses

826 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question