尽管有权限,但以编程方式在TFS中签出和签入文件时出错

问题描述 投票:0回答:2

我想以编程方式连接到TFS并能够签出并签入文件。为此目的,我使用下面的代码(省略了一些私人信息),但是,我得到“没有足够的权限错误”,我已经与管理员核实过,他给了我读写权限,任何人都可以请帮我。这是代码:

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
        }
    }
}

我收到的错误是这样的:

另外,我查看了This MS Page的权限,我有GENERIC_READ和GENERIC_WRITE权限。

c# tfs tfs-sdk
2个回答
© www.soinside.com 2019 - 2024. All rights reserved.