I am unexpectedly taking over for the previous administrator of our TFS system who left the company rather abruptly. I was made an admin of TFS and on the TFS application server before this happened, but there is still at least one thing I can't figure out. It seems there are some alerts set up under the previous administrator's account that sends email to all of us whenever a file is checked in. I can't say for sure exactly what this subscription looks like, but I'm guessing it's either in the "Project Alerts" dialog for the project, or it's an alert set up with TFS Power Tools' Alert Editor. I can't see alerts set up by other users in these areas. Is there any way short of directly editing the tbl_subscription table directly to try removing or changing these alerts? (I think I see the alert in that SQL table, but I don't want to directly hack the database.)
6 Answers
Welcome to the world of TFS - sorry that your baptism is going to be one of fire.
You are correct to be wary of editing the database directly - always best avoided with TFS. The TFS Event Subscription tool (originally crafted by this sites creator) should be able to do the job, but I think that it may be a bit out of date and could do with some love. Last time I tried it wasn't working for me - but I think it might have been updated since then.
If that tool doesn't work for you then this is one instance where you can actually get away with using the web services directly (which is what that tool does under the hood).
CAVEAT - This is tested with the "Works on My Machine" guarantee. But if you remove the wrong subscription then you risk messing up your TFS instanllation. Therefore take backups and tread carefully...
To begin:
Log in to the TFS machine as the TFS Admin user (TFSSETUP) over remote desktop, and then browse to the following address in Internet Explorer:
http://localhost:8080/Services/V1.0/EventService.asmx
These are the Event Service web service methods. The first one you want to look at is the EventSubscriptions method:-
http://localhost:8080/Services/V1.0/EventService.asmx?op=EventSubscriptions
In the userid field, enter an asterisk (*) and then press invoke.
This will then return a big list of all the event subscriptions in TFS - including the ones that allow parts of TFS to talk to other parts. If you scroll down, you will find your email subscriptions. Make a note of the ID's of the ones that you want to delete.
Then go to the unsubscribe method:
http://localhost:8080/Services/V1.0/EventService.asmx?op=UnsubscribeEvent
Enter the ID of the notification that you wish to remove and press invoke. Repeat for all the events that you wish to remove.
Once you have removed the ones you don't want you can create different ones using the power tools etc.
Hope that helps - good luck.
Martin.
Note that do don't get any friendly undo prompts or anything as this is fairly low-level hackery. Therefore you want to have backups etc before you do this.
-
I don't know that I will be able to determine the tfssetup password. I am an admin on the machine. Is there a safe way to set the password if I can't determine it? Sep 21, 2009 at 12:36
-
EventSubscriptionTool seems to be good enough at least for removing subscriptions. Sep 21, 2009 at 13:50
-
5For 2010, try localhost:8080/tfs/DefaultCollection/Services/V1.0/… etc. Jun 10, 2011 at 3:45
-
For me, on 2010, the location of the url was: localhost:8080/tfs/_tfs_resources/Services/v1.0/…. Note that entering * didn't return any results. I ended up using this post to solve my alert problem: stackoverflow.com/questions/2699825/…– SamFeb 6, 2013 at 16:16
I'm really glad to say that in the current version of TFS and in Visual Studio Team Services, administrators can manage other user's alerts using Team Web Access. Thankfully, this should be a scenario of frustration in the past.
I have some more information available on a blog post written for this topic here: http://www.edsquared.com/2012/02/09/Creating+EMail+Alerts+For+Team+Members+In+TFS.aspx
-
1
-
1Meanwhile it's the current TFS version. This should be the accepted answer or should at least have more upvotes Feb 22, 2017 at 10:34
I would be very cautious about editing the table directly; see the cautions and suggestions in this thread. (I have not tried the applications they recommend, so take appropriate precautions/backups.)
I agree with Martin about not editing the database directly, but this query might help with his 1st step (finding the id of the event that you want to unsubscribe from):
SELECT
ES.Id,
U.display_name,
ES.*
FROM [Tfs_iSystems].[dbo].[tbl_EventSubscription] ES
INNER JOIN [Tfs_Configuration].dbo.tbl_security_identity_cache U
ON ES.SubscriberId = U.tf_id
I found using the XML produced by the webservice cumbersome to work with. Once you have the Id you need I'd recommend unsubscribing by using the webservice:
http://localhost:8080/tfs/DefaultCollection/Services/V1.0/EventService.asmx?op=UnsubscribeEvent
Note this is for TFS2010
I am not sure exactly what I am doing here yet, but I did just have a small victory and was able to get the page to come up, but I had to change the path to this:
"http://localhost:8080/tfs/_tfs_resources/Services/v1.0/EventService.asmx"
This worked for me on TFS 2010. basically there's a stored procedure that removes subscriptions in the TFS database.
- Connect to the TFS machine
- Run ssms
- Choose the local machine as the machine to connect to.
- In the object explorer, look for a database named
tfs_yourprojectname
. - Find the table named
tbl_EventSubscription
and right click => select top 1000 - Look at the list of subscription and decide on the id of the one you want to remove
- Look for the stored procedure named
prc_UnsubscribeEvent
in the object explorer, right click and select "execute stored procedure". enter the value of the id column in the event subscription table for the alert you would like to remove.