简体   繁体   中英

TFS email notification

When I add a bug (Work Item) in TFS, and assign it to a user, I want an email sent to that user.

Also if an existing bug has the "Assigned To" changed, I want that user to get an email. Is it possible to send Alerts to users when they're assigned changed bugs in TFS 2008?

In VS 2005 at least, on the Team menu you will find a Project Alerts... item which allows users to specify an email address that will be notified when My work items are changed by others , which covers both the situations you mention. I imagine VS 2008 will have a similar thing.

Unfortunately, TFS doesn't have anything built out of the box for this to be done without recipient intervention. Richard Ev comment can work, but is not really sustainable. Each person needs to create this or you need to do it for them and continue doing it for all new team members.

Instead, you're better off creating an Event Subscriber. Here's a very helpful post http://www.codeproject.com/Articles/110292/Team-Foundation-Server-2010-Event-Handling-with-Su .

You'll want to use the IIdentityManagementService to retrieve the corresponding users' email. An example:

using (var projectCollection = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(collectionUri, new UICredentialsProvider()))
            {
                var gss = projectCollection.GetService<IGroupSecurityService>();
                var ims = projectCollection.GetService<IIdentityManagementService>();

                var validUsersId = ims.ReadIdentity(IdentitySearchFactor.AccountName, "Team Foundation Valid Users", MembershipQuery.Expanded, ReadIdentityOptions.IncludeReadFromSource);

                var validUsers = gss.ReadIdentities(SearchFactor.Sid, validUsersId.Members.Select(x => x.Identifier).ToArray(), QueryMembership.None);

                foreach (var member in validUsers)
                {
                    Console.WriteLine("{0}: {1}", member.AccountName, member.MailAddress);
                }
            }

In VS 2010, if you have the TFS 2010 Power Tools installed you can go to the Team menu and select Alerts Explorer . That will allow you to create new alerts.

I know your post is for 2008, but it's an old post and hopefully you're on 2010 now. For TFS 2010 there is an easy solution for you now, via a plugin which can be downloaded from CodePlex - Team Alert

It's a simple copy-paste solution which can take you 5 minutes to put in place using the configuration extract listed in the post below:

This post will show the exact configuration you need to perform what you want. Notify AssignedTo user of new work (for a specific TFS project)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM