This class provides meta data related information for matter provision.
예제 #1
0
 /// <summary>
 /// Reverts the changes for sample data based on the information provided
 /// </summary>
 /// <param name="matterDetailsCollection">Matter details collection</param>
 /// <param name="clientCollection">Client details collection</param>
 /// <param name="configVal">Configuration values from Excel</param>
 internal static void RevertData(List <DataStorage> matterDetailsCollection, ClientTermSets clientCollection, Dictionary <string, string> configVal)
 {
     try
     {
         if (null != matterDetailsCollection && null != clientCollection && null != configVal && 0 < matterDetailsCollection.Count)
         {
             foreach (DataStorage matterDetails in matterDetailsCollection)
             {
                 Client clientObject = clientCollection.ClientTerms.Where(item => item.ClientName.Equals(matterDetails.ClientName, StringComparison.OrdinalIgnoreCase)).FirstOrDefault();
                 if (null != clientObject)
                 {
                     using (ClientContext clientContext = MatterProvisionHelperUtility.GetClientContext(clientObject.ClientUrl, configVal))
                     {
                         PropertyValues properties = clientContext.Web.Lists.GetByTitle(matterDetails.MatterPrefix).RootFolder.Properties;
                         clientContext.Load(properties);
                         clientContext.ExecuteQuery();
                         Matter matter = new Matter(matterDetails);
                         matter.MatterGuid = properties.FieldValues.ContainsKey("MatterGUID") ? System.Web.HttpUtility.HtmlDecode(Convert.ToString(properties.FieldValues["MatterGUID"], CultureInfo.InvariantCulture)) : matterDetails.MatterPrefix;
                         MatterProvisionHelper.DeleteMatter(clientContext, matter);
                     }
                 }
                 else
                 {
                     Console.WriteLine("Failed to get Client Url for client: {0}", matterDetails.ClientName);
                     Console.WriteLine("-------------------------------------------------------------------------------");
                     continue;
                 }
             }
         }
     }
     catch (Exception exception)
     {
         Utility.DisplayAndLogError(errorFilePath, "Message: " + exception.Message + "\nStacktrace: " + exception.StackTrace);
     }
 }
예제 #2
0
        /// <summary>
        /// Add Calendar Web Part to client site
        /// </summary>
        /// <param name="clientContext">SharePoint Client Context</param>
        /// <param name="matter">Matter object containing Matter data</param>
        internal static void AddCalendarList(ClientContext clientContext, Matter matter)
        {
            string calendarName = string.Concat(matter.MatterName, ConfigurationManager.AppSettings["CalendarNameSuffix"]);

            try
            {
                Web web = clientContext.Web;
                clientContext.Load(web, item => item.ListTemplates);
                clientContext.ExecuteQuery();
                ListTemplate listTemplate = null;
                foreach (var calendar in web.ListTemplates)
                {
                    if (calendar.Name == Constants.CalendarName)
                    {
                        listTemplate = calendar;
                    }
                }

                ListCreationInformation listCreationInformation = new ListCreationInformation();
                listCreationInformation.TemplateType = listTemplate.ListTemplateTypeKind;
                listCreationInformation.Title        = calendarName;
                // Added URL property for URL consolidation changes
                listCreationInformation.Url = Constants.TitleListPath + matter.MatterGuid + ConfigurationManager.AppSettings["CalendarNameSuffix"];
                web.Lists.Add(listCreationInformation);
                web.Update();
                clientContext.ExecuteQuery();
                MatterProvisionHelperUtility.BreakPermission(clientContext, matter.MatterName, matter.CopyPermissionsFromParent, calendarName);
            }
            catch (Exception exception)
            {
                //// Generic Exception
                MatterProvisionHelper.DeleteMatter(clientContext, matter);
                DisplayAndLogError(errorFilePath, "Message: " + exception.Message + "\nStacktrace: " + exception.StackTrace);
            }
        }
