여기에있는 대부분의 방법을 사용하는 빠르고 간단한 코드 샘플이 있습니다.
using Microsoft.TeamFoundation.Client;
using Microsoft.TeamFoundation.VersionControl.Client;
public void MoveFile(string tfsServer, string oldPath, string newPath)
{
TeamFoundationServer server = TeamFoundationServerFactory.GetServer(tfsServer, new UICredentialsProvider());
server.EnsureAuthenticated();
VersionControlServer vcserver = server.GetService(typeof(VersionControlServer);
string currentUserName = server.AuthenticatedUserName;
string currentComputerName = Environment.MachineName;
Workspace[] wss = vcserver.QueryWorkspaces(null, currentUserName, currentComputerName);
foreach (Workspace ws in wss)
{
foreach (WorkingFolder wf in wfs)
{
bool bFound = false;
if (wf.LocalItem != null)
{
if (oldPath.StartsWith(wf.LocalItem))
{
bFound = true;
ws.PendRename(oldPath, newPath);
break;
}
}
if (bFound)
break;
}
}
}