Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 934165
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T20:57:17+00:00 2026-05-15T20:57:17+00:00

I’m trying to write a macro that will generate a plain-text list of files

  • 0

I’m trying to write a macro that will generate a plain-text list of files changed based on the list of files in the Pending Changes pane but I can’t figure out how to do it. The server location of a file is the property that is formatted like this:

$/TfsName/SomeSolution/Web/SomeFolder/SomeFile1.aspx
$/TfsName/SomeSolution/Web/SomeFolder/SomeFile2.aspx

The closest I can get is opening the properties of the selected item in the pane, which isn’t very useful:

DTE.ExecuteCommand ("TeamFoundationContextMenus.SourceControlPendingChangesSourceFiles.TfsContextPendingCheckinsPendingCheckinsProperties")

Edit: here’s the entire code for the macro I have so far, the TODOs are where I need help:

Public Class Pending

    Public Shared Sub Pending()
        OutputClear()
        OutputWriteLine("Files Changed:")

        Dim outInfo As String = ""
        DTE.Windows.Item("{2456BD12-ECF7-4988-A4A6-67D49173F564}").Activate() 'Pending Changes - Source Files

        'TODO: loop through each changed file
        'TODO: get TFS server location of each file
        outInfo &= "some file name"

        OutputWriteLine(outInfo)
    End Sub

    ' snip: other supporting functions

End Class
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T20:57:17+00:00Added an answer on May 15, 2026 at 8:57 pm

    Well I haven’t been able to figure out how to do it with a macro yet, but thanks to Bob Hardister on twitter, I can use this command to get what I’m looking for:

    "C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\tf.exe" status $/ProjectName/SubDir/ /recursive
    

    …but what works even better is a command-line app that uses this code:

    const string TFSSERVER = "http://TfsServer:8080";
    static void Main(string[] args)
    {
        //http://blogs.msdn.com/b/buckh/archive/2006/03/15/552288.aspx
        //http://blogs.msdn.com/b/jmanning/archive/2005/12/01/499033.aspx
        string projectName = args[0];
        TeamFoundationServer tfs = new TeamFoundationServer(TFSSERVER);
        VersionControlServer versionControl = (VersionControlServer)tfs.GetService(typeof(VersionControlServer));
        PendingSet[] sets = versionControl.GetPendingSets(new String[] { "$/Projects/" + projectName }, RecursionType.Full);
        Console.WriteLine(versionControl.AuthenticatedUser + " pending changes for " + projectName + ":");
    
        foreach (PendingSet set in sets)
        {
            if (set.Type == PendingSetType.Workspace && set.OwnerName == versionControl.AuthenticatedUser)
            {
                foreach (PendingChange pc in set.PendingChanges)
                {
                    Console.WriteLine(pc.ServerItem);
                }
            }
        }
    }
    

    Then I just added the compiled EXE call to the External Tools menu and use it within VS there.

    Bonus Edit: Here’s the VSS version (not as nice):

    const string SSDIR = @"\\VssServer\VssShare";
    static void Main(string[] args)
    {
        string projectName = args[0];
        string userName = "user";
    
        VSSDatabaseClass vss = new VSSDatabaseClass();
        vss.Open(SSDIR + @"\srcsafe.ini", userName, userName);
        VSSItem sourceItem = vss.get_VSSItem("$/Projects/" + projectName, false);
    
        Console.WriteLine(userName + " pending checkins for " + projectName + ":");
        int total = GetItems(sourceItem);
        Console.WriteLine(total.ToString() + " total changes.");
    
    }
    
    const int VSSFILE_CHECKEDOUT_ME = 2;
    const int VSSITEM_PROJECT = 0;
    const int VSSITEM_FILE = 1;
    public static int GetItems(IVSSItem originalItem)
    {
        int total = 0;
        foreach (IVSSItem subItem in originalItem.get_Items(false))
        {
            if (subItem.Type == VSSITEM_FILE && subItem.IsCheckedOut == VSSFILE_CHECKEDOUT_ME)
            {
                Console.WriteLine(subItem.Spec);
                total++;
            }
            else if (subItem.Type == VSSITEM_PROJECT)
            {
                total += GetItems(subItem);
            }
        }
        return total;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.