How to get all event subscriptions for each user in TFS using C#?

506 Views Asked by At

I've got a requirement to get all users who don't recieve email alerets when WorkItems related to them are edited. As I supose, TFS provides alerts based on some kind of events, and each user have to be a subscriber for a particular event.

I can get all Events using the code below

IEventService es = tfs.GetService(typeof(IEventService)) as IEventService;
Subscription[] events = es.GetAllEventSubscriptions();

After that I exctract all Identities

IGroupSecurityService gss = (IGroupSecurityService)tfsIdent.GetService(typeof(IGroupSecurityService));
Identity SIDS = gss.ReadIdentity(SearchFactor.AccountName, "Project Collection Valid Users", QueryMembership.Expanded);
Identity[] UserId = gss.ReadIdentities(SearchFactor.Sid, SIDS.Members, QueryMembership.Direct);

The last step I extract all users form UserId which emails doesnt apear in any of event from events, and I get a new list of users.

I asked some users from the list if they had alerts set up, they prove they had.

Can anybody point me please in a right direction geeting the list of TFS users which are not subscribed to WorkItemChangeEvent.

PS: Sorry for my poor English.

1

There are 1 best solutions below

0
MrHinsh - Martin Hinshelwood On

The service you are calling will return all events that you have permission to see. If you want all events you will need to create an account with the appropriate permissions.