/// <summary> /// Updates the associated list. /// Perform following updates: /// * Adds archived column /// * Explicitly for task center adds Timesheet backup column /// * Updates existing views to filter data by Archived column /// * Adds new view to show Archived items /// </summary> /// <param name="elevatedWeb">The elevated web.</param> /// <param name="associatedListInfo">The associated list information.</param> /// <param name="level">The logging level.</param> private void UpdateAssociatedList(SPWeb elevatedWeb, AssociatedListInfo associatedListInfo, int level) { try { if (!_processedLists.Contains(associatedListInfo.ListId)) { LogInfo($"About to update {associatedListInfo.Title} list.", level); var associatedList = elevatedWeb.Lists.GetList(associatedListInfo.ListId, true); AddArchivedColumn(associatedList, level); if ((int)associatedList.BaseTemplate == (int)EPMLiveLists.TaskCenter) { AddArchivedTimesheetColumn(associatedList, level); } UpdateExistingListViews(associatedList, level); CreateViewForArchivedRecords(associatedList, ArchivedRecordsViewName, level); _processedLists.Add(associatedList.ID); } } catch (Exception ex) { LogError($"Could not process associated list '{associatedListInfo.Title} with id {associatedListInfo.ListId}'.", level); LogError(ex.Message, level); } }
private NavLink GetLink(AssociatedListInfo listInfo, SPList spList, string title) { SPList list = null; try { list = spList.ParentWeb.Lists.GetList(listInfo.ListId, false); } catch { } return(list == null ? null : new NavLink { Id = listInfo.ListId.ToString(), Title = listInfo.Title, Url = string.Format(LIST_URL, list.DefaultViewUrl, listInfo.LinkedField, spList.ID, listInfo.Title, title) }); }