Comments (5)
@dgtlrift, there is no "clean" way (yet) to do it with our library.
However, the connection.create_workitem
method has the relations_raw
parameter that you could use to add links right away.
The code for using relations_raw
should look like this:
existing_wi = TFSAPI.get_workitem(123)
parent_link_raw =
[
{
"rel": "System.LinkTypes.Hierarchy-Reverse", # existing WI will be a parent, new WI will be a child
"url": existing_wi.url
"attributes": {
"isLocked": false
}
},
]
new_wi = TFSAPI.create_workitem("Task", parent_link_raw)
This is a temporary solution as we are yet to implement adding "normal" links, attachments and now raw JSON, but it should work.
from tfs.
@ihar512, sorry for the delay.
Troubleshooting steps would be the following:
- Ensure that creating a regular (non-linked) item works:
new_wi = client.create_workitem("Task")
- Ensure that linking that item to the parent item works:
new_wi.add_relations_raw(parent_link_raw)
Let me know if you need any extra info on any of these steps.
When both creation and linking work, the whole thing should also work.
from tfs.
@SAnCherepan I actually tried what you suggested and it doesn't seems to work. Here is the error I am getting, could you give me some suggestions? Thanks.
Traceback (most recent call last):
File "tfsfsa.py", line 40, in
new_wi = client.create_workitem("Task", fields=None, relations_raw=parent_link_raw)
File "C:\Python36\tfs\connection.py", line 197, in create_workitem
api_version)
File "C:\Python36\tfs\connection.py", line 170, in __create_workitem
raw = self.rest_client.send_post(uri=uri, data=data, headers=headers, project=True, payload=params)
File "C:\Python36\tfs\connection.py", line 343, in send_post
return self.__send_request('POST', uri, data, headers, payload=payload, project=project)
File "C:\Python36\tfs\connection.py", line 386, in __send_request
response.status_code, result['error'] if 'error' in result else response.reason))
tfs.connection.TFSClientError: TFS API returned HTTP 400 (Bad Request)
from tfs.
Also here is my code,
existing_wi = client.get_workitem(9133)
parent_link_raw = [
{
"rel": "System.LinkTypes.Hierarchy-Reverse", # existing WI will be a parent, new WI will be a child
"url": existing_wi.url,
"attributes": {
"isLocked":False
}
},
]
new_wi = client.create_workitem("Task", relations_raw=parent_link_raw)
from tfs.
@SAnCherepan, I was able to resolve this issue with your suggestion. Thank you!
from tfs.
Related Issues (20)
- If the results of a tfs query are displayed in a tree structure, the workitems cannot be obtained when using the tfs library for query. The code reports an error as shown in the figure, and requests assistance in troubleshooting the cause of the problem.
- Support TFS2018 HOT 7
- Unable to create work items HOT 3
- 401 error with Django HOT 3
- get Changeset from Workteim HOT 1
- name 'tfs' is not defined HOT 4
- 'TFSAPI' object has no attribute 'create_workitem' HOT 3
- Help needed in understanding how to use TFSHTTPClient HOT 20
- Trying to get WI changelog (WI history) HOT 2
- Help with create_workitem with relations HOT 1
- 401 Client error : Unauthorized error when using HttpNegotiateAuth in IIS 10 HOT 3
- any AzureDevops compatible? HOT 1
- support of TFS2010?
- dohq-tfs Library not working with Python version 3.6.12 and above. Was working fine with version 3.6.11. Any plans to make it compatible with higher python versions? HOT 1
- ConnectionError: HTTPSConnectionPool
- Getting 404 url error when trying to create a work item HOT 1
- Unable to create work item on tfs via python TFS API.
- How to get tf diff by this ttools?
- HTTP 201 (Created) being treated as an error HOT 6
- Move CI to Github Actions
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tfs.