tfs getitems new files

Posted on 2009-04-22
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
    LVL 96

    Expert Comment

    by:Bob Learned 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?
    LVL 1

    Author Comment

    LVL 96

    Expert Comment

    by:Bob Learned
    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.
    LVL 1

    Author Comment

    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

    LVL 1

    Accepted Solution

    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

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Join & Write a Comment

    Suggested Solutions

    Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (…
    Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…

    745 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

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now