예제 #3
0
        /// <summary>
        /// Extract term store groups
        /// </summary>
        /// <param name="configVal">Configuration values from excel</param>
        /// <returns>Term sets</returns>
        internal static TermSets FetchGroupTerms(Dictionary <string, string> configVal)
        {
            TermStoreDetails termStoreDetails = new TermStoreDetails();

            termStoreDetails.TermSetName        = ConfigurationManager.AppSettings["PracticeGroupTermSetName"];
            termStoreDetails.CustomPropertyName = ConfigurationManager.AppSettings["CustomPropertyName"];
            termStoreDetails.TermGroup          = ConfigurationManager.AppSettings["PracticeGroupName"];
            TermSets practiceGroupTermSets = null;

            using (ClientContext clientContext = MatterProvisionHelperUtility.GetClientContext(configVal["TenantAdminURL"], configVal))
            {
                TaxonomySession taxanomySession = TaxonomySession.GetTaxonomySession(clientContext);
                clientContext.Load(taxanomySession,
                                   items => items.TermStores.Include(
                                       item => item.Groups,
                                       item => item.Groups.Include(
                                           group => group.Name)));
                clientContext.ExecuteQuery();
                TermGroup termGroup = taxanomySession.TermStores[0].Groups.GetByName(termStoreDetails.TermGroup);
                clientContext.Load(termGroup,
                                   group => group.Name,
                                   group => group.TermSets.Include(
                                       termSet => termSet.Name,
                                       termSet => termSet.Terms.Include(
                                           term => term.Name,
                                           term => term.Id,
                                           term => term.CustomProperties,
                                           term => term.Terms.Include(
                                               termArea => termArea.Name,
                                               termArea => termArea.Id,
                                               termArea => termArea.CustomProperties,
                                               termArea => termArea.Terms.Include(
                                                   termSubArea => termSubArea.Name,
                                                   termSubArea => termSubArea.Id,
                                                   termSubArea => termSubArea.CustomProperties)))));
                clientContext.ExecuteQuery();

                foreach (TermSet termSet in termGroup.TermSets)
                {
                    if (termSet.Name.Equals(termStoreDetails.TermSetName, StringComparison.OrdinalIgnoreCase))
                    {
                        if (termStoreDetails.TermSetName.Equals(termStoreDetails.TermSetName, StringComparison.OrdinalIgnoreCase))
                        {
                            practiceGroupTermSets = TermStoreOperations.GetPracticeGroupTermSetHierarchy(termSet, termStoreDetails.CustomPropertyName);
                        }
                    }
                }

                return(practiceGroupTermSets);
            }
        }
예제 #4
0
        /// <summary>
        /// Function to return client id and client url from term store
        /// </summary>
        /// <param name="configVal">Configuration from excel file</param>
        /// <returns>ClientId and ClientUrl</returns>
        internal static ClientTermSets GetClientDetails(Dictionary <string, string> configVal)
        {
            ClientTermSets clientDetails = new ClientTermSets();

            clientDetails.ClientTerms = new List <Client>();

            string groupName         = ConfigurationManager.AppSettings["PracticeGroupName"];
            string termSetName       = ConfigurationManager.AppSettings["TermSetName"];
            string clientIdProperty  = ConfigurationManager.AppSettings["ClientIDProperty"];
            string clientUrlProperty = ConfigurationManager.AppSettings["ClientUrlProperty"];

            // 1. get client context
            using (ClientContext clientContext = MatterProvisionHelperUtility.GetClientContext(configVal["TenantAdminURL"], configVal))
            {
                if (null != clientContext)
                {
                    // 2. Create taxonomy session
                    TaxonomySession taxonomySession = TaxonomySession.GetTaxonomySession(clientContext);
                    clientContext.Load(taxonomySession.TermStores);
                    clientContext.ExecuteQuery();

                    // 3. Create term store object and load data
                    TermStore termStore = taxonomySession.TermStores[0];
                    clientContext.Load(
                        termStore,
                        store => store.Name,
                        store => store.Groups.Include(
                            group => group.Name));
                    clientContext.ExecuteQuery();

                    // 4. create a term group object and load data
                    TermGroup termGroup = GetTermGroup(groupName, clientContext, termStore);

                    // 5. Get required term from term from extracted term set
                    TermCollection fillteredTerms = termGroup.TermSets.Where(item => item.Name.Equals(termSetName, StringComparison.OrdinalIgnoreCase)).FirstOrDefault().Terms;
                    GetClientTerms(clientDetails, clientIdProperty, clientUrlProperty, fillteredTerms);
                }
                else
                {
                    clientDetails = null;
                }
            }
            return(clientDetails);
        }
