假设我在TFS中创建了一个工作项.然后我进行更改并更新"历史记录"选项卡中的文本(然后保存).
使用TFS API,我如何获得该文本?
我原本以为它会出现在工作项的Revisions集合中最后一项的History字符串中.(因为要通过API设置字符串,您可以在正常工作项上使用历史记录.)但是,在Revisions数组中,所有工作项都显示为History为空.
关于如何获得这个字符串的任何想法?
我正在尝试用C#编写一个小的Relase Notes程序.我需要在指定日期之间获取所有变更集和相关工作项属于指定项目.
我试图使用QueryHistory方法,但我找不到如何给出日期过滤器.
我正在编写一个实用程序来读取遗留错误跟踪系统中的所有缺陷,并将它们导入TFS(2008/2010).我正在使用TFS API创建新的WorkItems,设置它们的字段,然后保存它们.但是,我无法修改"创建者"和"创建日期"字段,因为这些字段是由系统设置的.(还有其他字段,我希望能够强制使用值,例如将提交者设置为不是有效TFS用户的人)
// these fail with "The value for the field 'Created By' cannot be changed."
defectWorkItem.Fields["Created By"].Value = defect.Submitter;
defectWorkItem.Fields["Created Date"].Value = defect.SubmitDate;
Run Code Online (Sandbox Code Playgroud)
显然,如果我不能设置这些字段,我将最终得到所有遗留的错误,看起来它们是由同一个人在同一天创建的.
有没有办法可以使用API但强制通过更改通常受保护的字段?我已经考虑直接访问TFS数据库表,但架构看起来很复杂,我认为尝试自己修改数据会很危险.
我正在尝试在使用TFS2010 API的ASP.NET网站中启用passthrough或模拟身份验证.
我已经使用Cassini正常工作,但是在IIS 7.5(Windows 7)中出现了问题.
我发现了关于这个主题的博客文章,并尝试了以下内容:
private static void Test()
{
TfsTeamProjectCollection baseUserTpcConnection =
new TfsTeamProjectCollection(new Uri(Settings.TfsServer));
// Fails as 'baseUserTpcConnection' isn't authenticated
IIdentityManagementService ims =
baseUserTpcConnection.GetService<IIdentityManagementService>();
// Read out the identity of the user we want to impersonate
TeamFoundationIdentity identity = ims.ReadIdentity(
IdentitySearchFactor.AccountName,
HttpContext.Current.User.Identity.Name,
MembershipQuery.None,
ReadIdentityOptions.None);
TfsTeamProjectCollection impersonatedTpcConnection = new
TfsTeamProjectCollection(new Uri(Settings.TfsServer),
identity.Descriptor);
}
Run Code Online (Sandbox Code Playgroud)
当我使用卡西尼时,除此之外不需要任何东西
collection = new TfsTeamProjectCollection(new Uri(server));
我已启用web.config设置(并安装了Windows Auth模块):
<authentication mode="Windows"/>
<identity impersonate="true" />
Run Code Online (Sandbox Code Playgroud)
有什么明显的东西我错过了吗?
我们以编程方式生成部署电子邮件,基于自上次部署的构建以来变更集和相关工作项的历史记录.它们看起来有点像Visual Studio中的构建摘要信息(但结合了许多构建).
数据中似乎有一些有用的URL(比如vstfs:///VersionControl/Changeset/205151),但对于TFS SDK是新手,我不知道这是否/如何映射到可查看的项目(例如http:// tfsserver:port/somepath/...).Visual Studio中的构建摘要链接是可单击的,但它们是仅限VS的链接吗?
如果可能的话,我们想在电子邮件中包含打开相关项目的链接(在浏览器中?),所以我想我需要知道TFS路径是否可以通过网络浏览,如果是的话,怎么样?
建议欢迎.谢谢.
我正在尝试以编程方式从安装服务器的域外部访问我的TFS服务器.基本测试程序如下所示:
class Program
{
static void Main(string[] args)
{
Uri tfsUri = new Uri("<serverUri>");
TfsConfigurationServer _ConfigurationServer = TfsConfigurationServerFactory.GetConfigurationServer(tfsUri);
CatalogNode projectCollectionCatalog = _ConfigurationServer.CatalogNode.QueryChildren(new[] { CatalogResourceTypes.ProjectCollection }, false, CatalogQueryOptions.None)[0]; // actual connection tries to happen here
}
}
Run Code Online (Sandbox Code Playgroud)
另一个版本,强制凭据:
class Program
{
static void Main(string[] args)
{
Uri tfsUri = new Uri("<serverURI>");
TfsConfigurationServer _ConfigurationServer = new TfsConfigurationServer(tfsUri, new NetworkCredential("<DifferentKindOfUsernames>", "<Password>"));
CatalogNode projectCollectionCatalog = _ConfigurationServer.CatalogNode.QueryChildren(new[] { CatalogResourceTypes.ProjectCollection }, false, CatalogQueryOptions.None)[0];
}
}
Run Code Online (Sandbox Code Playgroud)
另一个版本混合了以前的版本:
public class ConnectByImplementingCredentialsProvider : ICredentialsProvider
{
public ICredentials GetCredentials(Uri uri, …Run Code Online (Sandbox Code Playgroud) 我有许多基于TFS中的单个分支(例如Main)执行的构建定义.
我想(以某种方式)查询TFS以查找包含我提供的特定变更集编号的所有构建,并返回TFS包含的构建名称的字符串列表.任何类型的应用程序(VS扩展,CLI应用程序,winforms,等等)都可以.
注意:这不是'请给我代码'请求; 我愿意嘲笑它并在此做认真的工作.有关如何查询数据库或SDK的文档的任何指针,或者如何查询构建的示例; 只是一些开始寻找的地方会非常有帮助.谢谢.
使用TFS API和SSRS生成PDF,Excel,Word或TIFF格式的报告是否有简单的方法?我可以通过使用用于TFS的SSRS仪表板从组合框中选择参数来手动生成报告,但我想在我的Web应用程序中包含一个导出按钮,以便我可以轻松绕过Team Web Access生成报告.有任何想法吗?
我在这篇文章中读到我可以使用ReportExecutionServiceSSRS中的类,所以我想知道是否可以从TFS服务器使用它.
我使用此Web服务引用导入了命名空间:
http://<TFS server>/reportserver/ReportExecution2005.asmx
我正在尝试编写一个小脚本来将所有用户图像设置为他们的AD图像,我在ILSpy中做了一些跳转并找到了使用TFS服务器API设置的内容,但是代码需要有点不同,因为我' m而是使用客户端API.
我下面的代码可以成功遍历tfs中的所有用户,在AD中查找它们,获取缩略图,在TFS标识上设置属性.但我不能为我的生活图获得扩展属性以保存回TFS.
代码没有异常,但是当我下次运行应用程序时,属性未设置为我设置的值.
有谁知道通过客户端api保存扩展属性的方法?
Microsoft.TeamFoundation.Client.TeamFoundationServer teamFoundationServer = new Microsoft.TeamFoundation.Client.TeamFoundationServer("{URL TO TFS}");
FilteredIdentityService service = teamFoundationServer.GetService<FilteredIdentityService>(); ;
IIdentityManagementService2 service2 = teamFoundationServer.GetService<IIdentityManagementService2>();
foreach (var identity in service.SearchForUsers(""))
{
var user = UserPrincipal.FindByIdentity(new PrincipalContext(ContextType.Domain), identity.UniqueName);
if (user == null) continue;
var de = new System.DirectoryServices.DirectoryEntry("LDAP://" + user.DistinguishedName);
var thumbNail = de.Properties["thumbnailPhoto"].Value as byte[];
identity.SetProperty("Microsoft.TeamFoundation.Identity.CandidateImage.Data", thumbNail);
identity.SetProperty("Microsoft.TeamFoundation.Identity.CandidateImage.UploadDate", DateTime.UtcNow);
service2.UpdateExtendedProperties(identity);
}
Run Code Online (Sandbox Code Playgroud) 我试图在TFS服务器上执行WIQL查询(按照此示例)并获取具有tittle和其他字段的工作项.即使我在输出中定义了我想要的列,json也只返回id和url.
询问
Select [System.Title],
[System.Description],
[System.WorkItemType],[System.Id]
From WorkItems
Where [System.WorkItemType] = 'Task'
AND [State] <> 'Closed'
AND [State] <> 'Removed'
AND [System.AssignedTo] = @me
order by [Microsoft.VSTS.Common.Priority] asc, [System.CreatedDate] desc
Run Code Online (Sandbox Code Playgroud)
杰森回来了
{"queryType":"flat","queryResultType":"workItem","asOf":"2016-03-18T22:53:15.777Z","columns":[{"referenceName":"System.Title","name":"Title","url":"http://<my tfs server>/tfs/DefaultCollection/_apis/wit/fields/System.Title"},{"referenceName":"System.Description","name":"Description","url":"http://<my tfs server>/tfs/DefaultCollection/_apis/wit/fields/System.Description"},{"referenceName":"System.WorkItemType","name":"Work Item Type","url":"http://<my tfs server>/tfs/DefaultCollection/_apis/wit/fields/System.WorkItemType"},{"referenceName":"System.Id","name":"ID","url":"http://<my tfs server>/tfs/DefaultCollection/_apis/wit/fields/System.Id"}],"sortColumns":[{"field":{"referenceName":"Microsoft.VSTS.Common.Priority","name":"Priority","url":"http://<my tfs server>/tfs/DefaultCollection/_apis/wit/fields/Microsoft.VSTS.Common.Priority"},"descending":false},{"field":{"referenceName":"System.CreatedDate","name":"Created Date","url":"http://<my tfs server>/tfs/DefaultCollection/_apis/wit/fields/System.CreatedDate"},"descending":true}],"workItems":[{"id":6760,"url":"http://<my tfs server>/tfs/DefaultCollection/_apis/wit/workItems/6760"},{"id":6734,"url":"http://<my tfs server>/tfs/DefaultCollection/_apis/wit/workItems/6734"},{"id":6731,"url":"http://<my tfs server>/tfs/DefaultCollection/_apis/wit/workItems/6731"},{"id":6526,"url":"http://<my tfs server>/tfs/DefaultCollection/_apis/wit/workItems/6526"},{"id":6525,"url":"http://<my tfs server>/tfs/DefaultCollection/_apis/wit/workItems/6525"},{"id":6524,"url":"http://<my tfs server>/tfs/DefaultCollection/_apis/wit/workItems/6524"},{"id":6514,"url":"http://<my tfs server>/tfs/DefaultCollection/_apis/wit/workItems/6514"},{"id":6372,"url":"http://<my tfs server>/tfs/DefaultCollection/_apis/wit/workItems/6372"},{"id":6371,"url":"http://<my tfs server>/tfs/DefaultCollection/_apis/wit/workItems/6371"},{"id":6235,"url":"http://<my tfs server>/tfs/DefaultCollection/_apis/wit/workItems/6235"},{"id":6218,"url":"http://<my tfs server>/tfs/DefaultCollection/_apis/wit/workItems/6218"},{"id":6123,"url":"http://<my tfs server>/tfs/DefaultCollection/_apis/wit/workItems/6123"},{"id":6122,"url":"http://<my tfs server>/tfs/DefaultCollection/_apis/wit/workItems/6122"},{"id":6121,"url":"http://<my tfs server>/tfs/DefaultCollection/_apis/wit/workItems/6121"},{"id":6120,"url":"http://<my tfs server>/tfs/DefaultCollection/_apis/wit/workItems/6120"}]}
Run Code Online (Sandbox Code Playgroud)
是否有任何标志我应该传递给查询,以便我可以在输出上获取这些字段?