Following situation:
- I do have an eventsubscription to a WorkItem changed Event.
- The workitem got created by a Build-Process (integrationbuild field is set
to the build) using the CreateNewWorkItem-Task
I want following done:
- In the workitem changed event, the build quality of the "associated" build
should be changed.
Questions:
- How do I get a reference to the Build from the workitem programatically?
- How is is possible to retrieve the Build Uri from the workitem?
Thanks for your help!
Regards
You should be able to change build quality in the event handler for
WorkItemChangedEvent programmatcially. Another way is to use
SetBuildProperties task to set build quality during a build. You can refer
to http://msdn.microsoft.com/en-us/library/bb399143.aspx for more
information about SetBuildProperties task.
In your build definition, you can override AfterCreateWorkItem target to
set build quality. This target executes after a work item is created during
a build. For example:
<Target Name="AfterCreateWorkItem">
<SetBuildProperties
TeamFoundationServerUrl="$(TeamFoundationServerUrl)"
BuildUri="$(BuildUri)"
Quality="Rejected">
</SetBuildProperties>
If you do want to set the build quality programmatically in the event
handler, please let me know and I will make more research and reply you
later.
Regards,
Bill Wang
Microsoft Online Community Support
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msd...@microsoft.com.
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
thanks - but I need a way using c#.
Just to describe the mechanism:
- The automatic build creates a workitem filling the "integrationfields" on
success (just kinda the assignment to deploy the build)
- After being deployed someone changes the state of the workitem to i.e.
something like 'staging' or 'production'.
- Just to keep the build-list (All-Build-Definitions List) in sync with the
workitem, we would want the build-quality having the same value as the state
of the workitem.
To achieve this I thought about implementing a eventlistener webservice that
gets notified on the workitemchanged event. I do get the id for the workitem,
but I am not sure how to get the according build to change the build quality.
I'd need the build Uri and don't know how to get it out of the workitem.
Do you have any idea?
Thanks alot!
Tom
I just created a sample web application project which handles the
WorkItemChangedEvent. It reads the build number from the
Microsoft.VSTS.Build.IntegrationBuild field of a work item, then change its
build quality.
I uploaded the sample solution at
http://ttgl1w.bay.livefilestore.com/y1pd-h6rxGp-WRlbnQ11FdlS72sql-EpZLQM4Y6v
KQvu0BC4iMAdXJlmJJNZlYTEBriKZCupEt4tldYsqZaoUsyjoGhmNQgGBwM/TfsTools.zip?dow
nload.
In order to read work items and change build quality, the identity of the
IIS application pool used by your event handler must have the following
permissions:
- Edit build quality
- Edit work items
Fore more information about TFS permissions, please refer to
http://msdn.microsoft.com/en-us/library/ms252587.aspx. Please let us know
if you meet any issues.
Regards,
Bill Wang
Microsoft Online Community Support
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msd...@microsoft.com.
This posting is provided "AS IS" with no warranties, and confers no rights.
thanks for your solution. I was thinking about passing the $(BuildUri) from
Build to a custom field in my workitem as a workaround. But I like your way
more and gonna do it like that!
Thanks again!
Regards,
Tom
Glad to hear it helps. I'm going to close this thread. It's my pleasure to
work with you. Please feel free to open a new thread in newsgroup or TFS
forums if you meet other issues.