Microsoft Team Foundation Server Python Library is a Microsoft TFS API Python client that can work with Microsoft TFS.
Feel free to use command "pip install pytfsclient"
- Install pytfsclient package
- Import package
import pytfsclient
from pytfsclient.client_factory import ClientFactory
- Create and configure Base TFS Client
### IF authentificate with PAT
client_connection = ClientFactory.create_pat('<personal access token>', 'https://tfs-server/tfs/', 'DefaultCollection/MyProject')
### OR with user name and password
client_connection = ClientFactory.create_ntlm('username', 'userpassword', 'https://tfs-server/tfs/', 'DefaultCollection/MyProject')
-
Get facade your need
3.1 If you want to manage workitems
workitem_client = ClientFactory.get_workitem_client(client_connection)
3.2 If you want to manage projects, teams, team members
project_client = ClientFactory.get_project_client(client_connection)
-
Manage TFS items
4.1 Managing workitems
wi = workitem_client.get_single_workitem(100500) print('Item: Id={}, Title={}, State={}'.format(wi.id, wi.title, wi['System.State'])) wi['Custom.Field'] = 'Value' wi.update_fields() print('Item custom field: {}'.format(wi['Custom.Field'])) workitems = client.get_workitems([1, 2, 3]) for wi in workitems: print('Item: id={}, Title={}'.format(wi.id, wi.title))
https://google.github.io/styleguide/pyguide.html
- It can send mentions to another user (see MentionClient::send_mention)
- It can get project identities (groups, teams, etc.) without Graph API.