I try write plugin for TFS 2015.
I use "ISubscriber"
public EventNotificationStatus ProcessEvent(TeamFoundationRequestContext requestContext, NotificationType notificationType,
object notificationEventArgs, out int statusCode, out string statusMessage,
out ExceptionPropertyCollection properties) { statusCode = 0;
statusMessage = string.Empty;
properties = null;
try {
if (notificationType == NotificationType.Notification && notificationEventArgs is WorkItemChangedEvent) {
var notification = notificationEventArgs as WorkItemChangedEvent;
string projectName = notification.ChangedFields.StringFields.First(p => p.ReferenceName == "System.TeamProject").NewValue;
var createdByDisplayName = notification.CoreFields.StringFields.First(p => p.ReferenceName == "System.CreatedBy").NewValue;
var assignedByDisplayName = notification.CoreFields.StringFields.First(p => p.ReferenceName == "System.AssignedTo").NewValue;
string s = string.Format("{0} | {1}", notification.WorkItemTitle, notification.AreaPath);
TeamFoundationApplicationCore.Log(string.Format(" WorkItemTitle | AreaPath : {0}", s), 1602, System.Diagnostics.EventLogEntryType.Information);
TeamFoundationApplicationCore.Log(string.Format(" CreatedBy : {0}", createdByDisplayName), 1603, System.Diagnostics.EventLogEntryType.Information);
TeamFoundationApplicationCore.Log(string.Format(" AssignedTo : {0}", assignedByDisplayName), 1603, System.Diagnostics.EventLogEntryType.Information);
TeamFoundationLocationService service = requestContext.GetService<TeamFoundationLocationService>();
Uri uri = service.GetSelfReferenceUri(requestContext, service.GetDefaultAccessMapping(requestContext));
TfsTeamProjectCollection tfsTeamProjectCollection = new TfsTeamProjectCollection(uri); } catch (Exception ex) {
TeamFoundationApplicationCore.Log(ex.Message, 1604, System.Diagnostics.EventLogEntryType.Error);
}
return EventNotificationStatus.ActionPermitted;
}
I copy dll to folder "C:\Program Files\Microsoft Team Foundation Server 14.0\Application Tier\Web Services\bin\Plugins"
After i create new User Story, i check in windows EventLog
Server install TFS 2015 RC (Server don't join Domain)
- CreatedBy : dongnt
- AssignedTo : Administrator
Server install TFS Server 2015 (Server join Domain)
- CreatedBy :
|Dong Nguyen%fda0ef76-acd4-452a-93de-da3f79ff0e2f|- AssignedTo : |User 01%85c99e85-152f-46eb-a0b5-85b271fbee57|
why does it diffirence?
TeamFoundationLocationService service = requestContext.GetService<TeamFoundationLocationService>(); <= service always null
Can you help me ? :( I try many time but i ca'nt solve issue :(:(
Thanks you