小编TS.*_*TS.的帖子

在通过API创建新的工作项时,无法获取TFS for AssignedTo字段中的有效用户列表

您好我正在尝试通过TFS API创建新的工作项,这是我在下面使用的方法,以获取可以分配工作项的有效用户列表.不知何故,它在validUserSids行上给了我一个空引用异常.谁知道这里有什么问题?

private string[] TFSUsers(string server)
    {
        // Get a Reference to Team Foundation Server.
        TeamFoundationServer tfs = tfsdata.GetTFS(server);
        // Get a reference to Group Security Service.
        IGroupSecurityService gss = (IGroupSecurityService)tfs.GetService(typeof(IGroupSecurityService));
        // Resolve to SIDs
        Identity validUserSids = gss.ReadIdentity(SearchFactor.AccountName, "TFS Valid Users", QueryMembership.Expanded);
        // Resolve to actual users
        Identity[] validUsers = gss.ReadIdentities(SearchFactor.Sid, validUserSids.Members, QueryMembership.None);
        List<string> Users = new List<string>();
        foreach (Identity user in validUsers)
        {
            Users.Add(user.DisplayName);
        }
        return Users.ToArray();
    }
Run Code Online (Sandbox Code Playgroud)

tfs visual-studio-2010 tfs-sdk tfs-workitem

4
推荐指数
1
解决办法
2573
查看次数

如何使用TFS API创建新的源代码分支?

我正在尝试使用API​​创建一个新分支,并使用了PendBranch()CreateBranch().问题CreateBranch()是它立即提交,我希望能够在签入分支时添加注释.所以,我所做的就是如下所示.

基本上我从我的Windows应用程序获取所有信息,如服务器项和本地项,以及分支的源和目标.

不知何故,当我看到Source Control Explorer时,它仍然会显示"Not mapped",即使我workspace.Get()在创建工作区后给出了:workspace.Map(serverItem,localItem)

任何人都可以阐明这一点吗?

public void CreateNewBranch(string server,string serverItem,string localItem,string sourceBranch, string targetBranch)
    {
        int changeSetNumber = 0;
        // Get a reference to Team Foundation Server and Source Control.
        tfs = GetTFS(server);
        // Create a new workspace for the currently authenticated user.             
      workspace = tfvc.CreateWorkspace("Example Workspace", tfvc.AuthenticatedUser);
        }
        // Create a mapping to the project.
        try
        {
           workspace.Map(serverItem, localItem);

            // Get the latest source files from …
Run Code Online (Sandbox Code Playgroud)

api version-control tfs branch new-operator

2
推荐指数
1
解决办法
5158
查看次数

如何使用tfs api获取与变更集ID相关联的工作项?

嗨,我需要以编程方式获取与所选变更集关联的工作项列表.到目前为止,我已经能够使用Artifacts的概念获取与工作项ID相关联的变更集,并使用以下方法获取与特定构建相关联的变更集和/或工作项:

InformationNodeConverters.GetAssociatedChangesets()和InformationNodeConverters.GetAssociatedWorkItems()分别.

我正在使用VSTS 2010 beta 1.任何人都知道解决方案吗?

api tfs workitem changeset visual-studio-2010-beta-1

2
推荐指数
1
解决办法
3267
查看次数