예제 #5
0
 /// <summary>
 /// Creates task list while provisioning matter
 /// </summary>
 /// <param name="clientContext">Client context object</param>
 /// <param name="matter">Matter object containing Matter data</param>
 internal static void CreateTaskList(ClientContext clientContext, Matter matter)
 {
     try
     {
         Microsoft.SharePoint.Client.Web web          = clientContext.Web;
         ListCreationInformation         creationInfo = new ListCreationInformation();
         string listName = matter.MatterName + ConfigurationManager.AppSettings["TaskListSuffix"];
         creationInfo.Title       = listName;
         creationInfo.Description = matter.MatterDescription;
         // Added list property for URL consolidation changes
         creationInfo.Url          = Constants.TitleListPath + matter.MatterGuid + ConfigurationManager.AppSettings["TaskListSuffix"];
         creationInfo.TemplateType = (int)ListTemplateType.Tasks;
         List list = web.Lists.Add(creationInfo);
         list.ContentTypesEnabled = false;
         list.Update();
         clientContext.ExecuteQuery();
         MatterProvisionHelperUtility.BreakPermission(clientContext, listName, matter.CopyPermissionsFromParent);
     }
     catch (Exception exception)
     {
         Utility.DisplayAndLogError(Utility.ErrorFilePath, "Message: " + exception.Message + "\nStacktrace: " + exception.StackTrace);
     }
 }
예제 #6
0
        /// <summary>
        /// Creates sample data based on the information provided
        /// </summary>
        /// <param name="listval">Matter details collection</param>
        /// <param name="clientDetails">Client details collection</param>
        /// <param name="configVal">Config values from Excel</param>
        internal static void CreateData(List <DataStorage> listval, ClientTermSets clientDetails, Dictionary <string, string> configVal)
        {
            try
            {
                int   successMatterNameCount = 0, alreadyExistsMatterCount = 0;
                Regex validateMatterId    = new Regex(ConfigurationManager.AppSettings["SpecialCharacterExpressionMatterId"]),
                      validateMatterTitle = new Regex(ConfigurationManager.AppSettings["SpecialCharacterExpressionMatterTitle"]),
                      validateMatterDesc  = new Regex(ConfigurationManager.AppSettings["SpecialCharacterExpressionMatterDescription"]);
                //Read data from term store
                TermSets terms = TermStoreOperations.FetchGroupTerms(configVal);
                if (null == terms)
                {
                    Utility.DisplayAndLogError(errorFilePath, "Failed to get Group Terms, skipping matter creation.");
                    return;
                }
                else
                {
                    MatterMetadata matterMetadata = new MatterMetadata();
                    //retrieve data from the list
                    for (int count = 0; count < listval.Count; count++)
                    {
                        string clientName = listval[count].ClientName;
                        /* Read from Term store */
                        Client client = clientDetails.ClientTerms.Where(item => item.ClientName.Equals(clientName, StringComparison.OrdinalIgnoreCase)).FirstOrDefault();
                        if (null == client)
                        {
                            Console.WriteLine("Failed to get client Id and/or client Url from term store for '{0}' client.", clientName);
                            Console.WriteLine("-------------------------------------------------------------------------------");
                            continue;
                        }

                        List <string> practiceGroupsList = Utility.ProcessString(listval[count].PracticeGroup).Split(';').ToList();
                        List <string> areaOfLawsList     = Utility.ProcessString(listval[count].AreaOfLaw).Split(';').ToList();
                        List <string> subAreaOfLawsList  = Utility.ProcessString(listval[count].SubAreaOfLaw).Split(';').ToList();

                        string folders          = string.Empty;
                        string documentTemplate = string.Empty;
                        bool   flag             = false;

                        AssociateTermStoreProperties(listval, terms, matterMetadata, count, practiceGroupsList, areaOfLawsList, subAreaOfLawsList, ref folders, ref documentTemplate, ref flag);
                        if (string.IsNullOrWhiteSpace(documentTemplate) || string.IsNullOrWhiteSpace(listval[count].DefaultContentType))
                        {
                            Console.WriteLine("Skipping matter creation as no matching document templates exists in term store corresponding to entry for '{0}' in the configuration Excel", client.ClientName);
                            Console.WriteLine("-------------------------------------------------------------------------------");
                            continue;
                        }

                        string[] contentTypes = documentTemplate.Split(';');
                        Matter   matterObj    = new Matter(listval[count]);
                        Console.WriteLine("Client details fetched");
                        Console.WriteLine("Client name: {0}", clientName);

                        using (ClientContext clientContext = MatterProvisionHelperUtility.GetClientContext(client.ClientUrl, configVal))
                        {
                            CheckMatterCreationStatus(configVal, ref successMatterNameCount, ref alreadyExistsMatterCount, validateMatterId, validateMatterTitle, validateMatterDesc, matterMetadata, clientName, client, folders, contentTypes, matterObj, clientContext);
                        }
                    }  // end of for

                    Console.ForegroundColor = ConsoleColor.Green;
                    Console.WriteLine(ConfigurationManager.AppSettings["MatterSuccess"], successMatterNameCount, listval.Count);
                    Console.ForegroundColor = ConsoleColor.Yellow;
                    Console.WriteLine(ConfigurationManager.AppSettings["MatterFound"], alreadyExistsMatterCount);
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine(ConfigurationManager.AppSettings["MatterFailure"], Convert.ToString((listval.Count - (successMatterNameCount + alreadyExistsMatterCount)), CultureInfo.InvariantCulture), listval.Count);
                    Console.ForegroundColor = ConsoleColor.White;
                }
            }
            catch (Exception exception)
            {
                Utility.DisplayAndLogError(errorFilePath, "Message: " + exception.Message + "\nStacktrace: " + exception.StackTrace);
            }
        }
