0

I am working on intelliJ plugin to create check-in policy: I need to know how many check-in policies are applied on particular branch. I am using TFS JAVA SDK for retrieving the check-in policy configuration. But it is returning empty. Please refer my another issue at "PolicyDefinition result return empty collection using Java SDK of TFS 2015 "tp.getCheckinPolicies()" or "vcc.getCheckinPoliciesForServerPaths()""

Then I tried using REST API to understand if I can get policy definition using REST URL.

Constructing URL as given below as per example available on Microsoft blog “https://www.visualstudio.com/en-us/docs/integrate/api/policy/configurations”:

GET https://{instance}/defaultcollection/{project}/_apis/policy/configurations?api-version={version}[&$top={top}&$skip={skip}]

My URL: https://TFSServer/tfs/PC1/CP/_apis/policy/configurations?api-version=2.0-preview

This return empty collection. {"count":0,"value":[]}

I have on premise TFS and it is configured with TFVC services not GIT.

I have following doubts:

  1. Does REST API is applicable for TFVC or it is only for GIT collection.
  2. How to query TFS server for check in policy using SOAP API.
  3. Need to know if TFS JAVA SDK consume the same REST API or SOAP APIs.
  4. What is wrong in my URL?
Community
  • 1
  • 1
Subodh
  • 13
  • 5

2 Answers2

0

Check-in policies and branch policies are totally different, unrelated things.

Check-in policies are for TFVC and only TFVC. Branch policies are for Git and only Git.

The API you're using is for branch policies.

As far as I recall, there's no API for check-in policies. This goes for both the old-style SOAP APIs and the new-style REST APIs.

Daniel Mann
  • 57,011
  • 13
  • 100
  • 120
  • Thank you Daniel for your answer but I have doubt about "As far as I recall, there's no API for check-in policies". I am refering TFS JAVA SDK and it has method to retrieve already defined policies based on server path. Unfortunately that is not working. Please have a look of my "https://stackoverflow.com/questions/47840712/policydefinition-result-return-empty-collection-using-java-sdk-of-tfs-2015-tp-g" post and see line 15 & 20 and advise if I my understanding wrong. – Subodh Feb 12 '18 at 21:35
  • You may try `Workstation.InstalledPolicyTypes Property`: https://msdn.microsoft.com/en-us/library/microsoft.teamfoundation.versioncontrol.client.workstation.installedpolicytypes(v=vs.120).aspx – Cece Dong - MSFT Feb 13 '18 at 09:14
  • Workstation.InstalledPolicyTypes Property available in .Net but not in TFS Java SDK. – Subodh Feb 13 '18 at 15:46
0

Java SDK you used in your previous case is correct, but it can only get check-in policies in Java based tools, such as Team Explorer Everywhere. You can't get the check-in policies that added in VS with Java SDK.

Cece Dong - MSFT
  • 29,631
  • 1
  • 24
  • 39