none
How to get previous path of renamed.moved of file using TFS API

Answers

  • Hi,

    You can use QueryHistory to query all history of the Item,

    VersionControlServer vcs = ...;
                string serverItemName = ...;
                System.Collections.IEnumerable changesets = vcs.QueryHistory(
                    serverItemName,
                    VersionSpec.Latest,
                    0,
                    RecursionType.None,
                    null,
                    new ChangesetVersionSpec(1),
                    VersionSpec.Latest,
                    int.MaxValue,
                    true,
                    false
                    );
                foreach (Changeset changeset in changesets)
                {
                    //this changeset that gotten in this way only includes one change, even though there may many changes indeed
                    Console.WriteLine(string.Format("ChangeType:{0}\tServerItem:{1}"
                        , changeset.Changes[0].ChangeType
                        , changeset.Changes[0].Item.ServerItem
                        ));
    
    
                }

    The change type may be

            None = 1,
            Add = 2,
            Edit = 4,
            Encoding = 8,
            Rename = 16,
            Delete = 32,
            Undelete = 64,
            Branch = 128,
            Merge = 256,
            Lock = 512,


    Best regards,
    Ruiz

    Thursday, April 01, 2010 11:31 AM
    Moderator