예제 #7
0
        /// <summary>
        /// Created to refactor CreateData method
        /// </summary>
        /// <param name="configVal">Dictionary object</param>
        /// <param name="successMatterNameCount">Success matter name</param>
        /// <param name="matterMetadata">Matter metadata</param>
        /// <param name="clientName">Client name</param>
        /// <param name="client">Client object</param>
        /// <param name="contentTypes">Array of content type</param>
        /// <param name="matterObj">Matter object</param>
        /// <param name="clientContext">Client context</param>
        /// <returns>integer value</returns>
        private static int OnMatterCreationSuccess(Dictionary <string, string> configVal, int successMatterNameCount, MatterMetadata matterMetadata, string clientName, Client client, string[] contentTypes, Matter matterObj, ClientContext clientContext)
        {
            Console.WriteLine("Created Matter, OneNote library, calendar list and Task List");

            List <string>           listResponsibleAttorneys = matterObj.TeamInfo.ResponsibleAttorneys.Trim().Split(';').ToList();
            List <string>           listAttorneys            = matterObj.TeamInfo.Attorneys.Trim().Split(';').ToList();
            List <string>           listBlockedUploadUsers   = matterObj.TeamInfo.BlockedUploadUsers.Trim().Split(';').ToList();
            IList <IList <string> > assignUserNames          = new List <IList <string> >();

            assignUserNames.Add(listResponsibleAttorneys);
            assignUserNames.Add(listAttorneys);
            assignUserNames.Add(listBlockedUploadUsers);
            matterObj.AssignUserNames = assignUserNames;
            matterMetadata.Matter     = matterObj;
            matterMetadata.Client     = client;
            // Create Matter Landing page
            MatterProvisionHelper.CreateMatterLandingPage(clientContext, client, matterObj);
            Console.WriteLine("Created matter landing Page");

            // Step 4 Assign Content Types
            matterMetadata.ContentTypes = contentTypes.Distinct().ToList();
            MatterProvisionHelperUtility.AssignContentType(clientContext, matterMetadata);
            Console.WriteLine("Assigned content type");

            // Step 5 Assign Permissions
            bool   isCalendarEnabled = Convert.ToBoolean(ConfigurationManager.AppSettings["CalendarCreationEnabled"], CultureInfo.InvariantCulture);
            bool   isTaskEnabled = Convert.ToBoolean(ConfigurationManager.AppSettings["TaskListCreationEnabled"], CultureInfo.InvariantCulture);
            string calendarName = string.Empty, taskListName = string.Empty;

            if (isCalendarEnabled)
            {
                calendarName = string.Concat(matterObj.MatterName, ConfigurationManager.AppSettings["CalendarNameSuffix"]);
            }
            if (isTaskEnabled)
            {
                taskListName = string.Concat(matterObj.MatterName, ConfigurationManager.AppSettings["TaskListSuffix"]);
            }
            List <string> responsibleAttorneysList = matterObj.TeamInfo.ResponsibleAttorneys.Split(';').Where(responsibleAttorney => !string.IsNullOrWhiteSpace(responsibleAttorney.Trim())).Select(responsibleAttorney => responsibleAttorney.Trim()).ToList();

            MatterProvisionHelperUtility.AssignUserPermissions(clientContext, matterObj.MatterName, responsibleAttorneysList, ConfigurationManager.AppSettings["FullControl"]);
            MatterProvisionHelperUtility.AssignUserPermissions(clientContext, matterObj.MatterName + ConfigurationManager.AppSettings["OneNoteLibrarySuffix"], responsibleAttorneysList, ConfigurationManager.AppSettings["FullControl"]);
            if (isCalendarEnabled)
            {
                // If isCreateCalendar flag is enabled; assign FULL CONTROL permissions to calendar list
                MatterProvisionHelperUtility.AssignUserPermissions(clientContext, matterObj.MatterName, responsibleAttorneysList, ConfigurationManager.AppSettings["FullControl"], calendarName);
            }
            if (isTaskEnabled)
            {
                // If isTaskEnabled flag is enabled; assign FULL CONTROL permissions to task list
                MatterProvisionHelperUtility.AssignUserPermissions(clientContext, taskListName, responsibleAttorneysList, ConfigurationManager.AppSettings["FullControl"]);
            }
            List <string> attorneysList            = new List <string>();

            string[] attorneys = matterObj.TeamInfo.Attorneys.Split(';');
            if (!string.IsNullOrWhiteSpace(attorneys[0].Trim()))
            {
                int attorneyCount = matterObj.TeamInfo.Attorneys.Split(';').Length;
                for (int iLength = 0; iLength < attorneyCount; iLength++)
                {
                    attorneysList.Add(attorneys[iLength].Trim());
                }
                MatterProvisionHelperUtility.AssignUserPermissions(clientContext, matterObj.MatterName, attorneysList, ConfigurationManager.AppSettings["Contribute"]);
                MatterProvisionHelperUtility.AssignUserPermissions(clientContext, matterObj.MatterName + ConfigurationManager.AppSettings["OneNoteLibrarySuffix"], attorneysList, ConfigurationManager.AppSettings["Contribute"]);
                if (isCalendarEnabled)
                {
                    //If isCreateCalendar flag is enabled; assign CONTRIBUTE permissions to calendar list
                    MatterProvisionHelperUtility.AssignUserPermissions(clientContext, matterObj.MatterName, attorneysList, ConfigurationManager.AppSettings["Contribute"], calendarName);
                }
                if (isTaskEnabled)
                {
                    //If isTaskEnabled flag is enabled; assign CONTRIBUTE permissions to task list
                    MatterProvisionHelperUtility.AssignUserPermissions(clientContext, taskListName, attorneysList, ConfigurationManager.AppSettings["Contribute"]);
                }
            }

            List <string> blockedUploadUserList = new List <string>();

            string[] blockedUploadUsers = matterObj.TeamInfo.BlockedUploadUsers.Split(';');
            if (!string.IsNullOrWhiteSpace(blockedUploadUsers[0].Trim()))
            {
                int blockUploadUsersCount = blockedUploadUsers.Length;
                for (int iLength = 0; iLength < blockUploadUsersCount; iLength++)
                {
                    blockedUploadUserList.Add(blockedUploadUsers[iLength].Trim());
                }
                MatterProvisionHelperUtility.AssignUserPermissions(clientContext, matterObj.MatterName, blockedUploadUserList, ConfigurationManager.AppSettings["Read"]);
                MatterProvisionHelperUtility.AssignUserPermissions(clientContext, matterObj.MatterName + ConfigurationManager.AppSettings["OneNoteLibrarySuffix"], blockedUploadUserList, ConfigurationManager.AppSettings["Read"]);
                if (isCalendarEnabled)
                {
                    //If isCreateCalendar flag is enabled; assign READ permissions to calendar list
                    MatterProvisionHelperUtility.AssignUserPermissions(clientContext, matterObj.MatterName, blockedUploadUserList, ConfigurationManager.AppSettings["Read"], calendarName);
                }
                if (isTaskEnabled)
                {
                    //If isTaskEnabled flag is enabled; assign READ permissions to task list
                    MatterProvisionHelperUtility.AssignUserPermissions(clientContext, taskListName, blockedUploadUserList, ConfigurationManager.AppSettings["Read"]);
                }
            }
            Console.WriteLine("Assigned permission");

            // Step 6 Stamp properties
            ListOperations.UpdateMetadataForList(clientContext, matterObj, client);
            Console.WriteLine("Updated matter properties");

            // Step 7 Add entry to list
            MatterProvisionHelper.InsertIntoMatterCenterMatters(configVal, clientName + "_" + matterObj.MatterName, matterObj, client);
            Console.WriteLine("{0} created successfully", matterObj.MatterName);
            Console.WriteLine("-------------------------------------------------------------------------------");
            successMatterNameCount++;
            return(successMatterNameCount);
        }
