@@ -14,14 +14,22 @@ In order to connect to Azure DevOps, you need to obtain a [personal access token
14
14
# Import the VstsClient module
15
15
from vstsclient.vstsclient import VstsClient
16
16
17
- # Initialize the VSTS client using the VSTS instance and personal access token
17
+ # Initialize the VSTS client using the Azure DevOps url and personal access token
18
+ client = VstsClient(' dev.azure.com/<account>' , ' <personalaccesstoken>' )
19
+ ```
20
+ Or using the 'old' url.
21
+ ``` python
18
22
client = VstsClient(' <account>.visualstudio.com' , ' <personalaccesstoken>' )
19
23
```
20
24
### What about TFS?
21
25
To connect to an on-premises TFS environment you supply the server name and port number (default is 8080).
22
26
``` python
23
27
client = VstsClient(' tfs.contoso.com:8080' , ' <personalaccesstoken>' )
24
28
```
29
+ The VSTS client will pick the ` DefaultCollection ` by default. You can specify a different collection using the optional ` collection ` parameter.
30
+ ``` python
31
+ client = VstsClient(' tfs.contoso.com:8080' , ' <personalaccesstoken>' , ' <your collection>' )
32
+ ```
25
33
### Connecting from behind a proxy
26
34
``` python
27
35
client.set_proxy(' proxy.contoso.com' , 8080 , ' <username>' , ' <password>' )
@@ -34,7 +42,7 @@ Get all team projects in the project collection that the authenticated user has
34
42
from vstsclient.vstsclient import VstsClient
35
43
from vstsclient.constants import StateFilter
36
44
37
- client = VstsClient(' <account>.visualstudio .com' , ' <personalaccesstoken>' )
45
+ client = VstsClient(' dev.azure .com/<account> ' , ' <personalaccesstoken>' )
38
46
39
47
# StateFilter options are WellFormed (default), New, Deleting, CreatePending and All
40
48
projects = client.get_projects(StateFilter.WELL_FORMED )
@@ -43,7 +51,7 @@ projects = client.get_projects(StateFilter.WELL_FORMED)
43
51
``` python
44
52
from vstsclient.vstsclient import VstsClient
45
53
46
- client = VstsClient(' <account>.visualstudio .com' , ' <personalaccesstoken>' )
54
+ client = VstsClient(' dev.azure .com/<account> ' , ' <personalaccesstoken>' )
47
55
project = client.get_project(' Self-flying car' )
48
56
```
49
57
### Create a team project
@@ -55,7 +63,7 @@ from vstsclient.constants import (
55
63
SourceControlType
56
64
)
57
65
58
- client = VstsClient(' <account>.visualstudio .com' , ' <personalaccesstoken>' )
66
+ client = VstsClient(' dev.azure .com/<account> ' , ' <personalaccesstoken>' )
59
67
project = client.create_project(
60
68
' Self-flying car' , # Project name
61
69
' A project for our self-flying car' , # Project description
@@ -70,14 +78,14 @@ All work items have an area and an iteration field. The values that these fields
70
78
``` python
71
79
from vstsclient.vstsclient import VstsClient
72
80
73
- client = VstsClient(' <account>.visualstudio .com' , ' <personalaccesstoken>' )
81
+ client = VstsClient(' dev.azure .com/<account> ' , ' <personalaccesstoken>' )
74
82
areas = client.get_areas(' Self-flying car' )
75
83
```
76
84
#### Get the area tree with 2 levels of children
77
85
``` python
78
86
from vstsclient.vstsclient import VstsClient
79
87
80
- client = VstsClient(' <account>.visualstudio .com' , ' <personalaccesstoken>' )
88
+ client = VstsClient(' dev.azure .com/<account> ' , ' <personalaccesstoken>' )
81
89
areas = client.get_areas(' Self-flying car' , 2 )
82
90
83
91
for area in areas.children:
@@ -87,14 +95,14 @@ for area in areas.children:
87
95
``` python
88
96
from vstsclient.vstsclient import VstsClient
89
97
90
- client = VstsClient(' <account>.visualstudio .com' , ' <personalaccesstoken>' )
98
+ client = VstsClient(' dev.azure .com/<account> ' , ' <personalaccesstoken>' )
91
99
iterations = client.get_iterations(' Self-flying car' )
92
100
```
93
101
#### Get the iteration tree with 2 levels of children
94
102
``` python
95
103
from vstsclient.vstsclient import VstsClient
96
104
97
- client = VstsClient(' <account>.visualstudio .com' , ' <personalaccesstoken>' )
105
+ client = VstsClient(' dev.azure .com/<account> ' , ' <personalaccesstoken>' )
98
106
iterations = client.get_iterations(
99
107
' Self-flying car' , # Team project name
100
108
2 ) # Hierarchy depth
@@ -107,22 +115,22 @@ for iteration in iterations.children:
107
115
``` python
108
116
from vstsclient.vstsclient import VstsClient
109
117
110
- client = VstsClient(' <account>.visualstudio .com' , ' <personalaccesstoken>' )
118
+ client = VstsClient(' dev.azure .com/<account> ' , ' <personalaccesstoken>' )
111
119
area = client.get_area(' Self-flying car' , ' Engine' )
112
120
```
113
121
#### Get an iteration
114
122
``` python
115
123
from vstsclient.vstsclient import VstsClient
116
124
117
- client = VstsClient(' <account>.visualstudio .com' , ' <personalaccesstoken>' )
125
+ client = VstsClient(' dev.azure .com/<account> ' , ' <personalaccesstoken>' )
118
126
iteration = client.get_iteration(' Self-flying car' , ' Sprint 1' )
119
127
```
120
128
### Create an area and iteration
121
129
#### Create an area
122
130
``` python
123
131
from vstsclient.vstsclient import VstsClient
124
132
125
- client = VstsClient(' <account>.visualstudio .com' , ' <personalaccesstoken>' )
133
+ client = VstsClient(' dev.azure .com/<account> ' , ' <personalaccesstoken>' )
126
134
area = client.create_area(
127
135
' Self-flying car' , # Team project name
128
136
' Engine' ) # Area name
@@ -134,7 +142,7 @@ from vstsclient.vstsclient import VstsClient
134
142
start_date = datetime.datetime.utcnow() # Sprint starts today
135
143
finish_date = start_date + datetime.timedelta(days = 21 ) # Ends in 3 weeks
136
144
137
- client = VstsClient(' <account>.visualstudio .com' , ' <personalaccesstoken>' )
145
+ client = VstsClient(' dev.azure .com/<account> ' , ' <personalaccesstoken>' )
138
146
iteration = client.create_iteration(
139
147
' Self-flying car' , # Team project name
140
148
' Sprint 1' , # Iteration name
@@ -147,14 +155,14 @@ iteration = client.create_iteration(
147
155
``` python
148
156
from vstsclient.vstsclient import VstsClient
149
157
150
- client = VstsClient(' <account>.visualstudio .com' , ' <personalaccesstoken>' )
158
+ client = VstsClient(' dev.azure .com/<account> ' , ' <personalaccesstoken>' )
151
159
workitems = client.get_workitems_by_id(' 1,2,3,5,8,13,21,34' )
152
160
```
153
161
### Get a work item
154
162
``` python
155
163
from vstsclient.vstsclient import VstsClient
156
164
157
- client = VstsClient(' <account>.visualstudio .com' , ' <personalaccesstoken>' )
165
+ client = VstsClient(' dev.azure .com/<account> ' , ' <personalaccesstoken>' )
158
166
workitem = client.get_workitem(13 )
159
167
```
160
168
### Create a work item
@@ -164,7 +172,7 @@ from vstsclient.vstsclient import VstsClient
164
172
from vstsclient.models import JsonPatchDocument, JsonPatchOperation
165
173
from vstsclient.constants import SystemFields, MicrosoftFields
166
174
167
- client = VstsClient(' <account>.visualstudio .com' , ' <personalaccesstoken>' )
175
+ client = VstsClient(' dev.azure .com/<account> ' , ' <personalaccesstoken>' )
168
176
169
177
# Create a JsonPatchDocument and provide the values for the work item fields
170
178
doc = JsonPatchDocument()
@@ -184,7 +192,7 @@ from vstsclient.vstsclient import VstsClient
184
192
from vstsclient.models import JsonPatchDocument, JsonPatchOperation
185
193
from vstsclient.constants import SystemFields
186
194
187
- client = VstsClient(' <account>.visualstudio .com' , ' <personalaccesstoken>' )
195
+ client = VstsClient(' dev.azure .com/<account> ' , ' <personalaccesstoken>' )
188
196
189
197
# Create a JsonPatchDocument and provide the values for the fields to update
190
198
doc = JsonPatchDocument()
@@ -196,13 +204,13 @@ workitem = client.update_workitem(13, doc)
196
204
#### Change work item type
197
205
NOTE: Only supported on Azure DevOps (not on TFS).
198
206
``` python
199
- client = VstsClient(' <account>.visualstudio .com' , ' <personalaccesstoken>' )
207
+ client = VstsClient(' dev.azure .com/<account> ' , ' <personalaccesstoken>' )
200
208
client.change_workitem_type(13 , ' Task' )
201
209
```
202
210
#### Move a work item
203
211
NOTE: Only supported on Azure DevOps (not on TFS).
204
212
``` python
205
- client = VstsClient(' <account>.visualstudio .com' , ' <personalaccesstoken>' )
213
+ client = VstsClient(' dev.azure .com/<account> ' , ' <personalaccesstoken>' )
206
214
207
215
# To move a work item, provide the Team Project, Area path and Iteration path to move to
208
216
client.move_workitem(13 , ' Contoso' , ' Contoso' , ' Sprint 1' )
0 commit comments