/// <summary> /// Provides the team members and their respective permission details. /// </summary> /// <param name="matterDetails">Matter Details object</param> /// <param name="mailBodyTeamInformation">Team members permission information</param> /// <returns>Team members permission information</returns> private static string TeamMembersPermissionInformation(MatterDetails matterDetails, string mailBodyTeamInformation) { if (null != matterDetails && !string.IsNullOrWhiteSpace(matterDetails.RoleInformation)) { Dictionary<string, string> roleInformation = JsonConvert.DeserializeObject<Dictionary<string, string>>(matterDetails.RoleInformation); foreach (KeyValuePair<string, string> entry in roleInformation) { mailBodyTeamInformation = string.Format(CultureInfo.InvariantCulture, ServiceConstants.RoleInfoHtmlChunk, entry.Key, entry.Value) + mailBodyTeamInformation; } } return mailBodyTeamInformation; }
public bool UpdateMatterStampedProperties(ClientContext clientContext, MatterDetails matterDetails, Matter matter, PropertyValues matterStampedProperties, bool isEditMode, IConfigurationRoot configuration) { try { if (null != clientContext && null != matter && null != matterDetails && (0 < matterStampedProperties.FieldValues.Count)) { Dictionary<string, string> propertyList = new Dictionary<string, string>(); // Get existing stamped properties string stampedUsers = GetStampPropertyValue(matterStampedProperties.FieldValues, configuration["Matter:StampedPropertyMatterCenterUsers"]); string stampedUserEmails = GetStampPropertyValue(matterStampedProperties.FieldValues, configuration["Matter:StampedPropertyMatterCenterUserEmails"]); string stampedPermissions = GetStampPropertyValue(matterStampedProperties.FieldValues, configuration["Matter:StampedPropertyMatterCenterPermissions"]); string stampedRoles = GetStampPropertyValue(matterStampedProperties.FieldValues, configuration["Matter:StampedPropertyMatterCenterRoles"]); string stampedResponsibleAttorneys = GetStampPropertyValue(matterStampedProperties.FieldValues, configuration["Matter:StampedPropertyResponsibleAttorney"]); string stampedResponsibleAttorneysEmail = GetStampPropertyValue(matterStampedProperties.FieldValues, configuration["Matter:StampedPropertyResponsibleAttorneyEmail"]); string stampedTeamMembers = GetStampPropertyValue(matterStampedProperties.FieldValues, configuration["Matter:StampedPropertyTeamMembers"]); string stampedBlockedUploadUsers = GetStampPropertyValue(matterStampedProperties.FieldValues, configuration["Matter:StampedPropertyBlockedUploadUsers"]); string currentPermissions = string.Join(ServiceConstants.DOLLAR + ServiceConstants.PIPE + ServiceConstants.DOLLAR, matter.Permissions.Where(user => !string.IsNullOrWhiteSpace(user))); string currentRoles = string.Join(ServiceConstants.DOLLAR + ServiceConstants.PIPE + ServiceConstants.DOLLAR, matter.Roles.Where(user => !string.IsNullOrWhiteSpace(user))); string currentBlockedUploadUsers = string.Join(ServiceConstants.SEMICOLON, matterDetails.UploadBlockedUsers.Where(user => !string.IsNullOrWhiteSpace(user))); string currentUsers = GetMatterAssignedUsers(matter); string currentUserEmails = SPList.GetMatterAssignedUsersEmail(clientContext, matter); string finalMatterPermissions = string.Concat(stampedPermissions, ServiceConstants.DOLLAR + ServiceConstants.PIPE + ServiceConstants.DOLLAR, currentPermissions); string finalMatterRoles = string.Concat(stampedRoles, ServiceConstants.DOLLAR + ServiceConstants.PIPE + ServiceConstants.DOLLAR, currentRoles); string finalTeamMembers = string.Concat(stampedTeamMembers, ServiceConstants.SEMICOLON, ServiceConstants.SEMICOLON, matterDetails.TeamMembers); string finalMatterCenterUsers = string.Concat(stampedUsers, ServiceConstants.DOLLAR + ServiceConstants.PIPE + ServiceConstants.DOLLAR, currentUsers); string finalBlockedUploadUsers = string.Concat(stampedBlockedUploadUsers, ServiceConstants.SEMICOLON, currentBlockedUploadUsers); //if(stampedUserEmails.LastIndexOf("$|$")>0) //{ // stampedUserEmails = stampedUserEmails.Remove(stampedUserEmails.Length - 3); //} string finalMatterCenterUserEmails = string.Concat(stampedUserEmails, ServiceConstants.DOLLAR + ServiceConstants.PIPE + ServiceConstants.DOLLAR, currentUserEmails); string finalResponsibleAttorneysEmail = ""; string finalResponsibleAttorneys = ""; if (matterDetails.ResponsibleAttorneyEmail!=null) { finalResponsibleAttorneysEmail = string.IsNullOrWhiteSpace(stampedResponsibleAttorneysEmail) || isEditMode ? matterDetails.ResponsibleAttorneyEmail : string.Concat(stampedResponsibleAttorneysEmail, ServiceConstants.SEMICOLON, matterDetails.ResponsibleAttorneyEmail); finalResponsibleAttorneys = string.IsNullOrWhiteSpace(stampedResponsibleAttorneys) || isEditMode ? matterDetails.ResponsibleAttorney : string.Concat(stampedResponsibleAttorneys, ServiceConstants.SEMICOLON, matterDetails.ResponsibleAttorney); } else { finalResponsibleAttorneysEmail = stampedResponsibleAttorneysEmail; finalResponsibleAttorneys = stampedResponsibleAttorneys; } propertyList.Add(configuration["Matter:StampedPropertyResponsibleAttorney"], WebUtility.HtmlEncode(finalResponsibleAttorneys)); propertyList.Add(configuration["Matter:StampedPropertyResponsibleAttorneyEmail"], WebUtility.HtmlEncode(finalResponsibleAttorneysEmail)); propertyList.Add(configuration["Matter:StampedPropertyTeamMembers"], WebUtility.HtmlEncode(finalTeamMembers)); propertyList.Add(configuration["Matter:StampedPropertyBlockedUploadUsers"], WebUtility.HtmlEncode(finalBlockedUploadUsers)); propertyList.Add(configuration["Matter:StampedPropertyMatterCenterRoles"], WebUtility.HtmlEncode(finalMatterRoles)); propertyList.Add(configuration["Matter:StampedPropertyMatterCenterPermissions"], WebUtility.HtmlEncode(finalMatterPermissions)); propertyList.Add(configuration["Matter:StampedPropertyMatterCenterUsers"], WebUtility.HtmlEncode(finalMatterCenterUsers)); propertyList.Add(configuration["Matter:StampedPropertyMatterCenterUserEmails"], WebUtility.HtmlEncode(finalMatterCenterUserEmails)); SPList.SetPropertBagValuesForList(clientContext, matterStampedProperties, matter.Name, propertyList); return true; } } catch (Exception) { throw; //// This will transfer control to catch block of parent function. } return false; }
/// <summary> /// This method will loop for all external users in the matterinformation object and /// will send notification to that external user /// </summary> /// <param name="matterInformation">Contains information about all external users, his roles and permissions</param> private void ShareMatterToExtUser(MatterInformationVM matterInformation) { //index is used to get the individual assigned user permissions and roles var index = 0; for (int i = 0; i < matterInformation.Matter.AssignUserNames.Count; i++) { //Need to construct new MatterInformationVM object for each external user MatterInformationVM matterInfoNew = new MatterInformationVM(); //looping to send the notification to all the users present in matterInformation.Matter.AssignUserNames[i] for (int j = 0; j < matterInformation.Matter.AssignUserNames[i].Count; j++) { List<string> userIds = new List<string>(); if (matterInformation.UserIds != null) { foreach (var userid in matterInformation.UserIds) { userIds.Add(userid); } } matterInfoNew.UserIds = userIds; Conflict conflictNew = new Conflict(); conflictNew.Identified = matterInformation.Matter.Conflict.Identified; Matter matterNew = new Matter() { Id = matterInformation.Matter.Id, Name = matterInformation.Matter.Name, Description = matterInformation.Matter.Description, MatterGuid = matterInformation.Matter.MatterGuid, Conflict = conflictNew, }; matterInfoNew.EditMode = matterInformation.EditMode; matterInfoNew.Client = matterInformation.Client; var roles = new List<String>(); string role = matterInformation.Matter.Roles[index]; roles.Add(role); matterNew.Roles = roles; var permissions = new List<String>(); string permission = matterInformation.Matter.Permissions[index]; permissions.Add(permission); matterNew.Permissions = permissions; var assignUserEmails = new List<IList<string>>(); var userEmails = new List<string>(); var assignUserEmailList = matterInformation.Matter.AssignUserEmails[i]; var assignUserEmail = assignUserEmailList[j]; userEmails.Add(assignUserEmail); assignUserEmails.Add(userEmails); matterNew.AssignUserEmails = assignUserEmails; var assignUserNames = new List<IList<string>>(); var userNames = new List<string>(); var assignUserNameList = matterInformation.Matter.AssignUserNames[i]; var assignName = assignUserNameList[j]; userNames.Add(assignName); assignUserNames.Add(userNames); matterNew.AssignUserNames = assignUserNames; matterInfoNew.Matter = matterNew; MatterDetails matterDetailsNew = new MatterDetails(); if (!string.IsNullOrEmpty(matterInformation.MatterDetails.ResponsibleAttorney)) { matterDetailsNew.ResponsibleAttorney = matterInformation.MatterDetails.ResponsibleAttorney; } if (!string.IsNullOrEmpty(matterInformation.MatterDetails.ResponsibleAttorneyEmail)) { matterDetailsNew.ResponsibleAttorneyEmail = matterInformation.MatterDetails.ResponsibleAttorneyEmail; } matterDetailsNew.TeamMembers = assignName; matterDetailsNew.UploadBlockedUsers = matterInformation.MatterDetails.UploadBlockedUsers; matterInfoNew.MatterDetails = matterDetailsNew; //Share the matter to external user by sending the notification externalSharing.ShareMatter(matterInfoNew); index = index + 1; } } }
/// <summary> /// Function to share the matter. /// </summary> /// <param name="requestObject">Request Object containing SharePoint App Token</param> /// <param name="client">Client object containing Client data</param> /// <param name="matter">Matter object containing Matter data</param> /// <param name="subAreaOfLawList">String contains all sub area of law</param> /// <param name="mailListURL">URL contains list of mail recipients</param> /// <returns>Result of operation: Matter Shared successfully or not</returns> internal GenericResponseVM ShareMatterUtility(Client client, Matter matter, MatterDetails matterDetails, string mailSiteURL, string centralMailListURL, string matterLandingFlag, MatterConfigurations matterConfigurations) { bool shareFlag = false; string mailListName = centralMailListURL.Substring(centralMailListURL.LastIndexOf(ServiceConstants.FORWARD_SLASH, StringComparison.OrdinalIgnoreCase) + 1); string matterLocation = string.Concat(client.Url, ServiceConstants.FORWARD_SLASH, matter.Name); string ProvisionMatterValidation = string.Empty; GenericResponseVM genericResponse = null; if (!string.IsNullOrWhiteSpace(mailSiteURL)) { using (ClientContext clientContext = spoAuthorization.GetClientContext(mailSiteURL)) { genericResponse = validationFunctions.MatterDetailsValidation(matter, client, int.Parse(ServiceConstants.ProvisionMatterShareMatter, CultureInfo.InvariantCulture), matterConfigurations); if (genericResponse != null) { return genericResponse; } MatterInformationVM matterInformation = new MatterInformationVM() { Client = client, Matter = matter, MatterDetails = matterDetails }; // Get the current logged in User clientContext.Load(clientContext.Web.CurrentUser); clientContext.ExecuteQuery(); matterInformation.MatterCreator = clientContext.Web.CurrentUser.Title; if (ServiceConstants.TRUE == matterLandingFlag) { matterLocation = string.Concat(client.Url, ServiceConstants.FORWARD_SLASH, matterSettings.MatterLandingPageRepositoryName.Replace(ServiceConstants.SPACE, string.Empty), ServiceConstants.FORWARD_SLASH, matter.MatterGuid, ServiceConstants.ASPX_EXTENSION); matterInformation.MatterLocation = matterLocation; } // Step 4: Create Conflict check Information based on the conflict check flag and create mail body if (matterConfigurations.IsConflictCheck) { matterInformation.IsConflictCheck = true; } else { matterInformation.IsConflictCheck = false; } //List<FieldUserValue> userList = new List<FieldUserValue>(); //List<FieldUserValue> userEmailList = GenerateMailList(matter, new Client { Url = mailSiteURL }, ref userList); /////// Add the Matter URL in list //FieldUrlValue matterPath = new FieldUrlValue() //{ // Url = string.Concat(client.Url.Replace(String.Concat(ServiceConstants.HTTPS, ServiceConstants.COLON, // ServiceConstants.FORWARD_SLASH, ServiceConstants.FORWARD_SLASH), String.Concat(ServiceConstants.HTTP, ServiceConstants.COLON, // ServiceConstants.FORWARD_SLASH, ServiceConstants.FORWARD_SLASH)), ServiceConstants.FORWARD_SLASH, matter.Name, // ServiceConstants.FORWARD_SLASH, matter.Name), // Description = matter.Name //}; //matterInformation.MatterUrlPath = matterPath.Url; SerializeMatterToTableStorage(matterInformation); } } return genericResponse; }
/// <summary> /// Extracts matter details from matter library property bag. /// </summary> /// <param name="stampedPropertyValues">Dictionary object containing matter property bag key/value pairs</param> /// <returns>Matter details from matter library property bag</returns> internal MatterDetails ExtractMatterDetails(Dictionary<string, object> stampedPropertyValues) { MatterDetails matterDetails = new MatterDetails(); matterDetails.ResponsibleAttorney = GetStampPropertyValue(stampedPropertyValues, matterSettings.StampedPropertyResponsibleAttorney); matterDetails.TeamMembers = GetStampPropertyValue(stampedPropertyValues, matterSettings.StampedPropertyTeamMembers); matterDetails.UploadBlockedUsers = GetStampPropertyValue(stampedPropertyValues, matterSettings.StampedPropertyBlockedUploadUsers).Split(new string[] { ServiceConstants.SEMICOLON }, StringSplitOptions.RemoveEmptyEntries).ToList(); /* * All the managed columns need to be read from the appsettings.json file. In old implementation * all the managed columns are hardcoded and that hardcoding has been removed, by reading the * column names from appsettings.json file */ //Get the number of levels from Taxonomy Settings int levels = int.Parse(configuration.GetSection("Taxonomy")["Levels"].ToString()); IDictionary<string, ManagedColumn> managedColumns = new Dictionary<string, ManagedColumn>(); for (int i = 1; i <= levels; i++) { //Get all the managed columns from "ContentType" settings from appsettings.json file string columnName = configuration.GetSection("ContentTypes").GetSection("ManagedColumns")["ColumnName" + i]; string managedColumnValue = GetStampPropertyValue(stampedPropertyValues, columnName); ManagedColumn managedColumn = new ManagedColumn(); managedColumn.TermName = managedColumnValue; managedColumns.Add(columnName, managedColumn); } matterDetails.ManagedColumnTerms = managedColumns; return matterDetails; }
/// <summary> /// Function to create dictionary object for stamp property /// </summary> /// <param name="client">Client object containing Client data</param> /// <param name="matter">Matter object containing Matter data</param> /// <param name="matterDetails">Matter details object which has data of properties to be stamped</param> /// <returns>returns dictionary object</returns> internal Dictionary<string, string> SetStampProperty(Client client, Matter matter, MatterDetails matterDetails) { string matterCenterPermission = string.Join(ServiceConstants.DOLLAR + ServiceConstants.PIPE + ServiceConstants.DOLLAR, matter.Permissions); string matterCenterRoles = string.Join(ServiceConstants.DOLLAR + ServiceConstants.PIPE + ServiceConstants.DOLLAR, matter.Roles); string documentTemplateCount = string.Join(ServiceConstants.DOLLAR + ServiceConstants.PIPE + ServiceConstants.DOLLAR, matter.DocumentTemplateCount); string matterCenterUsers = string.Empty; string separator = string.Empty; foreach (IList<string> userNames in matter.AssignUserNames) { matterCenterUsers += separator + string.Join(ServiceConstants.SEMICOLON, userNames.Where(user => !string.IsNullOrWhiteSpace(user))); separator = ServiceConstants.DOLLAR + ServiceConstants.PIPE + ServiceConstants.DOLLAR; } List<string> keys = new List<string>(); Dictionary<string, string> propertyList = new Dictionary<string, string>(); keys.Add(matterSettings.StampedPropertyPracticeGroup); keys.Add(matterSettings.StampedPropertyAreaOfLaw); keys.Add(matterSettings.StampedPropertySubAreaOfLaw); keys.Add(matterSettings.StampedPropertyMatterName); keys.Add(matterSettings.StampedPropertyMatterID); keys.Add(matterSettings.StampedPropertyClientName); keys.Add(matterSettings.StampedPropertyClientID); keys.Add(matterSettings.StampedPropertyResponsibleAttorney); keys.Add(matterSettings.StampedPropertyTeamMembers); keys.Add(matterSettings.StampedPropertyIsMatter); keys.Add(matterSettings.StampedPropertyOpenDate); keys.Add(matterSettings.StampedPropertySecureMatter); keys.Add(matterSettings.StampedPropertyBlockedUploadUsers); keys.Add(matterSettings.StampedPropertyMatterDescription); keys.Add(matterSettings.StampedPropertyConflictCheckDate); keys.Add(matterSettings.StampedPropertyConflictCheckBy); keys.Add(matterSettings.StampedPropertyMatterCenterRoles); keys.Add(matterSettings.StampedPropertyMatterCenterPermissions); keys.Add(matterSettings.StampedPropertyMatterCenterUsers); keys.Add(matterSettings.StampedPropertyDefaultContentType); keys.Add(matterSettings.StampedPropertyIsConflictIdentified); keys.Add(matterSettings.StampedPropertyDocumentTemplateCount); keys.Add(matterSettings.StampedPropertyBlockedUsers); keys.Add(matterSettings.StampedPropertyMatterGUID); propertyList.Add(matterSettings.StampedPropertyPracticeGroup, WebUtility.HtmlEncode(matterDetails.PracticeGroup)); propertyList.Add(matterSettings.StampedPropertyAreaOfLaw, WebUtility.HtmlEncode(matterDetails.AreaOfLaw)); propertyList.Add(matterSettings.StampedPropertySubAreaOfLaw, WebUtility.HtmlEncode(matterDetails.SubareaOfLaw)); propertyList.Add(matterSettings.StampedPropertyMatterName, WebUtility.HtmlEncode(matter.Name)); propertyList.Add(matterSettings.StampedPropertyMatterID, WebUtility.HtmlEncode(matter.Id)); propertyList.Add(matterSettings.StampedPropertyClientName, WebUtility.HtmlEncode(client.Name)); propertyList.Add(matterSettings.StampedPropertyClientID, WebUtility.HtmlEncode(client.Id)); propertyList.Add(matterSettings.StampedPropertyResponsibleAttorney, WebUtility.HtmlEncode(matterDetails.ResponsibleAttorney)); propertyList.Add(matterSettings.StampedPropertyTeamMembers, WebUtility.HtmlEncode(matterDetails.TeamMembers)); propertyList.Add(matterSettings.StampedPropertyIsMatter, ServiceConstants.TRUE); propertyList.Add(matterSettings.StampedPropertyOpenDate, WebUtility.HtmlEncode(DateTime.Now.ToString(matterSettings.ValidDateFormat, CultureInfo.InvariantCulture))); propertyList.Add(matterSettings.PropertyNameVtiIndexedPropertyKeys, WebUtility.HtmlEncode(ServiceUtility.GetEncodedValueForSearchIndexProperty(keys))); propertyList.Add(matterSettings.StampedPropertySecureMatter, (matter.Conflict != null) ? (matter.Conflict.SecureMatter != null) ? WebUtility.HtmlEncode(matter.Conflict.SecureMatter) : "False" : "False"); propertyList.Add(matterSettings.StampedPropertyBlockedUploadUsers, WebUtility.HtmlEncode(string.Join(";", matterDetails.UploadBlockedUsers))); propertyList.Add(matterSettings.StampedPropertyMatterDescription, WebUtility.HtmlEncode(matter.Description)); propertyList.Add(matterSettings.StampedPropertyConflictCheckDate, (string.IsNullOrEmpty(matter.Conflict.CheckOn)) ? "" : WebUtility.HtmlEncode(Convert.ToDateTime(matter.Conflict.CheckOn, CultureInfo.InvariantCulture).ToString(matterSettings.ValidDateFormat, CultureInfo.InvariantCulture))); propertyList.Add(matterSettings.StampedPropertyConflictCheckBy, WebUtility.HtmlEncode(matter.Conflict.CheckBy)); propertyList.Add(matterSettings.StampedPropertyMatterCenterRoles, WebUtility.HtmlEncode(matterCenterRoles)); propertyList.Add(matterSettings.StampedPropertyMatterCenterPermissions, WebUtility.HtmlEncode(matterCenterPermission)); propertyList.Add(matterSettings.StampedPropertyMatterCenterUsers, WebUtility.HtmlEncode(matterCenterUsers)); propertyList.Add(matterSettings.StampedPropertyDefaultContentType, WebUtility.HtmlEncode(matter.DefaultContentType)); propertyList.Add(matterSettings.StampedPropertyIsConflictIdentified, WebUtility.HtmlEncode(matter.Conflict.Identified)); propertyList.Add(matterSettings.StampedPropertyDocumentTemplateCount, WebUtility.HtmlEncode(documentTemplateCount)); propertyList.Add(matterSettings.StampedPropertyBlockedUsers, WebUtility.HtmlEncode(string.Join(";", matter.BlockUserNames))); propertyList.Add(matterSettings.StampedPropertyMatterGUID, WebUtility.HtmlEncode(matter.MatterGuid)); propertyList.Add(matterSettings.StampedPropertySuccess, ServiceConstants.TRUE); return propertyList; }
/// <summary> /// Function to share the matter. /// </summary> /// <param name="requestObject">Request Object containing SharePoint App Token</param> /// <param name="client">Client object containing Client data</param> /// <param name="matter">Matter object containing Matter data</param> /// <param name="subAreaOfLawList">String contains all sub area of law</param> /// <param name="mailListURL">URL contains list of mail recipients</param> /// <returns>Result of operation: Matter Shared successfully or not</returns> internal GenericResponseVM ShareMatterUtility(Client client, Matter matter, MatterDetails matterDetails, string mailSiteURL, string centralMailListURL, string matterLandingFlag, MatterConfigurations matterConfigurations) { bool shareFlag = false; string mailListName = centralMailListURL.Substring(centralMailListURL.LastIndexOf(ServiceConstants.FORWARD_SLASH, StringComparison.OrdinalIgnoreCase) + 1); string matterLocation = string.Concat(client.Url, ServiceConstants.FORWARD_SLASH, matter.Name); string ProvisionMatterValidation = string.Empty; GenericResponseVM genericResponse = null; if (!string.IsNullOrWhiteSpace(mailSiteURL)) { using (ClientContext clientContext = spoAuthorization.GetClientContext(mailSiteURL)) { genericResponse = validationFunctions.MatterDetailsValidation(matter, client, int.Parse(ServiceConstants.ProvisionMatterShareMatter, CultureInfo.InvariantCulture), matterConfigurations); if(genericResponse!=null) { return genericResponse; } // Get the current logged in User clientContext.Load(clientContext.Web.CurrentUser); clientContext.ExecuteQuery(); string matterMailBody, blockUserNames; // Generate Mail Subject string matterMailSubject = string.Format(CultureInfo.InvariantCulture, mailSettings.MatterMailSubject, matter.Id, matter.Name, clientContext.Web.CurrentUser.Title); // Logic to Create Mail body // Step 1: Create Matter Information // Step 2: Create Team Information // Step 3: Create Access Information // Step 4: Create Conflict check Information based on the conflict check flag and create mail body // Step 1: Create Matter Information string defaultContentType = string.Format(CultureInfo.InvariantCulture, mailSettings.MatterMailDefaultContentTypeHtmlChunk, matter.DefaultContentType); string matterType = string.Join(";", matter.ContentTypes.ToArray()).TrimEnd(';').Replace(matter.DefaultContentType, defaultContentType); // Step 2: Create Team Information string secureMatter = ServiceConstants.FALSE.ToUpperInvariant() == matter.Conflict.SecureMatter.ToUpperInvariant() ? ServiceConstants.NO : ServiceConstants.YES; string mailBodyTeamInformation = string.Empty; mailBodyTeamInformation = TeamMembersPermissionInformation(matterDetails, mailBodyTeamInformation); // Step 3: Create Access Information if (ServiceConstants.TRUE == matterLandingFlag) { matterLocation = string.Concat(client.Url, ServiceConstants.FORWARD_SLASH, matterSettings.MatterLandingPageRepositoryName.Replace(ServiceConstants.SPACE, string.Empty), ServiceConstants.FORWARD_SLASH, matter.MatterGuid, ServiceConstants.ASPX_EXTENSION); } string oneNotePath = string.Concat(client.Url, ServiceConstants.FORWARD_SLASH, matter.MatterGuid, matterSettings.OneNoteLibrarySuffix, ServiceConstants.FORWARD_SLASH, matter.MatterGuid, ServiceConstants.FORWARD_SLASH, matter.MatterGuid); // Step 4: Create Conflict check Information based on the conflict check flag and create mail body if (matterConfigurations.IsConflictCheck) { string conflictIdentified = ServiceConstants.FALSE.ToUpperInvariant() == matter.Conflict.Identified.ToUpperInvariant() ? ServiceConstants.NO : ServiceConstants.YES; blockUserNames = string.Join(";", matter.BlockUserNames.ToArray()).Trim().TrimEnd(';'); blockUserNames = !String.IsNullOrEmpty(blockUserNames) ? string.Format(CultureInfo.InvariantCulture, "<div>{0}: {1}</div>", "Conflicted User", blockUserNames) : string.Empty; matterMailBody = string.Format(CultureInfo.InvariantCulture, mailSettings.MatterMailBodyMatterInformation, client.Name, client.Id, matter.Name, matter.Id, matter.Description, matterType) + string.Format(CultureInfo.InvariantCulture, mailSettings.MatterMailBodyConflictCheck, ServiceConstants.YES, matter.Conflict.CheckBy, Convert.ToDateTime(matter.Conflict.CheckOn, CultureInfo.InvariantCulture).ToString(matterSettings.MatterCenterDateFormat, CultureInfo.InvariantCulture), conflictIdentified) + string.Format(CultureInfo.InvariantCulture, mailSettings.MatterMailBodyTeamMembers, secureMatter, mailBodyTeamInformation, blockUserNames, client.Url, oneNotePath, matter.Name, matterLocation, matter.Name); } else { blockUserNames = string.Empty; matterMailBody = string.Format(CultureInfo.InvariantCulture, mailSettings.MatterMailBodyMatterInformation, client.Name, client.Id, matter.Name, matter.Id, matter.Description, matterType) + string.Format(CultureInfo.InvariantCulture, mailSettings.MatterMailBodyTeamMembers, secureMatter, mailBodyTeamInformation, blockUserNames, client.Url, oneNotePath, matter.Name, matterLocation, matter.Name); } Web web = clientContext.Web; List mailList = web.Lists.GetByTitle(mailListName); List<FieldUserValue> userList = new List<FieldUserValue>(); List<FieldUserValue> userEmailList = GenerateMailList(matter, new Client {Url = mailSiteURL }, ref userList); ///// Add the Matter URL in list FieldUrlValue matterPath = new FieldUrlValue() { Url = string.Concat(client.Url.Replace(String.Concat(ServiceConstants.HTTPS, ServiceConstants.COLON, ServiceConstants.FORWARD_SLASH, ServiceConstants.FORWARD_SLASH), String.Concat(ServiceConstants.HTTP, ServiceConstants.COLON, ServiceConstants.FORWARD_SLASH, ServiceConstants.FORWARD_SLASH)), ServiceConstants.FORWARD_SLASH, matter.Name, ServiceConstants.FORWARD_SLASH, matter.Name), Description = matter.Name }; List<string> columnNames = new List<string>() { matterSettings.ShareListColumnMatterPath, matterSettings.ShareListColumnMailList, mailSettings.ShareListColumnMailBody, mailSettings.ShareListColumnMailSubject }; List<object> columnValues = new List<object>() { matterPath, userEmailList, matterMailBody, matterMailSubject }; // To avoid the invalid symbol error while parsing the JSON, return the response in lower case matterRepositoy.AddItem(clientContext, mailList, columnNames, columnValues); } } return genericResponse; }