예제 #8
0
        /// <summary>
        /// Updates metadata for list
        /// </summary>
        /// <param name="clientContext">CLient context</param>
        /// <param name="matter">Matter object</param>
        /// <param name="client">Client object</param>
        /// <returns>String value</returns>
        internal static string UpdateMetadataForList(ClientContext clientContext, Matter matter, Client client)
        {
            string properties = string.Empty;

            try
            {
                var           props = clientContext.Web.Lists.GetByTitle(matter.MatterName).RootFolder.Properties;
                List <string> keys  = new List <string>();
                keys.Add("PracticeGroup");
                keys.Add("AreaOfLaw");
                keys.Add("SubAreaOfLaw");
                keys.Add("MatterName");
                keys.Add("MatterID");
                keys.Add("ClientName");
                keys.Add("ClientID");
                keys.Add("ResponsibleAttorney");
                keys.Add("TeamMembers");
                keys.Add("IsMatter");
                keys.Add("OpenDate");
                keys.Add("SecureMatter");
                keys.Add("BlockedUploadUsers");
                keys.Add("Success");
                keys.Add("IsConflictIdentified");
                keys.Add("MatterConflictCheckBy");
                keys.Add("MatterConflictCheckDate");
                keys.Add("MatterCenterPermissions");
                keys.Add("MatterCenterRoles");
                keys.Add("MatterCenterUsers");
                keys.Add("DocumentTemplateCount");
                keys.Add("MatterCenterDefaultContentType");
                keys.Add("MatterDescription");
                keys.Add("BlockedUsers");
                keys.Add("MatterGUID");

                Dictionary <string, string> propertyList = new Dictionary <string, string>();
                propertyList.Add("PracticeGroup", Microsoft.Security.Application.Encoder.HtmlEncode(matter.MatterType.PracticeGroup));
                propertyList.Add("AreaOfLaw", Microsoft.Security.Application.Encoder.HtmlEncode(matter.MatterType.AreaofLaw));
                propertyList.Add("SubAreaOfLaw", Microsoft.Security.Application.Encoder.HtmlEncode(matter.MatterType.SubAreaofLaw));
                propertyList.Add("MatterName", Microsoft.Security.Application.Encoder.HtmlEncode(matter.MatterName));
                propertyList.Add("MatterID", Microsoft.Security.Application.Encoder.HtmlEncode(matter.MatterId));
                propertyList.Add("ClientName", Microsoft.Security.Application.Encoder.HtmlEncode(client.ClientName));
                propertyList.Add("ClientID", Microsoft.Security.Application.Encoder.HtmlEncode(client.ClientId));
                propertyList.Add("ResponsibleAttorney", Microsoft.Security.Application.Encoder.HtmlEncode(matter.TeamInfo.ResponsibleAttorneys));
                propertyList.Add("TeamMembers", Microsoft.Security.Application.Encoder.HtmlEncode(matter.TeamInfo.Attorneys));
                propertyList.Add("IsMatter", Microsoft.Security.Application.Encoder.HtmlEncode("true"));
                propertyList.Add("OpenDate", Microsoft.Security.Application.Encoder.HtmlEncode(matter.OpenDate));
                propertyList.Add("SecureMatter", Microsoft.Security.Application.Encoder.HtmlEncode(matter.Conflict.SecureMatter));
                propertyList.Add("Success", Microsoft.Security.Application.Encoder.HtmlEncode("true"));
                propertyList.Add("BlockedUsers", Microsoft.Security.Application.Encoder.HtmlEncode(matter.TeamInfo.BlockedUsers));
                propertyList.Add("IsConflictIdentified", Microsoft.Security.Application.Encoder.HtmlEncode("true"));
                propertyList.Add("MatterConflictCheckBy", Microsoft.Security.Application.Encoder.HtmlEncode(matter.Conflict.ConflictCheckBy.TrimEnd(';')));
                propertyList.Add("MatterConflictCheckDate", Microsoft.Security.Application.Encoder.HtmlEncode(matter.Conflict.ConflictCheckOn));
                propertyList.Add("MatterCenterRoles", Microsoft.Security.Application.Encoder.HtmlEncode(ConfigurationManager.AppSettings["Roles"]));
                propertyList.Add("MatterCenterUsers", Microsoft.Security.Application.Encoder.HtmlEncode(matter.TeamInfo.ResponsibleAttorneys + Constants.SEPARATOR + matter.TeamInfo.Attorneys + Constants.SEPARATOR + matter.TeamInfo.BlockedUploadUsers).TrimEnd(';'));
                propertyList.Add("MatterCenterPermissions", Microsoft.Security.Application.Encoder.HtmlEncode(ConfigurationManager.AppSettings["FullControl"] + Constants.SEPARATOR + ConfigurationManager.AppSettings["Contribute"] + Constants.SEPARATOR + ConfigurationManager.AppSettings["Read"]));
                propertyList.Add("DocumentTemplateCount", Microsoft.Security.Application.Encoder.HtmlEncode(matter.DocumentCount));
                propertyList.Add("MatterCenterDefaultContentType", Microsoft.Security.Application.Encoder.HtmlEncode(matter.DefaultContentType));
                propertyList.Add("MatterDescription", Microsoft.Security.Application.Encoder.HtmlEncode(matter.MatterDescription));
                propertyList.Add("BlockedUploadUsers", Microsoft.Security.Application.Encoder.HtmlEncode(matter.TeamInfo.BlockedUploadUsers.TrimEnd(';')));
                propertyList.Add("MatterGUID", Microsoft.Security.Application.Encoder.HtmlEncode(matter.MatterGuid));
                propertyList.Add("vti_indexedpropertykeys", Microsoft.Security.Application.Encoder.HtmlEncode(MatterProvisionHelperUtility.GetEncodedValueForSearchIndexProperty(keys)));

                clientContext.Load(props);
                clientContext.ExecuteQuery();

                SetPropertyValueForList(clientContext, props, matter.MatterName, propertyList);
                properties = ListOperations.GetPropertyValueForList(clientContext, matter.MatterName, propertyList);
            }
            catch (Exception exception)
            {
                Utility.DisplayAndLogError(Utility.ErrorFilePath, string.Format(CultureInfo.InvariantCulture, ConfigurationManager.AppSettings["ErrorMessage"], "while updating Metadata"));
                Utility.DisplayAndLogError(Utility.ErrorFilePath, "Message: " + exception.Message + "Matter name: " + matter.MatterName + "\nStacktrace: " + exception.StackTrace);
                throw;
            }
            return(properties);
        }