public string AssignContentType(RequestObject requestObject, MatterMetadata matterMetadata) { string returnValue = ConstantStrings.FALSE; if (null != requestObject && null != matterMetadata && null != matterMetadata.Client && null != matterMetadata.Matter && (null != requestObject.RefreshToken || null != requestObject.SPAppToken) && ValidationHelperFunctions.CheckRequestValidatorToken()) { // For each value in the list of Content Type Names // Add that content Type to the Library Matter matter = matterMetadata.Matter; Client client = matterMetadata.Client; try { using (ClientContext clientContext = ServiceUtility.GetClientContext(requestObject.SPAppToken, new Uri(client.Url), requestObject.RefreshToken)) { string ProvisionMatterValidation = ValidationHelperFunctions.ProvisionMatterValidation(requestObject, client, clientContext, matter, null, int.Parse(ConstantStrings.ProvisionMatterAssignContentType, CultureInfo.InvariantCulture), null); if (string.IsNullOrWhiteSpace(ProvisionMatterValidation)) { // Returns the selected Content types from the Site Content Types IList<ContentType> contentTypeCollection = SharePointHelper.GetContentTypeData(clientContext, matter.ContentTypes, requestObject, client, matter); if (null != contentTypeCollection && matter.ContentTypes.Count == contentTypeCollection.Count && !string.IsNullOrWhiteSpace(matter.Name)) { returnValue = ProvisionHelperFunctions.AssignContentTypeHelper(requestObject, matterMetadata, clientContext, contentTypeCollection, client, matter); } else { MatterCenterException customException = new MatterCenterException(TextConstants.ErrorCodeContentTypes, TextConstants.ErrorMessageContentTypes); throw customException; // Throw will direct to current function's catch block (if present). If not present then it will direct to parent catch block. Parent will be the calling function } } else { returnValue = ProvisionMatterValidation; ProvisionHelperFunctions.DeleteMatter(requestObject, client, matter); } } } catch (Exception exception) { ///// SharePoint Specific Exception ProvisionHelperFunctions.DeleteMatter(requestObject, client, matter); returnValue = Logger.LogError(exception, MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name, ServiceConstantStrings.LogTableName); } } else { returnValue = string.Format(CultureInfo.InvariantCulture, ConstantStrings.ServiceResponse, string.Empty, TextConstants.MessageNoInputs); } return returnValue; }
/// <summary> /// Accesses the client context. /// </summary> /// <param name="contextToken">The context token for the client context</param> /// <param name="siteUrl">The site URL for the client context</param> /// <param name="refreshToken">The refresh token for the client context</param> /// <returns>Client Context with Access Token</returns> public static ClientContext AccessClientContext(string contextToken, Uri siteUrl, string refreshToken) { ClientContext result = null; try { if (!string.IsNullOrWhiteSpace(contextToken) && null != siteUrl) { SharePointContextToken contextTokenData = TokenHelper.ReadAndValidateContextToken(contextToken, null); string accessToken = TokenHelper.GetAccessToken(contextTokenData, siteUrl.Authority).AccessToken; result = TokenHelper.GetClientContextWithAccessToken(Convert.ToString(siteUrl, CultureInfo.InvariantCulture), accessToken); } else if (null != siteUrl && !string.IsNullOrWhiteSpace(refreshToken)) { Uri sharePointURL = siteUrl; string accessToken = TokenHelper.GetAccessToken(refreshToken, TokenHelper.SharePointPrincipal, sharePointURL.Authority, TokenHelper.GetRealmFromTargetUrl(sharePointURL)).AccessToken; result = TokenHelper.GetClientContextWithAccessToken(Convert.ToString(sharePointURL, CultureInfo.InvariantCulture), accessToken); } } catch (RequestException requestException) { if (requestException.Message.ToUpperInvariant().Contains(ConstantStrings.TokenRequestFailedErrorMessage.ToUpperInvariant())) { //// Failed with Token Request failure issue hence generate the Matter Center custom exception MatterCenterException tokenRequestException = new MatterCenterException(ConstantStrings.TokenRequestFailedErrorCode, requestException.Message); //// Log the exception with custom error code and default error message Logger.LogError(tokenRequestException, MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name, ConstantStrings.LogTableName); throw tokenRequestException; // Throw will direct to current function's catch block (if present). If not present then it will direct to parent catch block. Parent will be the calling function } else { //// Some other exception occurred Logger.LogError(requestException, MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name, ConstantStrings.LogTableName); throw; } } catch (Exception exception) { Logger.LogError(exception, MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name, ConstantStrings.LogTableName); throw; } return(result); }
/// <summary> /// Utility function to create matter. /// </summary> /// <param name="requestObject">object of type request object</param> /// <param name="client">object of client</param> /// <param name="matter">object of matter type</param> /// <param name="clientContext">client context information</param> /// <param name="matterURL">URL of matter</param> /// <returns>Matter URL</returns> internal static string CreateMatterUtility(RequestObject requestObject, Client client, Matter matter, ClientContext clientContext, string matterURL, MatterConfigurations matterConfigurations) { try { Uri centralListURL = new Uri(string.Concat(ServiceConstantStrings.CentralRepositoryUrl, ConstantStrings.ForwardSlash, ConstantStrings.Lists, ConstantStrings.ForwardSlash, ServiceConstantStrings.DMSMatterListName)); // Central Repository List URL IList<string> documentLibraryFolders = new List<string>(); Dictionary<string, bool> documentLibraryVersioning = new Dictionary<string, bool>(); Uri clientUrl = new Uri(client.Url); ListInformation listInformation = new ListInformation(); listInformation.name = matter.Name; listInformation.description = matter.Description; listInformation.folderNames = matter.FolderNames; listInformation.isContentTypeEnable = true; listInformation.versioning = new VersioningInfo(); listInformation.versioning.EnableVersioning = ServiceConstantStrings.IsMajorVersionEnable; listInformation.versioning.EnableMinorVersions = ServiceConstantStrings.IsMinorVersionEnable; listInformation.versioning.ForceCheckout = ServiceConstantStrings.IsForceCheckOut; listInformation.Path = matter.MatterGuid; Lists.Create(clientContext, listInformation); documentLibraryVersioning.Add("EnableVersioning", false); documentLibraryFolders.Add(matter.MatterGuid); listInformation.name = matter.Name + ServiceConstantStrings.OneNoteLibrarySuffix; listInformation.folderNames = documentLibraryFolders; listInformation.versioning.EnableVersioning = false; listInformation.versioning.EnableMinorVersions = false; listInformation.versioning.ForceCheckout = false; listInformation.Path = matter.MatterGuid + ServiceConstantStrings.OneNoteLibrarySuffix; Lists.Create(clientContext, listInformation); bool isCopyRoleAssignment = CopyRoleAssignment(matter.Conflict.Identified, matter.Conflict.SecureMatter); //create calendar list if create calendar flag is enabled and break its permissions string calendarName = string.Concat(matter.Name, ServiceConstantStrings.CalendarNameSuffix); string taskListName = string.Concat(matter.Name, ServiceConstantStrings.TaskNameSuffix); if (ServiceConstantStrings.IsCreateCalendarEnabled && matterConfigurations.IsCalendarSelected) { ListInformation calendarInformation = new ListInformation(); calendarInformation.name = calendarName; calendarInformation.isContentTypeEnable = false; calendarInformation.templateType = ConstantStrings.CalendarName; calendarInformation.Path = ServiceConstantStrings.TitleListsPath + matter.MatterGuid + ServiceConstantStrings.CalendarNameSuffix; if (Lists.Create(clientContext, calendarInformation)) { Lists.BreakPermission(clientContext, calendarName, isCopyRoleAssignment); } else { MatterCenterException customException = new MatterCenterException(TextConstants.ErrorCodeAddCalendarList, TextConstants.ErrorMessageAddCalendarList); throw customException; // Throw will direct to current function's catch block (if present). If not present then it will direct to parent catch block. Parent will be the calling function } } if (matterConfigurations.IsTaskSelected) { ListInformation taskListInformation = new ListInformation(); taskListInformation.name = taskListName; taskListInformation.isContentTypeEnable = false; taskListInformation.templateType = ConstantStrings.TaskListTemplateType; taskListInformation.Path = ServiceConstantStrings.TitleListsPath + matter.MatterGuid + ServiceConstantStrings.TaskNameSuffix; if (Lists.Create(clientContext, taskListInformation)) { Lists.BreakPermission(clientContext, taskListName, isCopyRoleAssignment); } else { MatterCenterException customException = new MatterCenterException(TextConstants.ErrorCodeAddTaskList, TextConstants.ErrorMessageAddTaskList); throw customException; // Throw will direct to current function's catch block (if present). If not present then it will direct to parent catch block. Parent will be the calling function } } string oneNoteUrl = string.Concat(clientUrl.AbsolutePath, ConstantStrings.ForwardSlash, matter.MatterGuid, ServiceConstantStrings.OneNoteLibrarySuffix, ConstantStrings.ForwardSlash, matter.MatterGuid); matterURL = Lists.AddOneNote(clientContext, client.Url, oneNoteUrl, matter.MatterGuid, matter.Name); matterURL = string.Format(CultureInfo.InvariantCulture, ConstantStrings.ServiceResponse, string.Empty, client.Url); if (null != matter.Conflict) { //Break permission for Matter library Lists.BreakPermission(clientContext, matter.Name, isCopyRoleAssignment); //Break permission for OneNote document library string oneNoteLibraryName = string.Concat(matter.Name, ServiceConstantStrings.OneNoteLibrarySuffix); Lists.BreakPermission(clientContext, oneNoteLibraryName, isCopyRoleAssignment); } string roleCheck = ValidationHelperFunctions.RoleCheck(requestObject, matter, client); if (string.IsNullOrEmpty(roleCheck)) { string centralList = Convert.ToString(centralListURL, CultureInfo.InvariantCulture); string matterSiteURL = centralList.Substring(0, centralList.LastIndexOf(string.Concat(ConstantStrings.ForwardSlash, ConstantStrings.Lists, ConstantStrings.ForwardSlash), StringComparison.OrdinalIgnoreCase)); string matterListName = centralList.Substring(centralList.LastIndexOf(ConstantStrings.ForwardSlash, StringComparison.OrdinalIgnoreCase) + 1); ClientContext listClientContext = ServiceUtility.GetClientContext(requestObject.SPAppToken, new Uri(matterSiteURL), requestObject.RefreshToken); ProvisionHelperFunctions.SaveMatterDetails(requestObject, client, matter, matterListName, matterConfigurations, listClientContext); } else { matterURL = roleCheck; } } catch (Exception exception) { ProvisionHelperFunctions.DeleteMatter(requestObject, client, matter); matterURL = Logger.LogError(exception, MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name, ServiceConstantStrings.LogTableName); } return matterURL; }
public string CreateMatterLandingPage(RequestObject requestObject, Client client, Matter matter, MatterConfigurations matterConfigurations) { int matterLandingPageId; string response = string.Empty; string result = string.Empty; if (null != requestObject && null != client && null != matter && ValidationHelperFunctions.CheckRequestValidatorToken()) { try { using (ClientContext clientContext = ServiceUtility.GetClientContext(requestObject.SPAppToken, new Uri(client.Url), requestObject.RefreshToken)) { string ProvisionMatterValidation = ValidationHelperFunctions.ProvisionMatterValidation(requestObject, client, clientContext, matter, null, int.Parse(ConstantStrings.ProvisionMatterMatterLandingPage, CultureInfo.InvariantCulture), matterConfigurations); if (string.IsNullOrWhiteSpace(ProvisionMatterValidation)) { Uri uri = new Uri(client.Url); Web web = clientContext.Web; //// Create Matter Landing Web Part Page string pageName = string.Format(CultureInfo.InvariantCulture, "{0}{1}", matter.MatterGuid, ConstantStrings.AspxExtension); matterLandingPageId = Page.CreateWebPartPage(clientContext, pageName, ConstantStrings.DefaultLayout, ConstantStrings.MasterPageGallery, ServiceConstantStrings.MatterLandingPageRepositoryName, matter.Name); if (0 <= matterLandingPageId) { bool isCopyRoleAssignment = ProvisionHelperFunctions.CopyRoleAssignment(matter.Conflict.Identified, matter.Conflict.SecureMatter); Lists.BreakItemPermission(clientContext, ServiceConstantStrings.MatterLandingPageRepositoryName, matterLandingPageId, isCopyRoleAssignment); Lists.SetItemPermission(clientContext, matter.AssignUserEmails, ServiceConstantStrings.MatterLandingPageRepositoryName, matterLandingPageId, matter.Permissions); //// Configure All Web Parts string[] webParts = MatterLandingHelperFunction.ConfigureXMLCodeOfWebParts(requestObject, client, matter, clientContext, pageName, uri, web, matterConfigurations); Microsoft.SharePoint.Client.File file = web.GetFileByServerRelativeUrl(string.Format(CultureInfo.InvariantCulture, "{0}{1}{2}{3}{4}", uri.AbsolutePath, ConstantStrings.ForwardSlash, ServiceConstantStrings.MatterLandingPageRepositoryName.Replace(ConstantStrings.Space, string.Empty), ConstantStrings.ForwardSlash, pageName)); clientContext.Load(file); clientContext.ExecuteQuery(); LimitedWebPartManager limitedWebPartManager = file.GetLimitedWebPartManager(PersonalizationScope.Shared); WebPartDefinition webPartDefinition = null; string[] zones = { ConstantStrings.HeaderZone, ConstantStrings.TopZone, ConstantStrings.RightZone, ConstantStrings.TopZone, ConstantStrings.RightZone, ConstantStrings.RightZone, ConstantStrings.FooterZone, ConstantStrings.RightZone, ConstantStrings.RightZone }; Page.AddWebPart(clientContext, limitedWebPartManager, webPartDefinition, webParts, zones); response = ConstantStrings.TRUE; } else { MatterCenterException customException = new MatterCenterException(ServiceConstantStrings.ErrorCodeMatterLandingPageExists, ServiceConstantStrings.ErrorCodeMatterLandingPageExists); throw customException; // Throw will direct to current function's catch block (if present). If not present then it will direct to parent catch block. Parent will be the calling function } } else { response = ProvisionMatterValidation; ProvisionHelperFunctions.DeleteMatter(requestObject, client, matter); } } result = response; } catch (Exception exception) { ////Generic Exception ProvisionHelperFunctions.DeleteMatter(requestObject, client, matter); result = Logger.LogError(exception, MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name, ServiceConstantStrings.LogTableName); } } else { result = string.Format(CultureInfo.InvariantCulture, ConstantStrings.ServiceResponse, string.Empty, TextConstants.MessageNoInputs); } return result; }
public string AssignUserPermissions(RequestObject requestObject, Client client, Matter matter, MatterConfigurations matterConfigurations) { string returnValue = ConstantStrings.FALSE; if (null != requestObject && null != client && null != matter && null != client.Url && null != matterConfigurations && (null != requestObject.RefreshToken || null != requestObject.SPAppToken) && ValidationHelperFunctions.CheckRequestValidatorToken()) { try { string calendarName = string.Concat(matter.Name, ServiceConstantStrings.CalendarNameSuffix); string oneNoteLibraryName = string.Concat(matter.Name, ServiceConstantStrings.OneNoteLibrarySuffix); string taskLibraryName = string.Concat(matter.Name, ServiceConstantStrings.TaskNameSuffix); using (ClientContext clientContext = ServiceUtility.GetClientContext(requestObject.SPAppToken, new Uri(client.Url), requestObject.RefreshToken)) { string ProvisionMatterValidation = ValidationHelperFunctions.ProvisionMatterValidation(requestObject, client, clientContext, matter, null, int.Parse(ConstantStrings.ProvisionMatterAssignUserPermissions, CultureInfo.InvariantCulture), null); if (string.IsNullOrWhiteSpace(ProvisionMatterValidation)) { if (!string.IsNullOrWhiteSpace(matter.Name)) { //Assign permission for Matter library returnValue = Convert.ToString(Lists.SetPermission(clientContext, matter.AssignUserEmails, matter.Permissions, matter.Name), CultureInfo.CurrentCulture); //Assign permission for OneNote library Lists.SetPermission(clientContext, matter.AssignUserEmails, matter.Permissions, oneNoteLibraryName); // Assign permission to calendar list if it is selected if (ServiceConstantStrings.IsCreateCalendarEnabled && matterConfigurations.IsCalendarSelected) { string returnValueCalendar = Convert.ToString(Lists.SetPermission(clientContext, matter.AssignUserEmails, matter.Permissions, calendarName), CultureInfo.CurrentCulture); if (!Convert.ToBoolean(returnValueCalendar, CultureInfo.InvariantCulture)) { MatterCenterException customException = new MatterCenterException(TextConstants.ErrorCodeCalendarCreation, TextConstants.ErrorMessageCalendarCreation); throw customException; // Throw will direct to current function's catch block (if present). If not present then it will direct to parent catch block. Parent will be the calling function } } // Assign permission to task list if it is selected if (matterConfigurations.IsTaskSelected) { string returnValueTask = Convert.ToString(Lists.SetPermission(clientContext, matter.AssignUserEmails, matter.Permissions, taskLibraryName), CultureInfo.CurrentCulture); if (!Convert.ToBoolean(returnValueTask, CultureInfo.InvariantCulture)) { MatterCenterException customException = new MatterCenterException(TextConstants.ErrorMessageTaskCreation, TextConstants.ErrorCodeAddTaskList); throw customException; // Throw will direct to current function's catch block (if present). If not present then it will direct to parent catch block. Parent will be the calling function } } } } else { returnValue = ProvisionMatterValidation; ProvisionHelperFunctions.DeleteMatter(requestObject, client, matter); } } } catch (Exception exception) { ///// Web Exception ProvisionHelperFunctions.DeleteMatter(requestObject, client, matter); returnValue = Logger.LogError(exception, MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name, ServiceConstantStrings.LogTableName); } } else { returnValue = string.Format(CultureInfo.InvariantCulture, ConstantStrings.ServiceResponse, string.Empty, TextConstants.MessageNoInputs); } // To avoid the invalid symbol error while parsing the JSON, return the response in lower case return returnValue.ToLower(CultureInfo.CurrentUICulture); }
/// <summary> /// Accesses the client context. /// </summary> /// <param name="contextToken">The context token for the client context</param> /// <param name="siteUrl">The site URL for the client context</param> /// <param name="refreshToken">The refresh token for the client context</param> /// <returns>Client Context with Access Token</returns> public static ClientContext AccessClientContext(string contextToken, Uri siteUrl, string refreshToken) { ClientContext result = null; try { if (!string.IsNullOrWhiteSpace(contextToken) && null != siteUrl) { SharePointContextToken contextTokenData = TokenHelper.ReadAndValidateContextToken(contextToken, null); string accessToken = TokenHelper.GetAccessToken(contextTokenData, siteUrl.Authority).AccessToken; result = TokenHelper.GetClientContextWithAccessToken(Convert.ToString(siteUrl, CultureInfo.InvariantCulture), accessToken); } else if (null != siteUrl && !string.IsNullOrWhiteSpace(refreshToken)) { Uri sharePointURL = siteUrl; string accessToken = TokenHelper.GetAccessToken(refreshToken, TokenHelper.SharePointPrincipal, sharePointURL.Authority, TokenHelper.GetRealmFromTargetUrl(sharePointURL)).AccessToken; result = TokenHelper.GetClientContextWithAccessToken(Convert.ToString(sharePointURL, CultureInfo.InvariantCulture), accessToken); } } catch (RequestException requestException) { if (requestException.Message.ToUpperInvariant().Contains(ConstantStrings.TokenRequestFailedErrorMessage.ToUpperInvariant())) { //// Failed with Token Request failure issue hence generate the Matter Center custom exception MatterCenterException tokenRequestException = new MatterCenterException(ConstantStrings.TokenRequestFailedErrorCode, requestException.Message); //// Log the exception with custom error code and default error message Logger.LogError(tokenRequestException, MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name, ConstantStrings.LogTableName); throw tokenRequestException; // Throw will direct to current function's catch block (if present). If not present then it will direct to parent catch block. Parent will be the calling function } else { //// Some other exception occurred Logger.LogError(requestException, MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name, ConstantStrings.LogTableName); throw; } } catch (Exception exception) { Logger.LogError(exception, MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name, ConstantStrings.LogTableName); throw; } return result; }
/// <summary> /// Uploads the document to OneDrive (Users MySite document library). /// </summary> /// <param name="requestObject">Request Object containing SharePoint App Token</param> /// <param name="collectionOfAttachments">Collection of documents with data for each document</param> /// <param name="collectionOfOriginalAttachments">Collection of documents with path of source document</param> /// <param name="usersMySite">User's My site URL</param> /// <param name="allAttachmentUrl">Attachment URL.</param> /// <param name="isOverwrite">Overwrite check</param> /// <returns>JSON string specifying path of OneDrive as success and false as failure</returns> internal static string UploadtoBriefcase(RequestObject requestObject, Dictionary<string, Stream> collectionOfAttachments, Dictionary<string, string> collectionOfOriginalAttachments, string usersMySite, string[] allAttachmentUrl, int isOverwrite) { string status = ConstantStrings.FALSE; try { using (ClientContext clientContext = ServiceUtility.GetClientContext(requestObject.SPAppToken, new Uri(usersMySite), requestObject.RefreshToken)) { Microsoft.SharePoint.Client.Web web = clientContext.Web; string contentType = ServiceConstantStrings.OneDriveContentTypeName; // Get Content Type string contentTypegroup = ServiceConstantStrings.OneDriveContentTypeGroup; // Get Group of Content Type List<string> siteColumns = new List<string>(new string[] { ServiceConstantStrings.OneDriveSiteColumn }); bool isSiteColumnCreated = BriefcaseContentTypeHelperFunctions.CreateSiteColumn(clientContext, web, siteColumns); if (isSiteColumnCreated) { bool isContentTypeCreated = BriefcaseContentTypeHelperFunctions.IsContentTypePresentCheck(clientContext, web, contentType, contentTypegroup, siteColumns); if (isContentTypeCreated) { List list = web.Lists.GetByTitle(ServiceConstantStrings.OneDriveDocumentLibraryTitle); string briefcaseFolderQuery = string.Format(CultureInfo.InvariantCulture, ServiceConstantStrings.BriefcaseFolderQuery, ServiceConstantStrings.LegalBriefcaseFolder); ListItemCollection listItems = Lists.GetData(clientContext, ServiceConstantStrings.OneDriveDocumentLibraryTitle, briefcaseFolderQuery); BriefcaseContentTypeHelperFunctions.SetContentType(clientContext, list, usersMySite); string defaultContentTypeId = BriefcaseContentTypeHelperFunctions.SetOneDriveDefaultContentType(clientContext, list, contentType); if (ConstantStrings.FALSE != defaultContentTypeId) { web.Update(); if (0 == isOverwrite) { MailAttachmentDetails.CheckoutFailedPosition = 0; status = BriefcaseUtilityHelperFunctions.NewDocumentToOneDrive(clientContext, collectionOfAttachments, collectionOfOriginalAttachments, allAttachmentUrl, web, usersMySite, defaultContentTypeId); //// Undo check out in case of failure //// undo checkout all documents from position MailAttachmentDetails.checkOutFailedPosition BriefcaseHelperFunction.DiscardDocumentCheckout(requestObject, allAttachmentUrl); } else { MailAttachmentDetails.CheckoutFailedPosition = 0; status = BriefcaseUtilityHelperFunctions.OverWriteDocument(collectionOfAttachments, collectionOfOriginalAttachments, usersMySite, status, clientContext, web, listItems, defaultContentTypeId); string[] returnedStatus = status.Split(Convert.ToChar(ConstantStrings.DOLLAR, CultureInfo.InvariantCulture)); if (ConstantStrings.TRUE == returnedStatus[0]) { BriefcaseHelperFunction.DiscardDocumentCheckout(requestObject, allAttachmentUrl); } status = returnedStatus[1]; } } else { MatterCenterException customException = new MatterCenterException(TextConstants.ErrorCodeAssignDefaultContentType, TextConstants.ErrorMessageAssignDefaultContentType); throw customException; // Throw will direct to current function's catch block (if present). If not present then it will direct to parent catch block. Parent will be the calling function } } else { MatterCenterException customException = new MatterCenterException(TextConstants.ErrorCodeCreateSiteContentType, TextConstants.ErrorMessageCreateSiteContentType); throw customException; // Throw will direct to current function's catch block (if present). If not present then it will direct to parent catch block. Parent will be the calling function } } else { MatterCenterException customException = new MatterCenterException(TextConstants.ErrorCodeCreateSiteColumn, TextConstants.ErrorMessageCreateSiteColumn); throw customException; // Throw will direct to current function's catch block (if present). If not present then it will direct to parent catch block. Parent will be the calling function } } } catch (Exception exception) { Logger.LogError(exception, MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name, ServiceConstantStrings.LogTableName); status += ConstantStrings.Semicolon + usersMySite; } return status; }