private void InitWorkItemFields(IIncomingEmailMessage message, Dictionary <string, string> workItemUpdates) { var resolver = new SpecialValueResolver(message, _workItemManager.GetNameResolver()); workItemUpdates["Title"] = resolver.Subject; var rawConversationIndex = message.ConversationId; workItemUpdates[_config.WorkItemSettings.ConversationIndexFieldName] = rawConversationIndex.Substring(0, Math.Min(rawConversationIndex.Length, TfsTextFieldMaxLength)); foreach (var defaultFieldValue in _config.WorkItemSettings.DefaultFieldValues) { workItemUpdates[defaultFieldValue.Field] = resolver.Resolve(defaultFieldValue.Value); } string emailBodyFieldName = _config.WorkItemSettings.EmailBodyFieldName; if (!String.IsNullOrEmpty(emailBodyFieldName)) { if (workItemUpdates.Keys.Contains(emailBodyFieldName)) { Logger.Warn($"Field {emailBodyFieldName} is defined for mapping in {nameof(_config.WorkItemSettings.EmailBodyFieldName)} for mapping. The DefaultValueDefinition entry will be ignored."); } workItemUpdates[emailBodyFieldName] = MailHeaderExtractor.GetHtmlBody(_config, message, resolver.HtmlMessageBody); } }
private void InitWorkItemFields(IIncomingEmailMessage message, Dictionary <string, string> workItemUpdates) { var resolver = new SpecialValueResolver(message, _workItemManager.GetNameResolver()); workItemUpdates["Title"] = resolver.Subject; var rawConversationIndex = message.ConversationId; workItemUpdates[_config.WorkItemSettings.ConversationIndexFieldName] = rawConversationIndex.Substring(0, Math.Min(rawConversationIndex.Length, TfsTextFieldMaxLength)); foreach (var defaultFieldValue in _config.WorkItemSettings.DefaultFieldValues) { workItemUpdates[defaultFieldValue.Field] = resolver.Resolve(defaultFieldValue.Value); } }
private void InitWorkItemFields(IIncomingEmailMessage message, Dictionary <string, string> workItemUpdates) { var resolver = new SpecialValueResolver(message, _workItemManager.GetNameResolver()); //workItemUpdates["Title"] = resolver.Subject; workItemUpdates[FieldNames.Incident.CreatedBy] = resolver.SenderAlias; workItemUpdates[FieldNames.Incident.Title] = resolver.Subject; workItemUpdates[FieldNames.Incident.Description] = resolver.MessageBody; workItemUpdates[FieldNames.Incident.CreateDate] = message.SentOn.ToUniversalTime().ToString(); var rawConversationIndex = message.ConversationIndex; workItemUpdates[_config.WorkItemSettings.ConversationIndexFieldName] = rawConversationIndex.Substring( 0, Math.Min(rawConversationIndex.Length, TfsTextFieldMaxLength)); foreach (var defaultFieldValue in _config.WorkItemSettings.DefaultFieldValues) { workItemUpdates[defaultFieldValue.Field] = resolver.Resolve(defaultFieldValue.Value); } }
private void InitWorkItemFields(IIncomingEmailMessage message, Dictionary <string, string> workItemUpdates) { var resolver = new SpecialValueResolver(message, _workItemManager.GetNameResolver()); workItemUpdates["Title"] = resolver.Subject; var rawConversationIndex = message.ConversationId; workItemUpdates[_config.WorkItemSettings.ConversationIndexFieldName] = rawConversationIndex.Substring(0, Math.Min(rawConversationIndex.Length, TfsTextFieldMaxLength)); workItemUpdates[_config.WorkItemSettings.ReceivedOnFieldName] = CalcDateTimeForTFS(message.ReceivedOn).ToString(); workItemUpdates[_config.WorkItemSettings.SentOnFieldName] = CalcDateTimeForTFS(message.SentOn).ToString(); foreach (var defaultFieldValue in _config.WorkItemSettings.DefaultFieldValues) { workItemUpdates[defaultFieldValue.Field] = resolver.Resolve(defaultFieldValue.Value); } if (workItemUpdates.ContainsKey("Description")) { workItemUpdates["Description"] = AddInfoBeforeDescription(message, workItemUpdates["Description"]); } }
private void InitWorkItemFields(IIncomingEmailMessage message, Dictionary <string, string> workItemUpdates, MessageAttachmentCollection attachments) { var resolver = new SpecialValueResolver(message, _workItemManager.GetNameResolver()); workItemUpdates["Title"] = resolver.Subject; var rawConversationIndex = message.ConversationId; workItemUpdates[_config.WorkItemSettings.ConversationIndexFieldName] = rawConversationIndex.Substring(0, Math.Min(rawConversationIndex.Length, TfsTextFieldMaxLength)); bool enableImgUpdating = _config.WorkItemSettings.EnableExperimentalHtmlFeatures; foreach (var defaultFieldValue in _config.WorkItemSettings.DefaultFieldValues) { var result = resolver.Resolve(defaultFieldValue.Value); if (enableImgUpdating && message.IsHtmlBody && defaultFieldValue.Value == SpecialValueResolver.RawMessageBodyKeyword) { result = EmailBodyProcessingUtils.UpdateEmbeddedImageLinks(result, attachments.Attachments); } workItemUpdates[defaultFieldValue.Field] = result; } }
private void InitWorkItemFields(IIncomingEmailMessage message, Dictionary<string, string> workItemUpdates) { var resolver = new SpecialValueResolver(message, _workItemManager.GetNameResolver()); workItemUpdates["Title"] = resolver.Subject; var rawConversationIndex = message.ConversationIndex; workItemUpdates[_config.WorkItemSettings.ConversationIndexFieldName] = rawConversationIndex.Substring(0, Math.Min(rawConversationIndex.Length, TfsTextFieldMaxLength)); foreach (var defaultFieldValue in _config.WorkItemSettings.DefaultFieldValues) { workItemUpdates[defaultFieldValue.Field] = resolver.Resolve(defaultFieldValue.Value); } }
private void InitWorkItemFields(IIncomingEmailMessage message, Dictionary<string, string> workItemUpdates) { var resolver = new SpecialValueResolver(message, _workItemManager.GetNameResolver()); //workItemUpdates["Title"] = resolver.Subject; workItemUpdates[FieldNames.Incident.CreatedBy] = resolver.SenderAlias; workItemUpdates[FieldNames.Incident.Title] = resolver.Subject; workItemUpdates[FieldNames.Incident.Description] = resolver.MessageBody; workItemUpdates[FieldNames.Incident.CreateDate] = message.SentOn.ToUniversalTime().ToString(); var rawConversationIndex = message.ConversationIndex; workItemUpdates[_config.WorkItemSettings.ConversationIndexFieldName] = rawConversationIndex.Substring( 0, Math.Min(rawConversationIndex.Length, TfsTextFieldMaxLength)); foreach (var defaultFieldValue in _config.WorkItemSettings.DefaultFieldValues) { workItemUpdates[defaultFieldValue.Field] = resolver.Resolve(defaultFieldValue.Value); } }