I want to programatically connect to TFS and be able to checkout and checkin the files. For that purpose, I am using the following code (some private information omitted), however, I get the "not having sufficient permissions error", I have checked with the administrator and he has given me both read and write permissions, can anyone please help me. Here's the code:
using System;
using Microsoft.TeamFoundation.Client;
using Microsoft.TeamFoundation.VersionControl.Client;
namespace CodeGeneration
{
public class CheckInTFS
{
public static void ProcessFile()
{
var tfs = new TfsTeamProjectCollection(new Uri("http://tfs"));
var versionControlServer = tfs.GetService<VersionControlServer>();
var workspace = versionControlServer.GetWorkspace(@"D:\Test");
#region Checkout File
var file = @"D:\EnumGeneration.cs";
workspace.PendEdit(file);
var pendingChange = workspace.GetPendingChanges();
#endregion
#region Checkin File
workspace.CheckIn(pendingChange, "Test Comment!");
#endregion
}
}
}
The error which I receive is this:
Also, I have looked at the permissions from This MS Page and I have GENERIC_READ and GENERIC_WRITE permissions.