viernes, 10 de febrero de 2012

Team Foundation Server 2010: Enable checkin policy through code

  1. var projectCollectionUri = new Uri("http://tfs2010:8080/tfs/MyCollection");  
  2. var projectCollection = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(projectCollectionUri, new UICredentialsProvider())  
  3. projectCollection.EnsureAuthenticated();  
  4. var vcs = projectCollection.GetService<VersionControlServer>();   
  5. var teamProject = vcs.GetTeamProject("SomeTeamProject");  
  6. var workItemPolicy=new WorkItemPolicy();  
  7. foreach (PolicyType policyType in Workstation.Current.InstalledPolicyTypes)  
  8. {  
  9. if (policyType.Name == workItemPolicy.Type)  
  10.     {  
  11.         teamProject.SetCheckinPolicies(new PolicyEnvelope[] { new PolicyEnvelope(workItemPolicy, policyType) });  
  12. break;  
  13.     }  

 

Fuente:

http://bartwullems.blogspot.com/2012/02/team-foundation-server-2010-enable.html#

No hay comentarios:

Publicar un comentario