//protected String popupMessage = ""; protected void Page_Load(object sender, EventArgs e) { SPSite site = SPContext.Current.Site; recordsTypes = WBTaxonomy.GetRecordsTypes(site); seriesTags = WBTaxonomy.GetSeriesTags(recordsTypes); functionalAreas = WBTaxonomy.GetFunctionalAreas(recordsTypes); WBUtils.logMessage("Records Types object has been recreated"); functionalAreas.InitialiseTaxonomyControl(DefaultFunctionalArea, "Select Default Functional Area", false, false, this); recordsTypes.InitialiseTaxonomyControl(DefaultRecordsType, "Select Default Publishing Out Records Type", false, false, this); seriesTags.InitialiseTaxonomyControl(DocumentSeriesTagParentTerm, "Select the Series Tag Parent", false, true, this); seriesTags.InitialiseTaxonomyControl(WorkBoxSeriesTagParentTerm, "Select the Series Tag Parent", false, true, this); if (!IsPostBack) { TreeViewTermCollection collection = new TreeViewTermCollection(recordsTypes.TermSet); // Bind the data source to your collection AllRecordsTypesTreeView.DataSource = collection; AllRecordsTypesTreeView.DataBind(); } }
protected void PublishNextDocument(object sender, EventArgs e) { WBLogging.Debug("Attempting to publishg the next document " + process.CurrentItemID); process = manager.PublishDocument(process); WBLogging.Debug("Published the document"); DocumentPublishingProgress.WBxUpdateTask(process.LastTaskFeedback); PublishingProcessJSON.Text = WBUtils.SerializeToCompressedJSONForURI(process); WBLogging.Debug("Serialized to: " + PublishingProcessJSON.Text); if (process.HasMoreDocumentsToPublish && process.PublishMode == WBPublishingProcess.PUBLISH_MODE__ALL_TOGETHER) { Image image = (Image)DocumentPublishingProgress.WBxFindNestedControlByID(DocumentPublishingProgress.WBxMakeControlID(process.CurrentItemID, "image")); image.ImageUrl = "/_layouts/images/WorkBoxFramework/processing-task-32.gif"; ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "TriggerNextStepFunction", "WorkBoxFramework_triggerPublishNextDocument();", true); } else { if (process.HasMoreDocumentsToPublish) { WBLogging.Debug("Trying to set button text to Publish next doc"); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "ChangeDoneButtonTextFunction", "WorkBoxFramework_finishedProcessing('Publish Next Document');", true); } else { WBLogging.Debug("Trying to set button text to done"); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "ChangeDoneButtonTextFunction", "WorkBoxFramework_finishedProcessing('Done');", true); } } }
private void AddFilesDetailsFromAlfresco(WBMigrationMapping mapping, SPSite controlSite, SPWeb controlWeb, SPList controlList, SPView controlView, SPListItem migrationItem, string folderPath) { WBFarm farm = WBFarm.Local; string csvFileDetails = WBUtils.GetURLContents(folderPath, farm.MigrationUserName, farm.MigrationPassword); string[] filesDetails = csvFileDetails.Split('\n'); foreach (string fileDetails in filesDetails) { string[] parts = fileDetails.Split(','); if (parts.Length > 3) { // So we're only going to add new file paths to the migration control list: if (WBUtils.FindItemByColumn(controlSite, controlList, WBColumn.SourceFilePath, parts[0]) == null) { SPListItem newMigrationItem = controlList.AddItem(); newMigrationItem.WBxCopyFrom(migrationItem, WBColumn.MappingPath); newMigrationItem.WBxSet(WBColumn.SourceFilePath, parts[0]); newMigrationItem.WBxSet(WBColumn.FileOrFolder, WBColumn.FILE_OR_FOLDER__FILE); newMigrationItem.WBxSet(WBColumn.Title, parts[1]); newMigrationItem.WBxSet(WBColumn.SourceID, parts[2]); newMigrationItem.WBxSet(WBColumn.ReferenceID, parts[4]); newMigrationItem.WBxSet(WBColumn.ReferenceDateString, parts[5]); newMigrationItem.WBxSet(WBColumn.DeclaredDateString, parts[7]); newMigrationItem.Update(); } } } migrationItem.WBxSet(WBColumn.MigrationStatus, WBColumn.MIGRATION_STATUS__DONE); migrationItem.Update(); }
protected void Page_Load(object sender, EventArgs e) { WorkBox workBox = WorkBox.GetIfWorkBox(SPContext.Current); if (workBox != null) { WBTeam owningTeam = workBox.OwningTeam; if (owningTeam == null) { LinkToOwner = "#"; } else { LinkToOwner = owningTeam.TeamSiteUrl; // Only need to set the text to the owning team's name if the text hasn't been set already: if (TextForLink == "") { TextForLink = owningTeam.Name; } WBUtils.logMessage("Found URL: " + LinkToOwner); } // This wont do anything because the web and site come from context, but still: workBox.Dispose(); } }
public bool RemoveDocumentByID(String recordID) { if (!IsOpen) { Open(); } WBLogging.Debug("Call to RemoveDocumentByID with recordID = " + recordID + " for library: " + this.URL); SPListItem recordItem = WBUtils.FindItemByColumn(Site, List, WBColumn.RecordID, recordID); if (recordItem == null) { // There is currently no such item - so there is nothing to remove. return(false); } else { Records.UndeclareItemAsRecord(recordItem); recordItem.Delete(); //libraryWeb.Update(); return(true); } }
public WBLink(String values) { if (String.IsNullOrEmpty(values)) { IsOK = false; WBLogging.Debug("WBLink being created with blank or null values string:" + values); return; } String[] valueArray = values.Split('|'); if (valueArray.Length == 5) { UsingTicksWhenVisited = true; } else if (valueArray.Length == 4) { UsingTicksWhenVisited = false; } else { IsOK = false; WBLogging.Debug("WBLink being created with values string with the wrong number of values: " + values); return; } Title = WBUtils.PutBackDelimiterCharacters(valueArray[0]); URL = WBUtils.PutBackDelimiterCharacters(valueArray[1]); UniqueID = WBUtils.PutBackDelimiterCharacters(valueArray[2]); SPWebGUID = valueArray[3]; if (UsingTicksWhenVisited) { TicksWhenVisitedString = valueArray[4]; } }
public void Initialise(WBTaxonomy taxonomy, String name, Guid id) { if (_taxonomy == null) { if (name == null || name == "") { throw new Exception("You cannot create a WBTerm (or derivative) with a null or blank name"); } WBLogging.Generic.Verbose("Initialising a term with name | id : " + name + " | " + id); _taxonomy = taxonomy; _name = name; _id = id; _UIControlValue = null; _term = null; WBLogging.Generic.Verbose("Right now the UIControlValue comes back as: " + UIControlValue); } else { WBUtils.shouldThrowError("You should never call this method on an initialised WBTerm or derived class"); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { String allDetails = Request.QueryString["CurrentDetails"]; string[] details = allDetails.Split(','); if (details.Length != 5) { WBLogging.Debug("The details sent to this page have the wrong structure: " + allDetails); ErrorMessage.Text = "There was a problem with the data sent to this page: " + allDetails; return; } EditWidth.Text = WBUtils.PutBackDelimiterCharacters(details[0]); EditHeight.Text = WBUtils.PutBackDelimiterCharacters(details[1]); BlockButtonsDetails.Value = WBUtils.PutBackDelimiterCharacters(details[2]); HiddenCSSExtraClass.Value = WBUtils.PutBackDelimiterCharacters(details[3]); HiddenCSSExtraStyles.Value = WBUtils.PutBackDelimiterCharacters(details[4]); } CSSExtraClass = HiddenCSSExtraClass.Value; CSSExtraStyles = HiddenCSSExtraStyles.Value; CreateTable(!IsPostBack); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "UpdatePreivewBlockButtons", "WBF_checkPreviewButtonHeights();", true); }
static void RegisterLoggingService(SPFeatureReceiverProperties properties) { // SPFarm farm = properties.Feature.Parent as SPFarm; SPFarm farm = SPFarm.Local; if (farm != null) { WBLogging service = WBLogging.Local; if (service == null) { service = new WBLogging(); service.Update(); if (service.Status != SPObjectStatus.Online) { service.Provision(); } } } else { WBUtils.logMessage("Farm was null!!"); } }
private void RecursivelyDeleteIfExists(SPSite site, SPWeb web, SPList list, SPListItem item, string username, string password) { string localWebURL = item.WBxGetColumnAsString(LOCAL_PAGE_URL); string localWebRelativeURL = WBUtils.GetURLWithoutHostHeader(localWebURL); bool isOriginalMapping = item.WBxGetColumnAsBool(ORIGINAL_MAPPING); try { SPWeb localWeb = site.OpenWeb(localWebRelativeURL); if (localWeb.Exists) { // NB that this method also disposes of the SPWeb object passed in: WBUtils.RecursivelyDeleteSPWeb(localWeb); } if (!isOriginalMapping) { item.Delete(); } } catch (Exception error) { WBLogging.Migration.Unexpected("Error when trying to perform 'Delete' action: " + error.Message); } }
private String stripDownDetailsForEditing(String details) { WBLogging.Debug("Stripping down details from: " + details); string[] parts = details.Split(','); String docDetails = WBUtils.PutBackDelimiterCharacters(parts[2]); if (!String.IsNullOrEmpty(docDetails) && docDetails.Contains("|")) { string[] documentDetails = docDetails.Split(';'); List <String> newDocumentDetails = new List <String>(); foreach (String oneDocDetails in documentDetails) { string[] oneDocParts = oneDocDetails.Split('|'); newDocumentDetails.Add(oneDocParts[0] + "|" + oneDocParts[1]); } parts[2] = WBUtils.ReplaceDelimiterCharacters(String.Join(";", newDocumentDetails.ToArray())); } return(String.Join(",", parts)); }
protected void selectButton_OnClick(object sender, EventArgs e) { String postBackValue = WBUtils.SerializeToCompressedJSONForURI(process); WBLogging.Debug("About to post back with: " + postBackValue); ReturnJSONFromDialogOK(postBackValue); }
public override string ToString() { List <String> values = new List <String>(); values.Add(WBUtils.ReplaceDelimiterCharacters(this.SubjectTag.UIControlValue)); values.Add(WBUtils.ReplaceDelimiterCharacters(this.PublicDocumentsLibrary)); values.Add(WBUtils.ReplaceDelimiterCharacters(this.ExtranetDocumentsLibrary)); return(String.Join("|", values.ToArray())); }
private SPListItemCollection getResultsForWorkBoxCollection(string workBoxCollectionURL, WBTeam team, WBRecordsType recordsType) { WBUtils.logMessage("Getting results for WBCollection: " + workBoxCollectionURL); using (WBCollection collection = new WBCollection(workBoxCollectionURL)) { return(collection.QueryFilteredBy(team, recordsType, true)); } }
protected void archiveAllButton_OnClick(object sender, EventArgs e) { string redirectUrl = "WorkBoxFramework/ActuallyArchiveRecords.aspx"; string queryString = "AllRecordIDsToArchive=" + AllRecordIDsToArchive.Value; queryString += "&ReasonToArchiveRecords=" + WBUtils.UrlDataEncode(ArchiveReason.Text); SPUtility.Redirect(redirectUrl, SPRedirectFlags.RelativeToLayoutsPage, Context, queryString); }
protected void saveButton_OnClick(object sender, EventArgs e) { String[] detailsToSave = new String[3]; detailsToSave[0] = WBUtils.ReplaceDelimiterCharacters(EditTitle.Text); detailsToSave[1] = WBUtils.ReplaceDelimiterCharacters(EditDescription.Text); detailsToSave[2] = WBUtils.ReplaceDelimiterCharacters(DocumentsDetails.Value); returnFromDialogOK(String.Join(",", detailsToSave)); }
public void EmailTeam(SPSite site, SPWeb web, String subject, String body, bool isBodyHTML) { subject = subject.Replace("[TeamName]", Name); body = body.Replace("[TeamName]", Name); foreach (SPUser user in this.MembersGroup(site).Users) { WBUtils.SendEmail(web, user.Email, subject, body, isBodyHTML); } }
protected void removeButton_OnClick(object sender, EventArgs e) { AreYouSureText.Text = "Something went wrong when trying to remove the indiviual or team."; if (TeamOrIndividual.Value == "Team" && team != null) { if (InvolvedOrVisiting.Value == "Involved") { WBTermCollection <WBTeam> involvedTeams = WorkBox.InvolvedTeams; involvedTeams.Remove(team); WorkBox.InvolvedTeams = involvedTeams; WorkBox.AuditLogEntry("Removed team", "No longer involved: " + team.Name); WorkBox.Update(); } else { WBTermCollection <WBTeam> visitingTeams = WorkBox.VisitingTeams; visitingTeams.Remove(team); WorkBox.VisitingTeams = visitingTeams; WorkBox.AuditLogEntry("Removed team", "No longer visiting: " + team.Name); WorkBox.Update(); } CloseDialogAndRefresh(); } if (TeamOrIndividual.Value == "Individual" && user != null) { if (InvolvedOrVisiting.Value == "Involved") { List <SPUser> involvedUsers = WorkBox.InvolvedIndividuals; involvedUsers = WBUtils.RemoveUser(involvedUsers, user); WorkBox.InvolvedIndividuals = involvedUsers; WorkBox.AuditLogEntry("Removed individual", "No longer involved: " + user.Name); WorkBox.Update(); } else { List <SPUser> visitingUsers = WorkBox.VisitingIndividuals; visitingUsers = WBUtils.RemoveUser(visitingUsers, user); WorkBox.VisitingIndividuals = visitingUsers; WorkBox.AuditLogEntry("Removed individual", "No longer visiting: " + user.Name); WorkBox.Update(); } CloseDialogAndRefresh(); } DisposeWorkBox(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { SPServiceContext _serviceContext = SPServiceContext.GetContext(WorkBox.Site); UserProfileManager _profileManager = new UserProfileManager(_serviceContext); UserProfile profile = _profileManager.GetUserProfile(true); UserProfileValueCollection myFavouriteWorkBoxesPropertyValue = profile[WorkBox.USER_PROFILE_PROPERTY__MY_FAVOURITE_WORK_BOXES]; string myFavouriteWorkBoxesString = ""; if (myFavouriteWorkBoxesPropertyValue.Value != null) { myFavouriteWorkBoxesString = myFavouriteWorkBoxesPropertyValue.Value.ToString(); } if (myFavouriteWorkBoxesString.Contains(WorkBox.Web.ID.ToString())) { // The user's favourites already contains this work box - so do nothing. Message.Text = "The work box is already one of your favourites."; } else { List <String> favourites = new List <String>(); if (!String.IsNullOrEmpty(myFavouriteWorkBoxesString.WBxTrim())) { favourites.AddRange(myFavouriteWorkBoxesString.Split(';')); } WBLink newFavourite = new WBLink(WorkBox, false); favourites.Add(newFavourite.ToString()); //favourites.Add(WorkBox.Web.Title + "|" + WorkBox.Web.Url + "|" + WorkBox.UniqueID + "|" + WorkBox.Web.ID.ToString()); myFavouriteWorkBoxesString = WBUtils.JoinUpToLimit(";", favourites, 3100); myFavouriteWorkBoxesPropertyValue.Value = myFavouriteWorkBoxesString; WorkBox.Web.AllowUnsafeUpdates = true; profile.Commit(); WorkBox.Web.AllowUnsafeUpdates = false; if (myFavouriteWorkBoxesString.Contains(WorkBox.Web.ID.ToString())) { Message.Text = "The work box has been added to your favourites."; } else { Message.Text = "The work box could not be added to your favourites as your list of favourites is too long."; } } okButton.Focus(); } }
public void Initialise(WBTaxonomy taxonomy) { if (_taxonomy == null && _term == null && !String.IsNullOrEmpty(_UIControlValue)) { _taxonomy = taxonomy; } else { WBUtils.shouldThrowError("You can only initialise just the taxonomy if the term and taxonomy are null by the UIControlValue is not empty"); } }
public WBMappedPath(WBMigrationMapping mapping, SPListItem mappingItem) { _mapping = mapping; MappingPath = WBUtils.NormalisePath(mappingItem.WBxGetAsString(WBColumn.MappingPath)); FunctionalAreaPath = WBUtils.NormalisePaths(mappingItem.WBxGetAsString(WBColumn.FunctionalAreaPath)); RecordsTypePath = WBUtils.NormalisePath(mappingItem.WBxGetAsString(WBColumn.RecordsTypePath)); SubjectTagsPaths = WBUtils.NormalisePaths(mappingItem.WBxGetAsString(WBColumn.SubjectTagsPaths)); OwningTeamPath = WBUtils.NormalisePath(mappingItem.WBxGetAsString(WBColumn.OwningTeamPath)); ProtectiveZone = mappingItem.WBxGetAsString(WBColumn.ProtectiveZone); LiveOrArchived = mappingItem.WBxGetAsString(WBColumn.LiveOrArchived); }
public SPGroup SyncMembersGroup(SPSite teamsSite, SPSite toSite) { // If no members group has been defined then there is nothing to do: if (MembersGroupName == "") { WBLogging.Teams.Verbose("The team has no members group defined: " + Name); return(null); } return(WBUtils.SyncSPGroup(teamsSite, toSite, MembersGroupName)); }
protected void returnFromDialog(int resultValue, string returnValue) { WBUtils.logMessage("Dialog returning with values: result = " + resultValue + " return = " + returnValue); // if (Page.Request.QueryString["IsDlg"] != null) // SPUtility.Redirect("/", SPRedirectFlags.UseSource, Context, ""); Page.Response.Clear(); Page.Response.Write(String.Format(CultureInfo.InvariantCulture, "<script type=\"text/javascript\">window.frameElement.commonModalDialogClose({0}, {1});</script>", new object[] { resultValue, String.IsNullOrEmpty(returnValue) ? "null" : String.Format("\"{0}\"", returnValue) })); Page.Response.End(); }
void link_DataBinding(object sender, EventArgs e) { HyperLink link = (HyperLink)sender; GridViewRow row = (GridViewRow)link.NamingContainer; link.NavigateUrl = DataBinder.Eval(row.DataItem, WBColumn.WorkBoxURL.InternalName).WBxToString(); String status = DataBinder.Eval(row.DataItem, WBColumn.WorkBoxStatus.InternalName).WBxToString().ToLower(); link.ImageUrl = WBUtils.StatusIconImageURL(status, Size); }
/// <summary> /// The IDs of these two lists need to be in sync for the precreation process to work correctly. /// </summary> /// <param name="precreatedWorkBoxesList"></param> /// <param name="requestPrecreatedWorkBoxList"></param> private void MakeSureListsAreInSync(SPList precreatedWorkBoxesList, SPList requestPrecreatedWorkBoxList) { List <SPListItem> itemsToDelete = new List <SPListItem>(); SPListItem requestNextItem = requestPrecreatedWorkBoxList.AddItem(); requestNextItem.Update(); itemsToDelete.Add(requestNextItem); int safety = 0; int safetyCutOut = 1000; int nextPrecreatedListID = -1; while (nextPrecreatedListID < requestNextItem.ID && safety < safetyCutOut) { safety++; SPListItem nextItem = precreatedWorkBoxesList.AddItem(); nextItem.Update(); nextPrecreatedListID = nextItem.ID; itemsToDelete.Add(nextItem); } int nextRequestListID = requestNextItem.ID; // Just in case the lists are out of sync the other way around: while (nextRequestListID < nextPrecreatedListID && safety < safetyCutOut) { safety++; SPListItem nextItem = requestPrecreatedWorkBoxList.AddItem(); nextItem.Update(); nextRequestListID = nextItem.ID; itemsToDelete.Add(nextItem); } if (safety >= safetyCutOut) { WBUtils.SendErrorReport(this.Collection.Web, "Work Box Precreation Error", "The safety cutout was exceeded when trying to synchronise the two precreate lists for template: " + TemplateTitle); throw new NotImplementedException("The safety cutout was exceeded when trying to synchronise the two precreate lists for template: " + TemplateTitle); } foreach (SPListItem item in itemsToDelete) { item.Delete(); } precreatedWorkBoxesList.Update(); requestPrecreatedWorkBoxList.Update(); // So, now the 'next ID' value for both of these two lists is the same. }
protected void Page_Load(object sender, EventArgs e) { SPWeb web = SPContext.Current.Web; SPSite site = SPContext.Current.Site; WBTaxonomy recordsTypesTaxonomy = WBTaxonomy.GetRecordsTypes(SPContext.Current.Site); string teamGUIDString = ""; Team = WBTeam.GetFromTeamSite(SPContext.Current); if (Team == null) { NotSetupText = "(<i>This site doesn't appear to be a team site so this web part wont work here.</i>)"; return; } teamGUIDString = WBExtensions.WBxToString(Team.Id); string recordsTypesListUrl = Team.RecordsTypesListUrl; /* * For the moment this web part is just going to list all of the available records types so the following code is not needed * * if (recordsTypesListUrl == null || recordsTypesListUrl == "") * { * //recordsTypesListUrl = web.Url + "/Lists/Configure%20Teams%20Records%20Classes"; * NotSetupText = "(<i>The team has no records types list setup yet.</i>)"; * return; * } */ string selectedRecordsTypeGUID = Request.QueryString["recordsTypeGUID"]; try { foreach (Term term in recordsTypesTaxonomy.TermSet.Terms) { WBRecordsType recordsClass = new WBRecordsType(recordsTypesTaxonomy, term); TreeNode node = createNodes(recordsClass); RecordsTypeTreeView.Nodes.Add(node); RecordsTypeTreeView.CollapseAll(); expandByRecordsTypeGUID(RecordsTypeTreeView.Nodes, selectedRecordsTypeGUID); } } catch (Exception exception) { WBUtils.logMessage("The error message was: " + exception.Message); } }
protected void Page_Load(object sender, EventArgs e) { SPGroup publishersGroup = WorkBox.OwningTeam.PublishersGroup(SPContext.Current.Site); if (publishersGroup != null) { if (publishersGroup.ContainsCurrentUser) { userCanPublishToPublic = true; } } if (!IsPostBack) { if (Request.QueryString["selectedItemsIDsString"] != null && Request.QueryString["selectedListGUID"] != null) { string selectedListGUID = Request.QueryString["selectedListGUID"]; string[] selectedItemsIDs = Request.QueryString["selectedItemsIDsString"].ToString().Split('|'); WBUtils.logMessage("The list GUID was: " + selectedListGUID); selectedListGUID = selectedListGUID.Substring(1, selectedListGUID.Length - 2).ToLower(); Guid sourceListGuid = new Guid(selectedListGUID); ListGUID.Value = sourceListGuid.ToString(); ItemID.Value = selectedItemsIDs[1].ToString(); WBUtils.logMessage("The ListGUID was: " + ListGUID.Value); WBUtils.logMessage("The ItemID was: " + ItemID.Value); SPDocumentLibrary sourceDocLib = (SPDocumentLibrary)WorkBox.Web.Lists[sourceListGuid]; SPListItem sourceDocAsItem = sourceDocLib.GetItemById(int.Parse(ItemID.Value)); SourceDocFileName.Text = sourceDocAsItem.Name; SourceDocIcon.AlternateText = "Icon of document being publishing out."; SourceDocIcon.ImageUrl = SPUtility.ConcatUrls("/_layouts/images/", SPUtility.MapToIcon(WorkBox.Web, SPUtility.ConcatUrls(WorkBox.Web.Url, sourceDocAsItem.Url), "", IconSize.Size32)); // foreach (SPList list in SPContext.Current.Web.Lists) // { // WBUtils.logMessage("Found list name = " + list.Title + " list ID = " + list.ID); // } } else { ErrorMessageLabel.Text = "There was an error with the passed through values"; } } }
public override string ToString() { List <String> values = new List <String>(); values.Add(WBUtils.ReplaceDelimiterCharacters(this.Title)); values.Add(WBUtils.ReplaceDelimiterCharacters(this.URL)); values.Add(WBUtils.ReplaceDelimiterCharacters(this.UniqueID)); values.Add(this.SPWebGUID); if (UsingTicksWhenVisited) { values.Add(TicksWhenVisitedString); } return(String.Join("|", values.ToArray())); }
/// <summary> /// Bind user data to the UI /// </summary> public void BindUser() { if (User == null) { return; } SPSecurity.RunWithElevatedPrivileges(delegate() { using (SPSite siteCollection = new SPSite(SPContext.Current.Site.ID)) { using (SPWeb site = siteCollection.OpenWeb()) { SPServiceContext serviceContext = SPServiceContext.GetContext(SPContext.Current.Site); UserProfileManager profileManager = new UserProfileManager(serviceContext); lblName.Text = User.WBxToHTML(profileManager, SPContext.Current.Site.RootWeb); hlEmail.Text = User.Email; hlEmail.NavigateUrl = "mailto:" + User.Email; if (!profileManager.UserExists(User.LoginName)) { return; } UserProfile profile = profileManager.GetUserProfile(User.LoginName); try { lblDept.Text = profile["Department"].Value != null ? profile["Department"].Value.ToString() : ""; lblPhone.Text = profile["WorkPhone"].Value != null ? profile["WorkPhone"].Value.ToString() : ""; imgUserPhoto.ImageUrl = profile["PictureURL"].Value != null ? profile["PictureURL"].Value.ToString() : "/_layouts/images/O14_person_placeHolder_96.png"; if (String.IsNullOrEmpty(User.Email)) { var workEmail = profile["WorkEmail"].Value != null ? profile["WorkEmail"].Value.ToString() : ""; hlEmail.Text = workEmail; hlEmail.NavigateUrl = "mailto:" + workEmail; } } catch { WBUtils.logMessage("WBFUser.ascx - BindUser - Error presenting userprofile"); throw; } } } }); }
protected void RenderRecordsToKeep() { if (String.IsNullOrEmpty(selectedRecordsString)) { RecordsBeingKept.Text = "<tr><td><i>No records were selected!</i></td></tr>"; return; } String html = @" <tr> <td class=""wbf-field-name-panel""> <div class=""wbf-field-name"">Records to Keep</div> </td> <td class=""wbf-field-value-panel""> "; String[] recordDetailsPairs = selectedRecordsString.Split('_'); List <String> allRecordIDsToKeep = new List <String>(); List <String> allRecordFilenamesToKeep = new List <String>(); foreach (String recordDetailsPair in recordDetailsPairs) { String[] recordDetails = recordDetailsPair.Split('x'); String recordSeriesID = recordDetails[0]; String recordID = recordDetails[1]; WBRecord versionRecord = manager.Libraries.GetRecordByID(recordID); String filename = versionRecord.Name; html += @" <div> <img src='/_layouts/images/WorkBoxFramework/list-item-16.png' alt='Record to be kept'/> <img src='" + WBUtils.DocumentIcon16(filename) + "' alt='Icon for file " + filename + "'/> " + filename + @" </div> "; allRecordIDsToKeep.Add(versionRecord.RecordID); allRecordFilenamesToKeep.Add(versionRecord.Name); } html += @" </td> </tr> "; RecordsBeingKept.Text = html; AllRecordIDsToKeep.Value = String.Join(",", allRecordIDsToKeep.ToArray()); AllRecordFilenamesToKeep.Value = String.Join(",", allRecordFilenamesToKeep.ToArray()); }