{"id":19,"date":"2008-02-14T15:03:22","date_gmt":"2008-02-15T07:03:22","guid":{"rendered":"http:\/\/sharepoint.bryanfriedman.com\/index.php\/2008\/02\/14\/a-couple-of-things-i-learned-early\/"},"modified":"2008-02-16T11:10:47","modified_gmt":"2008-02-16T19:10:47","slug":"a-couple-of-things-i-learned-early","status":"publish","type":"post","link":"https:\/\/archive.bryanfriedman.me\/sharepoint\/index.php\/2008\/02\/14\/a-couple-of-things-i-learned-early\/","title":{"rendered":"A Couple of Things I Learned Early"},"content":{"rendered":"<p>These are two posts from my internal company blog that I felt were worth sharing publicly.<\/p>\n<h2>Deleting Master Pages from the Master Page Gallery<\/h2>\n<p>It&#8217;s not as easy to delete a master page from a site&#8217;s master page gallery as you might think.  Simply clicking the &#8220;Delete&#8221; option from the drop down menu doesn&#8217;t work because you will almost always get this error:<\/p>\n<p align=\"center\"><em>This item cannot be deleted because it is still referenced by other pages.<\/em><\/p>\n<p>You could spend a lot of time trying to find the pages that reference this master page, but you won&#8217;t find them because it&#8217;s highly possible that <em>there are none<\/em>!<\/p>\n<p>Thankfully, SPD comes to the rescue (for once) allowing you to delete the master page using a fun workaround we found on <a href=\"http:\/\/www.dotnettipoftheday.com\/Blog.aspx?Id=376\" target=\"_blank\">this blog<\/a>.<\/p>\n<p>Just use SPD to open the site in question and find the master page gallery (under _catalogs\/masterpage).  Create a folder in here called &#8220;deleteme&#8221; and move the master page that you&#8217;d like to delete into the folder.  Then delete the folder.  Voila!  It&#8217;s gone.  Thanks SPD!<\/p>\n<h2>Getting the Account Name from a &#8220;Person or Group&#8221; Field<\/h2>\n<p>We actually found something useful in the Community Content section of <a href=\"http:\/\/msdn2.microsoft.com\/en-us\/library\/microsoft.sharepoint.workflow.spworkflowtaskproperties.assignedto.aspx\" target=\"_blank\">an MSDN page<\/a>.  This doesn&#8217;t only apply to Workflow Task Properties either.  Basically, this code snippet will convert the underlying string value of a &#8220;Person or Group&#8221; type field in a SharePoint list(which looks something like &#8220;12345#;Some Name&#8221;) into the correct account name in the form of &#8220;&lt;Domain&gt;\\&lt;Username&gt;&#8221;.<\/p>\n<blockquote><p><font face=\"courier new\">SPFieldUserValue userValue = new SPFieldUserValue(workflowProperties.Web, retrievedFieldValue);<br \/>\nstring userName = userValue.User.LoginName;<\/font><\/p><\/blockquote>\n<p>In this case the SPWeb is coming from the workflowProperties, but I think it just needs the one that the SPList lives in.  Any SPWeb may even work.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>These are two posts from my internal company blog that I felt were worth sharing publicly. Deleting Master Pages from the Master Page Gallery It&#8217;s not as easy to delete a master page from a site&#8217;s master page gallery as you might think. Simply clicking the &#8220;Delete&#8221; option from the drop down menu doesn&#8217;t work [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-19","post","type-post","status-publish","format-standard","hentry","category-development"],"_links":{"self":[{"href":"https:\/\/archive.bryanfriedman.me\/sharepoint\/index.php\/wp-json\/wp\/v2\/posts\/19","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/archive.bryanfriedman.me\/sharepoint\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/archive.bryanfriedman.me\/sharepoint\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/archive.bryanfriedman.me\/sharepoint\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/archive.bryanfriedman.me\/sharepoint\/index.php\/wp-json\/wp\/v2\/comments?post=19"}],"version-history":[{"count":0,"href":"https:\/\/archive.bryanfriedman.me\/sharepoint\/index.php\/wp-json\/wp\/v2\/posts\/19\/revisions"}],"wp:attachment":[{"href":"https:\/\/archive.bryanfriedman.me\/sharepoint\/index.php\/wp-json\/wp\/v2\/media?parent=19"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/archive.bryanfriedman.me\/sharepoint\/index.php\/wp-json\/wp\/v2\/categories?post=19"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/archive.bryanfriedman.me\/sharepoint\/index.php\/wp-json\/wp\/v2\/tags?post=19"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}