static private BreakPermission ( ClientContext clientContext, string matterName, bool copyPermissionsFromParent, string calendarName = null ) : bool | ||
clientContext | ClientContext | Client context |
matterName | string | Matter name |
copyPermissionsFromParent | bool | Copy permissions from parent |
calendarName | string | Calendar name |
return | bool |
/// <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); } }
/// <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); } }