<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Aptillon Blog</title>
	<atom:link href="http://blog.aptillon.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.aptillon.com</link>
	<description>The Official Blog Of Aptillon</description>
	<lastBuildDate>Wed, 16 May 2012 21:30:17 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Manage Your Service Apps Faster</title>
		<link>http://blog.aptillon.com/2012/05/16/manage-your-service-apps-faster/</link>
		<comments>http://blog.aptillon.com/2012/05/16/manage-your-service-apps-faster/#comments</comments>
		<pubDate>Wed, 16 May 2012 21:30:17 +0000</pubDate>
		<dc:creator>Matthew McDermott</dc:creator>
				<category><![CDATA[Matthew McDermott]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[SharePoint 2010]]></category>

		<guid isPermaLink="false">http://blog.aptillon.com/2012/05/16/manage-your-service-apps-faster/</guid>
		<description><![CDATA[In the SharePoint 2010 Administrators Survival Camp that I teach for Critical Path Training I teach a module on PowerShell (and a whole bunch of tips and tricks along the way). One of the tips that I teach is to use the Resources list in Central Administration to create links to the most often used [...]]]></description>
			<content:encoded><![CDATA[<p>In the <a href="http://www.criticalpathtraining.com/Courses/Pages/SharePoint2010AdministratorsSurvivalCamp.aspx" target="_blank">SharePoint 2010 Administrators Survival Camp</a> that I teach for <a href="http://www.criticalpathtraining.com" target="_blank">Critical Path Training</a> I teach a module on PowerShell (and a whole bunch of tips and tricks along the way). One of the tips that I teach is to use the Resources list in Central Administration to create links to the most often used service applications. While teaching the module this month I began creating a Farm Build script based on <a href="http://blog.falchionconsulting.com/" target="_blank">Gary Lapointe’s</a> Farm-SPBuild script from <a href="http://www.internationalsharepointconference.com/" target="_blank">ISC London</a>. The script creates the Farm that the student creates manually on the first day of class. I went on to add the following script to create the links to my “favorite” web apps.</p>    <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:C89E2BDB-ADD3-4f7a-9810-1B7EACF446C1:de734923-4e02-4ef8-b3fa-431170a55261" class="wlWriterEditableSmartContent"><pre style=white-space:normal>
<pre class="brush: powershell; pad-line-numbers: true; title: ; notranslate">
#Get the URL to Central Administration
$caUrl = Get-spwebapplication -includecentraladministration | where {$_.IsAdministrationWebApplication} | select Url -First 1
#Filter the Service Apps by those we want links
$apps = Get-SPServiceApplication | ?{($_.TypeName -eq &quot;User Profile Service Application&quot;) `
								 -or ($_.TypeName -eq &quot;Managed Metadata Service&quot;) `
								 -or ($_.TypeName -eq &quot;Business Data Connectivity Service Application&quot;) `
								 -or ($_.TypeName -eq &quot;Search Service Application&quot;)}

#Start our assignment for the web object
$spAssignment = Start-SPAssignment
#Grab our list in Central Admin
$list = (Get-SPWeb -identity $caUrl.Url -AssignmentCollection $spAssignment).Lists[&quot;Resources&quot;]
#Enumerate the list and create links to each
foreach ($app in $apps)
{
	Write-Host &quot;Adding&quot; $app.DisplayName
	$field = New-Object Microsoft.SharePoint.SPFieldURLValue
	$field.Description = $app.DisplayName
	$field.URL = $app.ManageLink.Url
	$item = $list.Items.Add()
	$item[&quot;URL&quot;] = $field
	$item[&quot;Comments&quot;] = &quot;Added From PowerShell&quot;
	$item.Update()
}
#Dispose of the list
Stop-SPAssignment $spAssignment
#Open IE to Central Admin
Write-Host &quot;Launching IE&quot;
$ie = New-Object -com &quot;InternetExplorer.Application&quot;
$ie.Navigate($caUrl.Url)
$ie.Visible = $true


</pre>
</pre>
</div>



<p>I added this to the end of the script that builds all my service applications and then when Central Administration opens I see this:</p>

<p><a href="http://blog.aptillon.com/wp-content/uploads/2012/05/SNAGHTML1bd0d32.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="SNAGHTML1bd0d32" border="0" alt="SNAGHTML1bd0d32" src="http://blog.aptillon.com/wp-content/uploads/2012/05/SNAGHTML1bd0d32_thumb.png" width="380" height="412" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.aptillon.com/2012/05/16/manage-your-service-apps-faster/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>International SharePoint Conference 2012 Follow-up</title>
		<link>http://blog.aptillon.com/2012/05/15/international-sharepoint-conference-2012-follow-up/</link>
		<comments>http://blog.aptillon.com/2012/05/15/international-sharepoint-conference-2012-follow-up/#comments</comments>
		<pubDate>Tue, 15 May 2012 14:35:07 +0000</pubDate>
		<dc:creator>Gary Lapointe</dc:creator>
				<category><![CDATA[Gary Lapointe]]></category>
		<category><![CDATA[ISCLondon]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[SharePoint 2010]]></category>

		<guid isPermaLink="false">http://blog.aptillon.com/2012/05/15/international-sharepoint-conference-2012-follow-up/</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[]]></content:encoded>
			<wfw:commentRss>http://blog.aptillon.com/2012/05/15/international-sharepoint-conference-2012-follow-up/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>V5 Master Search Center</title>
		<link>http://blog.aptillon.com/2012/04/17/v5-master-search-center/</link>
		<comments>http://blog.aptillon.com/2012/04/17/v5-master-search-center/#comments</comments>
		<pubDate>Tue, 17 Apr 2012 20:31:56 +0000</pubDate>
		<dc:creator>Matthew McDermott</dc:creator>
				<category><![CDATA[Matthew McDermott]]></category>
		<category><![CDATA[Building Blocks]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[Search]]></category>

		<guid isPermaLink="false">http://blog.aptillon.com/2012/04/17/v5-master-search-center/</guid>
		<description><![CDATA[I am really enjoying learning about Responsive Web Design and happily applying this to my current client. There is a whole bunch of information available all over the web. Companies like Template Monster have begun to roll out some beautiful examples of templates focused on the concept. (They have some other cool free HTML5 designs [...]]]></description>
			<content:encoded><![CDATA[<p>I am really enjoying learning about Responsive Web Design and happily applying this to my current client. There is a whole bunch of information available all over the web. Companies like <a href="http://www.templatemonster.com/" target="_blank">Template Monster</a> have begun to roll out some <a href="http://www.templatemonster.com/properties/features/responsive-design/" target="_blank">beautiful examples of templates</a> focused on the concept. (They have some <a href="http://blog.templatemonster.com/2010/10/04/free-html5-website-template-industrial-business/" target="_blank">other cool free HTML5 designs</a> too, they are not responsive though.) In doing my research I found <a href="http://kyleschaeffer.com/" target="_blank">Kyle Schaeffer’s</a> site and his <a href="http://kyleschaeffer.com/sharepoint/v5-responsive-html5-master-page/" target="_blank">V5 Responsive Master</a>. I like the clean look, and as a starting page, it provides a good start. As a “search guy” the problem I find with most (if not all) Master Pages provided on the Web is that none that I have found address the Search Center. The authors stop short of a “complete branding solution” by simply rendering a home page and a few publishing pages. (Many I have found will not even render the other default publishing pages like Press Releases.) I don’t mean to be critical of Kyle’s work, I think he did a great job, I mean to call attention to the failure of designers in general who ignore (or just don’t know SharePoint well enough to pay attention to) the Search Center.</p>  <h2>The Issue</h2>  <p>It’s not their fault. The Search Center is a finicky site. Out of the box the Search Center uses “minimal.master”. Of course this causes the Search Center to have a different look and feel (and navigation) than the rest of the site. Since the Search Main page, Search Results page and People Search Results page all have different corresponding Page Layouts it becomes increasingly complicated to manage the branding for the site. These page layouts have some major flaws in their layout that have been present since the search center was initially introduced. For example the search box control is in the Breadcrumb placeholder control. This means that an unwitting designer who decides to remove the breadcrumb from the master page is inadvertently removing the search box from every search page.&#160; My favorite evidence of this is if you apply “nightandday.master” to the search site the search box control vanishes. Click the breadcrumb folder in the menu and “Thar she blows!” See! This is even a challenge for the designers at Microsoft!</p>  <p><a href="http://blog.aptillon.com/wp-content/uploads/2012/04/SNAGHTML3485f01.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="SNAGHTML3485f01" border="0" alt="SNAGHTML3485f01" src="http://blog.aptillon.com/wp-content/uploads/2012/04/SNAGHTML3485f01_thumb.png" width="594" height="392" /></a></p>  <h2>The Solution</h2>  <p>The resolution to the issue is actually quite simple. Have your designers plan to spend time designing the Search Center. Don’t create a unique master page for the Search Center. Create page layouts that work for the search center. That means either including the BreadCrumb placeholder or changing the Search Page Layouts (which is what I do because on a branding project we’re already creating a bunch of page layouts.) Here is what I do:</p>  <ol>   <li>Create a copy of the 3 Search Page Layouts: Search Main, Search Results and People Search Results (I prefixed them with “V5”.) </li>    <li>For each page, check them it and add a comment to the top of the PlaceHolderMain content control like “&lt;!-- V5 Search Page –&gt;”. Save the files.      <br /><a href="http://blog.aptillon.com/wp-content/uploads/2012/04/SNAGHTML352b7bb.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="SNAGHTML352b7bb" border="0" alt="SNAGHTML352b7bb" src="http://blog.aptillon.com/wp-content/uploads/2012/04/SNAGHTML352b7bb_thumb.png" width="521" height="106" /></a> </li>    <li>Return to the Page Layouts folder and retitle each file so you can tell them apart from their out of the box counterpart. In SharePoint Designer I do this by clicking on the Title column for the file and prefixing it with “V5”.      <br /><a href="http://blog.aptillon.com/wp-content/uploads/2012/04/SNAGHTML3573fbf.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="SNAGHTML3573fbf" border="0" alt="SNAGHTML3573fbf" src="http://blog.aptillon.com/wp-content/uploads/2012/04/SNAGHTML3573fbf_thumb.png" width="509" height="114" /></a> </li>    <li>Check all three files in and publish a major version. </li>    <li>Now we just have to apply our new page layouts to the corresponding Search Center Pages. By default the Search Center only allows certain Page Layouts to be used. We have to add our Page Layouts to the approved list. Navigate to <strong>Site Settings | Page Layouts and Site Templates</strong> and locate the three new Page Layouts and move them to the “approved” side with the <strong>Add</strong> button.       <br /><a href="http://blog.aptillon.com/wp-content/uploads/2012/04/SNAGHTML35d5a70.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="SNAGHTML35d5a70" border="0" alt="SNAGHTML35d5a70" src="http://blog.aptillon.com/wp-content/uploads/2012/04/SNAGHTML35d5a70_thumb.png" width="607" height="219" /></a> </li>    <li>Navigate to the search page, choose Edit and change the Page Layout to use your new V5 Page Layout. For the Search page choose “V5 Search Box”, for the results page “V5 Search Results” and the People Search Results page choose “V5 People search results”.      <br /><a href="http://blog.aptillon.com/wp-content/uploads/2012/04/SNAGHTML3606a48.png"><img style="background-image: none; border-right-width: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="SNAGHTML3606a48" border="0" alt="SNAGHTML3606a48" src="http://blog.aptillon.com/wp-content/uploads/2012/04/SNAGHTML3606a48_thumb.png" width="486" height="392" /></a> </li>    <li>Save the changes to the page and Check it in. </li>    <li>Nothing has changed, has it? View Source on each page and you should find your comment, if not you missed a step and there is no point in going further until you get this first part right. If you have the right changes for all three pages you are ready to proceed to actually making the changes necessary to “Respons-i-fy” your Search Center.      <br /><a href="http://blog.aptillon.com/wp-content/uploads/2012/04/SNAGHTML3634329.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="SNAGHTML3634329" border="0" alt="SNAGHTML3634329" src="http://blog.aptillon.com/wp-content/uploads/2012/04/SNAGHTML3634329_thumb.png" width="624" height="162" /></a> </li> </ol>  <h2>Making the Search Center Responsive</h2>  <p>The rest of the work is pure SharePoint Designer Page Layout work. At this point you can just create what is essentially a web part page and forget about all the rest of the markup. If you decide to reuse the base page layouts here are the high points (I’ll provide the files at the end):</p>  <h3>Search Main</h3>  <ol>   <li>Remove all of the UIVersion=”3” declarations. Were going to own this page. We don’t need version 3 (or 4 for that matter). </li>    <li>Remove all the styling from PlaceHolderAdditionalPageHead and replace it with the necessary CSS to make the page work (see my files below). </li>    <li>Remove the PlaceHolderPageTitleInTitleArea content (unless you like it…) </li>    <li>Remove the Content control for <strong>SPNavigation</strong>. This is the cause of the doubled top navigation that you may be seeing. In the V5 master it contains a necessary publishing control.       <br /><a href="http://blog.aptillon.com/wp-content/uploads/2012/04/SNAGHTML3f89438.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="SNAGHTML3f89438" border="0" alt="SNAGHTML3f89438" src="http://blog.aptillon.com/wp-content/uploads/2012/04/SNAGHTML3f89438_thumb.png" width="371" height="228" /></a> </li>    <li>Move the contents of the Content control PlaceHolderTitleBreadcrumb into the PlaceHolderMain content control. For the sake of this demo I just pasted it all in and did not change anything. In reality I would remove the <strong>tables</strong> in favor of <strong>divs</strong> and change the layout. </li> </ol>  <p>At this point I have whittled the page down to about 94 lines from the original 331. The end result is this:</p>  <p><a href="http://blog.aptillon.com/wp-content/uploads/2012/04/image.png"><img style="background-image: none; border-right-width: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blog.aptillon.com/wp-content/uploads/2012/04/image_thumb.png" width="484" height="429" /></a></p>  <p>You will notice the duplicate Search Box. This is because the original V5 master page omitted the PlaceHolderSearchArea. If you add the Content Place Holder back to the master page you can achieve the effect of removing the top navigation search box while in the search center. Use code like this in the V5 Master Page:</p>  <pre class="csharpcode"><span class="kwrd">&lt;</span><span class="html">div</span> <span class="attr">id</span><span class="kwrd">=&quot;v5-search&quot;</span><span class="kwrd">&gt;</span>
  <span class="rem">&lt;!-- search --&gt;</span>
  <span class="kwrd">&lt;</span><span class="html">asp:ContentPlaceHolder</span> <span class="attr">id</span><span class="kwrd">=&quot;PlaceHolderSearchArea&quot;</span> <span class="attr">runat</span><span class="kwrd">=&quot;server&quot;</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">SharePoint:DelegateControl</span> <span class="attr">runat</span><span class="kwrd">=&quot;server&quot;</span> <span class="attr">ControlId</span><span class="kwrd">=&quot;SmallSearchInputBox&quot;</span> <span class="attr">Version</span><span class="kwrd">=&quot;4&quot;</span><span class="kwrd">/&gt;</span>
  <span class="kwrd">&lt;/</span><span class="html">asp:ContentPlaceHolder</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;/</span><span class="html">div</span><span class="kwrd">&gt;</span></pre>
<style type="text/css">


.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>

<h3>Search Results</h3>

<p>It’s pretty much the same process here. Start by getting the structure right then come back and style the web part XSL to work for the results if you need to.</p>

<ol>
  <li>Remove the extra crud you don’t need. I remove all static web parts at this point. This significantly cuts down on the code for the page and enables me to focus on the page layout. I can always add them back later if I need to. (3696 lines whittled down to 89 lines.) </li>

  <li>Move the content from PlaceHolderTitleBreadcrumb to PlaceHolderMain. </li>

  <li>Remove everything from PlaceHolderAdditionalPageHead and replace it with the necessary CSS to override the styles. </li>
</ol>

<p>At this point you should have a search center results page that looks like it belongs to your Web site.</p>

<p><a href="http://blog.aptillon.com/wp-content/uploads/2012/04/SNAGHTMLaf1f81d.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="SNAGHTMLaf1f81d" border="0" alt="SNAGHTMLaf1f81d" src="http://blog.aptillon.com/wp-content/uploads/2012/04/SNAGHTMLaf1f81d_thumb.png" width="629" height="579" /></a></p>

<p>&#160;</p>

<h3>People Search</h3>

<p>Of course we cannot forget about People search results! By now you should be able to recite the necessary changes. Repeat after me:</p>

<ol>
  <li>Remove the extra crud you don’t need. (Including all of the static web parts and UIVersion=3 content.) I also clear the PlaceHolderPageTitleInTitleArea and other controls I know I won’t need. Your mileage may vary. My page is down to about 100 lines. </li>

  <li>Move the content from PlaceHolderTitleBreadcrumb to PlaceHolderMain. </li>

  <li>Remove everything from PlaceHolderAdditionalPageHead and replace it with the necessary CSS to override the styles. (Or link to a central CSS file.) </li>

  <li>Remove the SPNavigation content placeholder you don’t need the extra navigation. </li>
</ol>

<p>Again, with a bit of work you should be able to get something that looks like it belongs on the site and is not an afterthought.</p>

<p><a href="http://blog.aptillon.com/wp-content/uploads/2012/04/SNAGHTMLb2bdf12.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="SNAGHTMLb2bdf12" border="0" alt="SNAGHTMLb2bdf12" src="http://blog.aptillon.com/wp-content/uploads/2012/04/SNAGHTMLb2bdf12_thumb.png" width="629" height="843" /></a></p>

<p>&#160;</p>

<h2>Additional Tips</h2>

<p>Keep in mind that the controls on the Search Pages are just Web Parts. So If you find that you are seeing double, you may have inadvertently created new instances of web parts on the page. Just edit the page and delete the extra web parts. </p>

<p><a href="http://blog.aptillon.com/wp-content/uploads/2012/04/SNAGHTML4019feb.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="SNAGHTML4019feb" border="0" alt="SNAGHTML4019feb" src="http://blog.aptillon.com/wp-content/uploads/2012/04/SNAGHTML4019feb_thumb.png" width="596" height="219" /></a></p>

<p>You will spend most of your time troubleshooting the default SharePoint page rendering and styles. I hate this, but it’s the cost of playing in the SharePoint world. In these sample files I embedded all of the necessary CSS changes into the Page Layouts themselves, I would not do this in production. I would just create a new CSS file like “V5Search.css” and link each page layout to that file. I only used this technique here to show what overrides were necessary for each type of page. I rely heavily on Firebug and IE Developer Toolbar. If you have not used these tools now is the time to learn them.</p>

<h2>Final Results</h2>

<p>You have to design your site to suit your specific needs. I <strong>guarantee</strong> that the solution I present here will not work for 100% of you 100% of the time. This is just intended to show you that it is possible to include the Search Center in your plans for a responsive web site.</p>

<h3>Desktop Layout</h3>

<p>The desktop layouts are the images I presented above. The real magic is when you start using a smaller viewport like a tablet of smart phone.</p>

<h3>Tablet Layout</h3>

<p>For the tablet I chose to remove the right column. This removes the Post-query Suggestions and People.</p>

<p><a href="http://blog.aptillon.com/wp-content/uploads/2012/04/SNAGHTMLb3355d7.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="SNAGHTMLb3355d7" border="0" alt="SNAGHTMLb3355d7" src="http://blog.aptillon.com/wp-content/uploads/2012/04/SNAGHTMLb3355d7_thumb.png" width="559" height="575" /></a></p>

<p>For the People Results I removed the refiners, you could choose to remove the About Me column and leave the refiners if you wish. The cool thing about this approach is the choice is yours.</p>

<p><a href="http://blog.aptillon.com/wp-content/uploads/2012/04/SNAGHTMLb348e541.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="SNAGHTMLb348e54" border="0" alt="SNAGHTMLb348e54" src="http://blog.aptillon.com/wp-content/uploads/2012/04/SNAGHTMLb348e54_thumb.png" width="559" height="587" /></a></p>

<h3>Smart Phone Layout</h3>

<p><a href="http://blog.aptillon.com/wp-content/uploads/2012/04/SNAGHTMLbc9f219.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="SNAGHTMLbc9f219" border="0" alt="SNAGHTMLbc9f219" src="http://blog.aptillon.com/wp-content/uploads/2012/04/SNAGHTMLbc9f219_thumb.png" width="231" height="1037" /></a><a href="http://blog.aptillon.com/wp-content/uploads/2012/04/SNAGHTMLb35b19d.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="SNAGHTMLb35b19d" border="0" alt="SNAGHTMLb35b19d" src="http://blog.aptillon.com/wp-content/uploads/2012/04/SNAGHTMLb35b19d_thumb.png" width="246" height="942" /></a></p>

<h2>Conclusion</h2>

<p>While it is true that working with the out of the box pages can pose a steep learning curve, there is nothing preventing you from creating your own pages. In all of my projects I create all of my page layouts to go with my master pages and avoid using the out of the box pages. The only reason I did it here for this demo is to provide a starting point for your own exploration of the topic. Here are the pages that I used to create this demo.</p>

<p>I also have to mention that having the &quot;right&quot; resources is necessary in any SharePoint project. In my case the right, perfect, most excellent resource was Matt Schoen. Matt was able to take my jumble of CSS and make it make sense. He has the uncanny ability to take CSS that I have been looking at for an hour and spot the problem in seconds. I could not have finished this post without his assistance. Now if I could just get him to share his knowledge with the rest of y'all...</p>

<p><a href="http://www.ableblue.com/blog/media/V5SearchResults.zip" target="_blank">Sample files V5SearchResults.zip</a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.aptillon.com/2012/04/17/v5-master-search-center/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Exporting and Importing SharePoint 2010 Terms</title>
		<link>http://blog.aptillon.com/2012/03/16/exporting-and-importing-sharepoint-2010-terms/</link>
		<comments>http://blog.aptillon.com/2012/03/16/exporting-and-importing-sharepoint-2010-terms/#comments</comments>
		<pubDate>Fri, 16 Mar 2012 23:52:42 +0000</pubDate>
		<dc:creator>Gary Lapointe</dc:creator>
				<category><![CDATA[Gary Lapointe]]></category>
		<category><![CDATA[Cmdlets]]></category>
		<category><![CDATA[Managed Terms]]></category>
		<category><![CDATA[SharePoint 2010]]></category>

		<guid isPermaLink="false">http://blog.aptillon.com/2012/03/16/exporting-and-importing-sharepoint-2010-terms/</guid>
		<description><![CDATA[Ever had the need to migrate Terms from the Managed Metadata Term Store from one environment to another? Do you find the flat, CSV, import approach provided out of the box to be insufficient (especially with its lack of support for alternate labels)? When I first started working with Terms over two years ago I [...]]]></description>
			<content:encoded><![CDATA[<p>Ever had the need to migrate Terms from the Managed Metadata Term Store from one environment to another? Do you find the flat, CSV, import approach provided out of the box to be insufficient (especially with its lack of support for alternate labels)? When I first started working with Terms over two years ago I was extremely frustrated by the lack of export and import capabilities so I decided to solve the problem myself by creating two cmdlets, <strong>Export-SPTerms</strong> and <strong>Import-SPTerms</strong>. I’ve actually had these cmdlets publicly available for about two years now but I suspect very few people actually know they exist so I thought I’d put together this short post just to highlight them (I also recently pushed out an update which adds support for Site Collection scoped Groups if you have SP1 deployed).</p>  <p>I don’t want to go into a lot of detail regarding how these cmdlets work as they’re really very simple and the bulk of the code is just about iterating through the Term Store structure and turning the various objects into an XML structure (you can download the code from my downloads page). So with brevity in mind, here’s the full help for the <strong>Export-SPTerms</strong> cmdlet:</p>  <div style="border-bottom: black 1px solid; border-left: black 1px solid; background-color: darkblue; font-family: courier new; height: 400px; color: white; overflow: auto; border-top: black 1px solid; border-right: black 1px solid">   <p>NAME      <br />&#160;&#160;&#160; Export-SPTerms       <br />&#160;&#160;&#160; <br />SYNOPSIS       <br />&#160;&#160;&#160; Export the Managed Metadata Terms.       <br />&#160;&#160;&#160; <br />SYNTAX       <br />&#160;&#160;&#160; Export-SPTerms [-TaxonomySession] &lt;SPTaxonomySessionPipeBind&gt; [[-OutputFile] &lt;String&gt;] [-AssignmentCollection &lt;SPAssignmentCollection&gt;] [&lt;CommonParameters&gt;]       <br />&#160;&#160;&#160; <br />&#160;&#160;&#160; Export-SPTerms [-TermStore] &lt;SPTaxonomyTermStorePipeBind&gt; [[-OutputFile] &lt;String&gt;] [-AssignmentCollection &lt;SPAssignmentCollection&gt;] [&lt;CommonParameters&gt;]       <br />&#160;&#160;&#160; <br />&#160;&#160;&#160; Export-SPTerms [-Group] &lt;SPTaxonomyGroupPipeBind&gt; [[-OutputFile] &lt;String&gt;] [-AssignmentCollection &lt;SPAssignmentCollection&gt;] [&lt;CommonParameters&gt;]       <br />&#160;&#160;&#160; <br />&#160;&#160;&#160; Export-SPTerms [-TermSet] &lt;SPTaxonomyTermSetPipeBind&gt; [[-OutputFile] &lt;String&gt;] [-AssignmentCollection &lt;SPAssignmentCollection&gt;] [&lt;CommonParameters&gt;]       <br />&#160;&#160;&#160; <br />&#160;&#160;&#160; Export-SPTerms [-Term] &lt;SPTaxonomyTermPipeBind&gt; [[-OutputFile] &lt;String&gt;] [-AssignmentCollection &lt;SPAssignmentCollection&gt;] [&lt;CommonParameters&gt;]       <br />&#160;&#160;&#160; <br />&#160;&#160;&#160; <br />DESCRIPTION       <br />&#160;&#160;&#160; Export the Managed Metadata Terms.       <br />&#160;&#160;&#160; <br />&#160;&#160;&#160; Copyright 2011 Falchion Consulting, LLC       <br />&#160;&#160;&#160; &gt; For more information on this cmdlet and others:       <br />&#160;&#160;&#160; &gt;http://blog.falchionconsulting.com/       <br />&#160;&#160;&#160; &gt; Use of this cmdlet is at your own risk.       <br />&#160;&#160;&#160; &gt; Gary Lapointe assumes no liability.       <br />&#160;&#160;&#160; </p>    <p>PARAMETERS      <br />&#160;&#160;&#160; -TaxonomySession &lt;SPTaxonomySessionPipeBind&gt;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; The TaxonomySession object containing the Term Stores to export.       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; Required?&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; true       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; Position?&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 1       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; Default value&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; Accept pipeline input?&#160;&#160;&#160;&#160;&#160;&#160; true (ByValue)       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; Accept wildcard characters?&#160; false       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160; -TermStore &lt;SPTaxonomyTermStorePipeBind&gt;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; The TermStore object containing the terms to export.       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; Required?&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; true       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; Position?&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 1       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; Default value&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; Accept pipeline input?&#160;&#160;&#160;&#160;&#160;&#160; true (ByValue, ByPropertyName)       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; Accept wildcard characters?&#160; false       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160; -Group &lt;SPTaxonomyGroupPipeBind&gt;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; The Group object containing the terms to export.       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; Required?&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; true       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; Position?&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 1       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; Default value&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; Accept pipeline input?&#160;&#160;&#160;&#160;&#160;&#160; true (ByValue, ByPropertyName)       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; Accept wildcard characters?&#160; false       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160; -TermSet &lt;SPTaxonomyTermSetPipeBind&gt;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; The TermSet object containing the terms to export.       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; Required?&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; true       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; Position?&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 1       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; Default value&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; Accept pipeline input?&#160;&#160;&#160;&#160;&#160;&#160; true (ByValue, ByPropertyName)       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; Accept wildcard characters?&#160; false       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160; -Term &lt;SPTaxonomyTermPipeBind&gt;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; The Term object containing the terms to export.       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; Required?&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; true       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; Position?&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 1       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; Default value&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; Accept pipeline input?&#160;&#160;&#160;&#160;&#160;&#160; true (ByValue, ByPropertyName)       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; Accept wildcard characters?&#160; false       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160; -OutputFile [&lt;String&gt;]       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; The path to the file to save the terms to.       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; Required?&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; false       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; Position?&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 2       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; Default value&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; Accept pipeline input?&#160;&#160;&#160;&#160;&#160;&#160; false       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; Accept wildcard characters?&#160; false       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160; -AssignmentCollection [&lt;SPAssignmentCollection&gt;]       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; Manages objects for the purpose of proper disposal. Use of objects, such as SPWeb or SPSite, can use large amounts of memory and use of these objects in Windows PowerShell scripts requires proper memory management. Using the SPAssignment object, you can assign objects to a variable and dispose of the objects after they are needed to free up memory. When SPWeb, SPSite, or SPSiteAdministration objects are used, the objects are automatically disposed of if an assignment collection or the Global parameter is not used.       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; When the Global parameter is used, all objects are contained in the global store. If objects are not immediately used, or disposed of by using the Stop-SPAssignment command, an out-of-memory scenario can occur.       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; Required?&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; false       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; Position?&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; named       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; Default value&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; Accept pipeline input?&#160;&#160;&#160;&#160;&#160;&#160; true (ByValue)       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; Accept wildcard characters?&#160; false       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160; &lt;CommonParameters&gt;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; This cmdlet supports the common parameters: Verbose, Debug,       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; ErrorAction, ErrorVariable, WarningAction, WarningVariable,       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; OutBuffer and OutVariable. For more information, type,       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &quot;get-help about_commonparameters&quot;.       <br />&#160;&#160;&#160; <br />INPUTS       <br />&#160;&#160;&#160; <br />&#160;&#160;&#160; <br />&#160;&#160;&#160; <br />OUTPUTS       <br />&#160;&#160;&#160; <br />&#160;&#160;&#160; <br />&#160;&#160;&#160; <br />NOTES       <br />&#160;&#160;&#160; <br />&#160;&#160;&#160; <br />&#160;&#160;&#160; For more information, type &quot;Get-Help Export-SPTerms -detailed&quot;. For technical information, type &quot;Get-Help Export-SPTerms -full&quot;.       <br />&#160;&#160;&#160; <br />&#160;&#160;&#160; ------------------EXAMPLE 1-----------------------       <br />&#160;&#160;&#160; <br />&#160;&#160;&#160; PS C:\&gt; Export-SPTerms -TaxonomySession &quot;http://site/&quot; -OutputFile &quot;c:\terms.xml&quot;       <br />&#160;&#160;&#160; <br />&#160;&#160;&#160; <br />&#160;&#160;&#160; This example exports the terms for all term stores associated with the site and saves to c:\terms.xml.       <br />&#160;&#160;&#160; <br />&#160;&#160;&#160; ------------------EXAMPLE 2-----------------------       <br />&#160;&#160;&#160; <br />&#160;&#160;&#160; PS C:\&gt; Export-SPTerms -Group (Get-SPTaxonomySession -Site &quot;http://site/&quot;).TermStores[0].Groups[0] -OutputFile &quot;c:\terms.xml&quot;       <br />&#160;&#160;&#160; <br />&#160;&#160;&#160; <br />&#160;&#160;&#160; This example exports the first Group of the first Term Store and saves to c:\terms.xml.       <br />&#160;&#160;&#160; <br />&#160;&#160;&#160; <br />RELATED LINKS       <br />&#160;&#160;&#160; Import-SPTerms       <br />&#160;&#160;&#160; Get-SPTaxonomySession</p> </div>  <p>&#160;</p>  <p>Now lets look at the <strong>Import-SPTerms</strong> cmdlet (it’s very similar):</p>  <div style="border-bottom: black 1px solid; border-left: black 1px solid; background-color: darkblue; font-family: courier new; height: 400px; color: white; overflow: auto; border-top: black 1px solid; border-right: black 1px solid">   <p>     <br />NAME       <br />&#160;&#160;&#160; Import-SPTerms       <br />&#160;&#160;&#160; <br />SYNOPSIS       <br />&#160;&#160;&#160; Import the Managed Metadata Terms.       <br />&#160;&#160;&#160; <br />SYNTAX       <br />&#160;&#160;&#160; Import-SPTerms [-TaxonomySession] &lt;SPTaxonomySessionPipeBind&gt; [-InputFile] &lt;XmlDocumentPipeBind&gt; [-AssignmentCollection &lt;SPAssignmentCollection&gt;] [&lt;CommonParameters&gt;]       <br />&#160;&#160;&#160; <br />&#160;&#160;&#160; Import-SPTerms [-ParentTermStore] &lt;SPTaxonomyTermStorePipeBind&gt; [-InputFile] &lt;XmlDocumentPipeBind&gt; [-AssignmentCollection &lt;SPAssignmentCollection&gt;] [&lt;CommonParameters&gt;]       <br />&#160;&#160;&#160; <br />&#160;&#160;&#160; Import-SPTerms [-ParentGroup] &lt;SPTaxonomyGroupPipeBind&gt; [-InputFile] &lt;XmlDocumentPipeBind&gt; [-AssignmentCollection &lt;SPAssignmentCollection&gt;] [&lt;CommonParameters&gt;]       <br />&#160;&#160;&#160; <br />&#160;&#160;&#160; Import-SPTerms [-ParentTermSet] &lt;SPTaxonomyTermSetPipeBind&gt; [-InputFile] &lt;XmlDocumentPipeBind&gt; [-AssignmentCollection &lt;SPAssignmentCollection&gt;] [&lt;CommonParameters&gt;]       <br />&#160;&#160;&#160; <br />&#160;&#160;&#160; Import-SPTerms [-ParentTerm] &lt;SPTaxonomyTermPipeBind&gt; [-InputFile] &lt;XmlDocumentPipeBind&gt; [-AssignmentCollection &lt;SPAssignmentCollection&gt;] [&lt;CommonParameters&gt;]       <br />&#160;&#160;&#160; <br />&#160;&#160;&#160; <br />DESCRIPTION       <br />&#160;&#160;&#160; Import the Managed Metadata Terms.       <br />&#160;&#160;&#160; <br />&#160;&#160;&#160; Copyright 2011 Falchion Consulting, LLC       <br />&#160;&#160;&#160; &gt; For more information on this cmdlet and others:       <br />&#160;&#160;&#160; &gt; http://blog.falchionconsulting.com/       <br />&#160;&#160;&#160; &gt; Use of this cmdlet is at your own risk.       <br />&#160;&#160;&#160; &gt; Gary Lapointe assumes no liability.       <br />&#160;&#160;&#160; </p>    <p>PARAMETERS      <br />&#160;&#160;&#160; -TaxonomySession &lt;SPTaxonomySessionPipeBind&gt;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; The TaxonomySession object to import Term Stores into.       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; Required?&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; true       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; Position?&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 1       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; Default value&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; Accept pipeline input?&#160;&#160;&#160;&#160;&#160;&#160; true (ByValue)       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; Accept wildcard characters?&#160; false       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160; -ParentTermStore &lt;SPTaxonomyTermStorePipeBind&gt;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; The TermStore object to import Groups into.       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; Required?&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; true       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; Position?&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 1       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; Default value&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; Accept pipeline input?&#160;&#160;&#160;&#160;&#160;&#160; true (ByValue, ByPropertyName)       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; Accept wildcard characters?&#160; false       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160; -ParentGroup &lt;SPTaxonomyGroupPipeBind&gt;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; The Group object to import Term Sets into.       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; Required?&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; true       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; Position?&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 1       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; Default value&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; Accept pipeline input?&#160;&#160;&#160;&#160;&#160;&#160; true (ByValue, ByPropertyName)       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; Accept wildcard characters?&#160; false       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160; -ParentTermSet &lt;SPTaxonomyTermSetPipeBind&gt;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; The TermSet object to import Terms into.       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; Required?&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; true       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; Position?&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 1       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; Default value&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; Accept pipeline input?&#160;&#160;&#160;&#160;&#160;&#160; true (ByValue, ByPropertyName)       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; Accept wildcard characters?&#160; false       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160; -ParentTerm &lt;SPTaxonomyTermPipeBind&gt;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; The Term object to import Terms into.       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; Required?&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; true       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; Position?&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 1       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; Default value&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; Accept pipeline input?&#160;&#160;&#160;&#160;&#160;&#160; true (ByValue, ByPropertyName)       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; Accept wildcard characters?&#160; false       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160; -InputFile &lt;XmlDocumentPipeBind&gt;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; The path to the file containing the terms to import or an XmlDocument object or XML string.       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; Required?&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; true       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; Position?&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 2       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; Default value&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; Accept pipeline input?&#160;&#160;&#160;&#160;&#160;&#160; true (ByValue)       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; Accept wildcard characters?&#160; false       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160; -AssignmentCollection [&lt;SPAssignmentCollection&gt;]       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; Manages objects for the purpose of proper disposal. Use of objects, such as SPWeb or SPSite, can use large amounts of memory and use of these objects in Windows PowerShell scripts requires proper memory management. Using the SPAssignment object, you can assign objects to a variable and dispose of the objects after they are needed to free up memory. When SPWeb, SPSite, or SPSiteAdministration objects are used, the objects are automatically disposed of if an assignment collection or the Global parameter is not used.       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; When the Global parameter is used, all objects are contained in the global store. If objects are not immediately used, or disposed of by using the Stop-SPAssignment command, an out-of-memory scenario can occur.       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; Required?&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; false       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; Position?&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; named       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; Default value&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; Accept pipeline input?&#160;&#160;&#160;&#160;&#160;&#160; true (ByValue)       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; Accept wildcard characters?&#160; false       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160; &lt;CommonParameters&gt;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; This cmdlet supports the common parameters: Verbose, Debug,       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; ErrorAction, ErrorVariable, WarningAction, WarningVariable,       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; OutBuffer and OutVariable. For more information, type,       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &quot;get-help about_commonparameters&quot;.       <br />&#160;&#160;&#160; <br />INPUTS       <br />&#160;&#160;&#160; <br />&#160;&#160;&#160; <br />&#160;&#160;&#160; <br />OUTPUTS       <br />&#160;&#160;&#160; <br />&#160;&#160;&#160; <br />&#160;&#160;&#160; <br />NOTES       <br />&#160;&#160;&#160; <br />&#160;&#160;&#160; <br />&#160;&#160;&#160; For more information, type &quot;Get-Help Import-SPTerms -detailed&quot;. For technical information, type &quot;Get-Help Import-SPTerms -full&quot;.       <br />&#160;&#160;&#160; <br />&#160;&#160;&#160; ------------------EXAMPLE 1-----------------------       <br />&#160;&#160;&#160; <br />&#160;&#160;&#160; PS C:\&gt; Import-SPTerms -ParentTermStore (Get-SPTaxonomySession -Site &quot;http://site/&quot;).TermStores[0] -InputFile &quot;c:\terms.xml&quot;       <br />&#160;&#160;&#160; <br />&#160;&#160;&#160; <br />&#160;&#160;&#160; This example imports the Group from c:\terms.xml to the first Term Store.       <br />&#160;&#160;&#160; <br />&#160;&#160;&#160; ------------------EXAMPLE 2-----------------------       <br />&#160;&#160;&#160; <br />&#160;&#160;&#160; PS C:\&gt; Import-SPTerms -TaxonomySession &quot;http://site/&quot; -InputFile &quot;c:\terms.xml&quot;       <br />&#160;&#160;&#160; <br />&#160;&#160;&#160; <br />&#160;&#160;&#160; This example imports the terms from c:\terms.xml to the Term Store associated with http://site.       <br />&#160;&#160;&#160; <br />&#160;&#160;&#160; <br />RELATED LINKS       <br />&#160;&#160;&#160; Export-SPTerms       <br />&#160;&#160;&#160; Get-SPTaxonomySession       <br /></p> </div>  <p>&#160;</p>  <p>Using these cmdlets I can easily export terms from one environment, such as production, to another environment, such as my test environment. This avoids the need to have backup and restore the database associated with the term store (which requires removing and re-provisioning the service application. And the way I’ve written the cmdlets all the Term Set, Group, and Term IDs remain consistent and, because the exported XML is easily modified, when it comes to Site Collection scoped Groups you can do a simple search and replace to change Site Collection URLs to match the new target (note that I first check for a Site Collection with the specified URL and if not found then I use the ID and if I still can’t locate the Site Collection then I create the Group as a standard shared Group).</p>  <p>-Gary</p>  <p style="padding-bottom: 20px; background-color: #500500; padding-left: 20px; padding-right: 20px; color: white; padding-top: 20px">View the original post on Gary’s personal blog for comments and all related downloads: <a title="Exporting and Importing SharePoint 2010 Terms" href="http://blog.falchionconsulting.com/index.php/2012/03/exporting-and-importing-sharepoint-2010-terms/">Exporting and Importing SharePoint 2010 Terms</a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.aptillon.com/2012/03/16/exporting-and-importing-sharepoint-2010-terms/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>&#8220;Stamping&#8221; PDF Files Downloaded from SharePoint 2010</title>
		<link>http://blog.aptillon.com/2012/03/11/stamping-pdf-files-downloaded-from-sharepoint-2010/</link>
		<comments>http://blog.aptillon.com/2012/03/11/stamping-pdf-files-downloaded-from-sharepoint-2010/#comments</comments>
		<pubDate>Sun, 11 Mar 2012 23:29:34 +0000</pubDate>
		<dc:creator>Gary Lapointe</dc:creator>
				<category><![CDATA[Gary Lapointe]]></category>
		<category><![CDATA[IHttpHandler]]></category>
		<category><![CDATA[PDF]]></category>
		<category><![CDATA[SharePoint 2010]]></category>
		<category><![CDATA[SharePoint Foundation 2010]]></category>

		<guid isPermaLink="false">http://blog.aptillon.com/2012/03/11/stamping-pdf-files-downloaded-from-sharepoint-2010/</guid>
		<description><![CDATA[First off I want to clarify that the subject of this post is not my idea as it is something that my friend Roman Kobzarev put together for his company and I merely assisted with getting the code to work. The problem that Roman was trying to solve was that his company provided numerous PDF [...]]]></description>
			<content:encoded><![CDATA[<p>First off I want to clarify that the subject of this post is not my idea as it is something that my friend Roman Kobzarev put together for his company and I merely assisted with getting the code to work. The problem that Roman was trying to solve was that his company provided numerous PDF files that registered/paying members could download and, unfortunately, they were finding some of those files being posted to various other sites without their permission; so in an attempt to at least discourage this they wanted to stamp the PDF files with some information about the user who downloaded the file.</p>  <p>There are various ways in which this problem can be solved but perhaps one of the simpler approaches, and the approach outlined here, was to create an HTTP Handler which intercepted requests for any PDF files and then simply retrieve the file from SharePoint, modify it, and then send it on its way. The cool thing about this approach and the pattern shown here is that it can easily be applied to any file type which requires some user or request specific modifications applied to it.</p>  <p>Before I get to the actual code I want to point out one third party dependency that we used: <a href="http://sourceforge.net/projects/itextsharp/" target="_blank">iTextSharp</a>. This is an open source .NET library for PDF generation and manipulation. There are many options available when looking to manipulate PDF files and in this case this one was chosen due to its cost (free). So let’s get to the code.</p>  <p>In terms of code there really isn’t that much which is what makes this such a nice solution. The first piece is the actual implementation of the <font face="Courier New">IHttpHandler</font> interface:</p>  <pre style="border-bottom: black 1px solid; border-left: black 1px solid; width: 100%; height: 400px; overflow: auto; border-top: black 1px solid; border-right: black 1px solid" class="code"><span style="color: blue">using </span>System.IO;
<span style="color: blue">using </span>System.Web;
<span style="color: blue">using </span>Microsoft.SharePoint;
<span style="color: blue">using </span>iTextSharp.text;
<span style="color: blue">using </span>iTextSharp.text.pdf;

<span style="color: blue">namespace </span>Aptillon.SharePoint.PDFWatermark
{
    <span style="color: blue">public class </span><span style="color: #2b91af">PDFWatermarkHttpHandler </span>: <span style="color: #2b91af">IHttpHandler
    </span>{
        <span style="color: blue">public void </span>ProcessRequest(<span style="color: #2b91af">HttpContext </span>context)
        {

            <span style="color: #2b91af">SPFile </span>file = <span style="color: #2b91af">SPContext</span>.Current.Web.GetFile(context.Request.Url.ToString());
            <span style="color: blue">byte</span>[] content = file.OpenBinary();
            <span style="color: #2b91af">SPUser </span>currentUser = <span style="color: #2b91af">SPContext</span>.Current.Web.CurrentUser;

            <span style="color: blue">string </span>watermark = <span style="color: blue">null</span>;
            <span style="color: blue">if </span>(currentUser != <span style="color: blue">null</span>)
                watermark = <span style="color: #a31515">&quot;This download was specially prepared for &quot; </span>+ currentUser.Name;

            <span style="color: blue">if </span>(watermark != <span style="color: blue">null</span>)
            {
                <span style="color: #2b91af">PdfReader </span>pdfReader = <span style="color: blue">new </span><span style="color: #2b91af">PdfReader</span>(content);
                <span style="color: blue">using </span>(<span style="color: #2b91af">MemoryStream </span>outputStream = <span style="color: blue">new </span><span style="color: #2b91af">MemoryStream</span>())
                <span style="color: blue">using </span>(<span style="color: #2b91af">PdfStamper </span>pdfStamper = <span style="color: blue">new </span><span style="color: #2b91af">PdfStamper</span>(pdfReader, outputStream))
                {
                    <span style="color: blue">for </span>(<span style="color: blue">int </span>pageIndex = 1; pageIndex &lt;= pdfReader.NumberOfPages; pageIndex++)
                    {
                        <span style="color: green">//Rectangle class in iText represent geometric representation... 
                        //in this case, rectangle object would contain page geometry
                        </span><span style="color: #2b91af">Rectangle </span>pageRectangle = pdfReader.GetPageSizeWithRotation(pageIndex);
                        <span style="color: green">//PdfContentByte object contains graphics and text content of page returned by PdfStamper
                        </span><span style="color: #2b91af">PdfContentByte </span>pdfData = pdfStamper.GetUnderContent(pageIndex);
                        <span style="color: green">//create font size for watermark
                        </span>pdfData.SetFontAndSize(<span style="color: #2b91af">BaseFont</span>.CreateFont(<span style="color: #2b91af">BaseFont</span>.HELVETICA_BOLD, <span style="color: #2b91af">BaseFont</span>.CP1252, <span style="color: #2b91af">BaseFont</span>.NOT_EMBEDDED), 8);
                        <span style="color: green">//create new graphics state and assign opacity
                        </span><span style="color: #2b91af">PdfGState </span>graphicsState = <span style="color: blue">new </span><span style="color: #2b91af">PdfGState</span>();
                        graphicsState.FillOpacity = 0.4F;
                        <span style="color: green">//set graphics state to PdfContentByte
                        </span>pdfData.SetGState(graphicsState);
                        <span style="color: green">//indicates start of writing of text
                        </span>pdfData.BeginText();
                        <span style="color: green">//show text as per position and rotation
                        </span>pdfData.ShowTextAligned(<span style="color: #2b91af">Element</span>.ALIGN_CENTER, watermark, pageRectangle.Width / 4, pageRectangle.Height / 44, 0);
                        <span style="color: green">//call endText to invalid font set
                        </span>pdfData.EndText();
                    }
                    pdfStamper.Close();
                    content = outputStream.ToArray();
                }
            }
            context.Response.ContentType = <span style="color: #a31515">&quot;application/pdf&quot;</span>;
            context.Response.BinaryWrite(content);
            context.Response.End();
        }

        <span style="color: blue">public bool </span>IsReusable
        {
            <span style="color: blue">get </span>{ <span style="color: blue">return false</span>; }
        }
    }
}</pre>

<p>&#160;</p>

<p>As you can see from the previous code listing, the bulk of the code involves the actual processing of the PDF file but the core SharePoint specific piece is in the beginning of the <font face="Courier New">ProcessRequest()</font> method where we use the <font face="Courier New">SPContext.Current.Web.GetFile()</font> method to retrieve the actual file requested and then, if we can get an actual <font face="Courier New">SPUser</font> object, we create a simple message that will be added to the bottom of the PDF. I’m not going to cover what’s happening with the iTextSharp objects as the point of this article is to demonstrate the pattern which can easily be applied to other file types and not how to use iTextSharp.</p>

<p>To deploy this class I created an empty SharePoint 2010 project using Visual Studio 2010 and added the file to the project. I then created a new Web Application scoped Feature which I use to add the appropriate <strong>web.config</strong> settings which will register the HTTP Handler. The following screenshot shows the final project structure:</p>

<p><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="SNAGHTML8af78243" border="0" alt="SNAGHTML8af78243" src="http://blog.aptillon.com/wp-content/uploads/2012/03/SNAGHTML8af78243.png" width="392" height="316" /></p>

<p>Note that I also added the <strong>iTextSharp.dll </strong>to the project and added it as an additional assembly to the package by double clicking the <strong>Package.package</strong> element and then, in the package designer, click <strong>Advanced</strong> to add additional assemblies:</p>

<p><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blog.aptillon.com/wp-content/uploads/2012/03/image.png" width="856" height="168" /></p>

<p>Before I show the code for the Web Application Feature I first want to show what settings I set for the Feature after adding it:</p>

<p><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blog.aptillon.com/wp-content/uploads/2012/03/image1.png" width="1086" height="609" /></p>

<p>When you add a new Feature to a project it’s going to name it <strong>Feature1</strong> and set the default scope to Web. The first thing I do is rename the Feature to something meaningful – in this case, because I know I’ll only have the one Feature I go ahead and name it the same as the project name: <strong>Aptillon.SharePoint.PDFWatermark</strong> (I always follow the same naming convention for my projects, which equate to WSP file names and Features: &lt;Company&gt;.SharePoint.&lt;Something Appropriate for the Contained Functionality&gt;). The next thing I do is change the <strong>Deployment Path</strong> property for the Feature so that it only uses the Feature name and does not prepend the project name; and finally I set the scope and title of the Feature. Now I’m ready to add my Feature activation event receiver.</p>

<p>The code that I want to include in the event receiver will handle the addition and removal of the web.config handler elements. I do this using the <font face="Courier New">SPWebConfigModification</font> class. Now there’s debate on whether this should be used or not; this is one of those classes where you might say (as my friend Spence Harbar puts it), “Just because you should use it doesn’t mean you can.” The simple explanation for this is that ideally you should be using this class to make web.config modifications but the reality is that this guy is fraught with issues and usually doesn’t work. That said, what I usually do is, where it makes sense, use this class to add and remove my entries but work under the premise that it will probably not work and plan on making these changes manually (or write a timer job which will do what this guy is attempting to do, but that’s out of scope of this article). So here’s the <font face="Courier New">FeatureActivated()</font> and <font face="Courier New">FeatureDeactivating()</font> methods that I use to add and remove the appropriate web.config entries which register the previously defined HTTP Handler:</p>

<pre style="border-bottom: black 1px solid; border-left: black 1px solid; width: 100%; height: 400px; overflow: auto; border-top: black 1px solid; border-right: black 1px solid" class="code"><span style="color: blue">public override void </span>FeatureActivated(<span style="color: #2b91af">SPFeatureReceiverProperties </span>properties)
{
    <span style="color: blue">string </span>asmDetails = <span style="color: blue">typeof</span>(<span style="color: #2b91af">PDFWatermarkHttpHandler</span>).AssemblyQualifiedName;

    <span style="color: #2b91af">SPWebApplication </span>webApp = properties.Feature.Parent <span style="color: blue">as </span><span style="color: #2b91af">SPWebApplication</span>;
    <span style="color: blue">if </span>(webApp == <span style="color: blue">null</span>) <span style="color: blue">return</span>;

    <span style="color: #2b91af">SPWebConfigModification </span>modification = <span style="color: blue">new </span><span style="color: #2b91af">SPWebConfigModification</span>(<span style="color: #a31515">&quot;add[@name=\&quot;PDFWatermark\&quot;]&quot;</span>, <span style="color: #a31515">&quot;configuration/system.webServer/handlers&quot;</span>);
    modification.Value = <span style="color: blue">string</span>.Format(<span style="color: #a31515">&quot;&lt;add name=\&quot;PDFWatermark\&quot; verb=\&quot;*\&quot; path=\&quot;*.pdf\&quot; type=\&quot;</span><span style="color: #3cb371">{0}</span><span style="color: #a31515">\&quot; preCondition=\&quot;integratedMode\&quot; /&gt;&quot;</span>, asmDetails);

    modification.Sequence = 1;
    modification.Owner = asmDetails;
    modification.Type = <span style="color: #2b91af">SPWebConfigModification</span>.<span style="color: #2b91af">SPWebConfigModificationType</span>.EnsureChildNode;
    webApp.WebConfigModifications.Add(modification);

    webApp.Update();
    webApp.WebService.ApplyWebConfigModifications();
}


<span style="color: blue">public override void </span>FeatureDeactivating(<span style="color: #2b91af">SPFeatureReceiverProperties </span>properties)
{
    <span style="color: blue">string </span>asmDetails = <span style="color: blue">typeof</span>(<span style="color: #2b91af">PDFWatermarkHttpHandler</span>).AssemblyQualifiedName;

    <span style="color: #2b91af">SPWebApplication </span>webApp = properties.Feature.Parent <span style="color: blue">as </span><span style="color: #2b91af">SPWebApplication</span>;
    <span style="color: blue">if </span>(webApp == <span style="color: blue">null</span>) <span style="color: blue">return</span>;

    <span style="color: #2b91af">List</span>&lt;<span style="color: #2b91af">SPWebConfigModification</span>&gt; configModsFound = <span style="color: blue">new </span><span style="color: #2b91af">List</span>&lt;<span style="color: #2b91af">SPWebConfigModification</span>&gt;();
    <span style="color: #2b91af">Collection</span>&lt;<span style="color: #2b91af">SPWebConfigModification</span>&gt; modsCollection = webApp.WebConfigModifications;
    <span style="color: blue">for </span>(<span style="color: blue">int </span>i = 0; i &lt; modsCollection.Count; i++)
    {
        <span style="color: blue">if </span>(modsCollection[i].Owner == asmDetails)
        {
            configModsFound.Add(modsCollection[i]);
        }
    }

    <span style="color: blue">if </span>(configModsFound.Count &gt; 0)
    {
        <span style="color: blue">foreach </span>(<span style="color: #2b91af">SPWebConfigModification </span>mod <span style="color: blue">in </span>configModsFound)
            modsCollection.Remove(mod);

        webApp.Update();
        webApp.WebService.ApplyWebConfigModifications();
    }
}</pre>

<p>&#160;</p>

<p>With all the code in place I can deploy to my Web Application and now any time a PDF is downloaded I’ll have a nice little message displayed on the bottom of each page. Again, the intent here is to show the simplicity of the pattern and approach – with a little imagination you can easily come up with lots of other uses for this (applying security or password protection to the PDF, adding an image watermark, removing pages based on registration status thus providing “sample” versions, prefilling form fields with user data, adding a version history page, etc.). And of course all this can also be applied to other file types such as the Office files or images (though image handling would take a little more logic to ignore images not coming from document libraries).</p>

<p style="padding-bottom: 20px; background-color: #500500; padding-left: 20px; padding-right: 20px; color: white; padding-top: 20px">View the original post on Gary’s personal blog for comments and all related downloads: <a title="Stamping PDF Files Downloaded from SharePoint 2010" href="http://blog.falchionconsulting.com/index.php/2012/03/stamping-pdf-files-downloaded-from-sharepoint-2010/">“Stamping” PDF Files Downloaded from SharePoint 2010</a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.aptillon.com/2012/03/11/stamping-pdf-files-downloaded-from-sharepoint-2010/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SharePoint Saturday Austin Session</title>
		<link>http://blog.aptillon.com/2012/01/22/sharepoint-saturday-austin-session/</link>
		<comments>http://blog.aptillon.com/2012/01/22/sharepoint-saturday-austin-session/#comments</comments>
		<pubDate>Sun, 22 Jan 2012 15:26:24 +0000</pubDate>
		<dc:creator>Matthew McDermott</dc:creator>
				<category><![CDATA[Matthew McDermott]]></category>
		<category><![CDATA[Search]]></category>
		<category><![CDATA[SharePoint 2010]]></category>
		<category><![CDATA[Speaking Engagements]]></category>

		<guid isPermaLink="false">http://blog.aptillon.com/2012/01/22/sharepoint-saturday-austin-session/</guid>
		<description><![CDATA[SharePoint Saturday Austin was terrific! I am grateful for all the speakers that traveled to Austin as well as the attendees (some from as far away as Nebraska!) that came and made it a wonderful collaborative and educational day. We could not have done it without the sponsors and volunteers. All in all an amazing [...]]]></description>
			<content:encoded><![CDATA[<p>SharePoint Saturday Austin was terrific! I am grateful for all the speakers that traveled to Austin as well as the attendees (some from as far away as Nebraska!) that came and made it a wonderful collaborative and educational day. We could not have done it without the sponsors and volunteers. All in all an amazing show for our first attempt!</p>  <h2>SharePoint 2010 No Code Search Center Customization</h2>  <p>My session was fun, I love it when the audience gets involved and really thinks about what I am presenting. Here is a link to my deck and the links from the last slide.</p>  <p><a href="http://www.ableblue.com/blog/media/SharePoint_2010_No_Code_Search_Center_Customization.pptx" target="_blank">SharePoint 2010 No Code Search Center Customization</a></p>  <ul>   <li>Basic Search Center Editing </li>    <li><a href="http://bit.ly/pCHMaW">http://bit.ly/pCHMaW</a> </li>    <li>XML Test Results Page </li>    <li><a href="http://bit.ly/pyIb0X">http://bit.ly/pyIb0X</a> </li>    <li>iFilter Shop iFilterView.exe </li>    <li><a href="http://ifiltershop.com/downloads/IFilterView.zip">http://ifiltershop.com/downloads/IFilterView.zip</a> </li> </ul>]]></content:encoded>
			<wfw:commentRss>http://blog.aptillon.com/2012/01/22/sharepoint-saturday-austin-session/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Updating SharePoint 2010 User Information</title>
		<link>http://blog.aptillon.com/2011/12/22/updating-sharepoint-2010-user-information/</link>
		<comments>http://blog.aptillon.com/2011/12/22/updating-sharepoint-2010-user-information/#comments</comments>
		<pubDate>Thu, 22 Dec 2011 21:58:46 +0000</pubDate>
		<dc:creator>Gary Lapointe</dc:creator>
				<category><![CDATA[Gary Lapointe]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Set-SPUser]]></category>
		<category><![CDATA[SharePoint 2010]]></category>
		<category><![CDATA[SPUser]]></category>
		<category><![CDATA[User Information List]]></category>

		<guid isPermaLink="false">http://blog.aptillon.com/2011/12/22/updating-sharepoint-2010-user-information/</guid>
		<description><![CDATA[One of my clients recently had an issue where a particularly high profile user (CEO) had their title spelled incorrectly in Active Directory; unfortunately the error wasn’t noticed right away and now, despite changing the information in Active Directory, SharePoint was still showing the wrong title in the People Picker when granting the user rights [...]]]></description>
			<content:encoded><![CDATA[<p>One of my clients recently had an issue where a particularly high profile user (CEO) had their title spelled incorrectly in Active Directory; unfortunately the error wasn’t noticed right away and now, despite changing the information in Active Directory, SharePoint was still showing the wrong title in the People Picker when granting the user rights to a Site Collection. Fortunately I had a partial PowerShell script to fix the issue and just needed to only slightly modify it – you can see the original script on pages 299 and 300 of <a href="http://www.amazon.com/dp/0470939206?tag=shareautom-20&amp;camp=213381&amp;creative=390973&amp;linkCode=as4&amp;creativeASIN=0470939206&amp;adid=0N73WQ7X6VCZB5V4H95A&amp;&amp;ref-refURL=http%3A%2F%2Fblog.falchionconsulting.com%2F" target="_blank">my book</a>. So before I show the modified script it’s first important to understand the problem and why I needed to use a script and why what I had in the book is somewhat incomplete.</p>  <p>Whenever you grant a user rights to a Site Collection or when that user creates/updates/deletes any item within a Site Collection, an entry for the user will be added to a hidden user information list, if not already there. This “User Information List” is located at <em>http://&lt;SiteCollectionUrl&gt;/_catalogs/users/detail.aspx:</em></p>  <p><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="SNAGHTMLa064e71" border="0" alt="SNAGHTMLa064e71" src="http://blog.aptillon.com/wp-content/uploads/2011/12/SNAGHTMLa064e71.png" width="784" height="391" /></p>  <p>By looking at this list you can see that several key pieces of information are stored here – unfortunately, when you change this information in Active Directory the information stored here is not updated (even after running a full or incremental import via UPS). To complicate matters there is no way to edit the information via the browser, thus the need for a PowerShell script. If you click the user’s name you’ll see the additional properties, including an “Edit Item” option, however, the edit dialog is simply a read-only display of the username, helpful right?:</p>  <p><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="SNAGHTMLa089b49" border="0" alt="SNAGHTMLa089b49" src="http://blog.aptillon.com/wp-content/uploads/2011/12/SNAGHTMLa089b49.png" width="800" height="317" /></p>  <p>So let’s first consider the scenario that my book addresses and assume that a user had had their name and/or email address changed. To accommodate this scenario we simply use the <a href="http://technet.microsoft.com/en-us/library/ff607827.aspx" target="_blank"><font face="Courier New">Set-SPUser</font></a> cmdlet along with the <font face="Courier New">-SyncFromAD</font> parameter. The following script is taken directly from my book and simply iterates through all Site Collections and calls the <font face="Courier New">Set-SPUser</font> cmdlet for the provided user:</p>  <pre><span style="color: #0000ff">function</span><span style="color: #000000"> </span><span style="color: #5f9ea0">Sync-SPUser</span><span style="color: #000000">([</span><span style="color: #008080">string</span><span style="color: #000000">]</span><span style="color: #800080">$userName</span><span style="color: #000000">) {
  </span><span style="color: #5f9ea0; font-weight: bold">Get-SPSite</span><span style="color: #000000"> </span><span style="font-style: italic; color: #5f9ea0">-Limit</span><span style="color: #000000"> </span><span style="color: #800000">All</span><span style="color: #000000"> | </span><span style="color: #5f9ea0; font-weight: bold">foreach</span><span style="color: #000000"> {
    </span><span style="color: #800080">$web</span><span style="color: #000000"> </span><span style="color: #ff0000">=</span><span style="color: #000000"> </span><span style="color: #800080">$_</span><span style="color: #000000">.RootWeb
    </span><span style="color: #0000ff">if</span><span style="color: #000000"> (</span><span style="color: #800080">$_</span><span style="color: #000000">.WebApplication.UseClaimsAuthentication) {
      </span><span style="color: #800080">$claim</span><span style="color: #000000"> </span><span style="color: #ff0000">=</span><span style="color: #000000"> </span><span style="color: #5f9ea0; font-weight: bold">New-SPClaimsPrincipal</span><span style="color: #000000"> </span><span style="color: #800080">$userName</span><span style="color: #000000"> </span><span style="font-style: italic; color: #5f9ea0">-IdentityType</span><span style="color: #000000"> </span><span style="color: #800000">WindowsSamAccountName</span><span style="color: #000000">
      </span><span style="color: #800080">$user</span><span style="color: #000000"> </span><span style="color: #ff0000">=</span><span style="color: #000000"> </span><span style="color: #800080">$web</span><span style="color: #000000"> | </span><span style="color: #5f9ea0; font-weight: bold">Get-SPUser</span><span style="color: #000000"> </span><span style="font-style: italic; color: #5f9ea0">-Identity</span><span style="color: #000000"> </span><span style="color: #800080">$claim</span><span style="color: #000000"> </span><span style="font-style: italic; color: #5f9ea0">-ErrorAction</span><span style="color: #000000"> </span><span style="color: #800000">SilentlyContinue</span><span style="color: #000000">
    } </span><span style="color: #0000ff">else</span><span style="color: #000000"> {
      </span><span style="color: #800080">$user</span><span style="color: #000000"> </span><span style="color: #ff0000">=</span><span style="color: #000000"> </span><span style="color: #800080">$web</span><span style="color: #000000"> | </span><span style="color: #5f9ea0; font-weight: bold">Get-SPUser</span><span style="color: #000000"> </span><span style="font-style: italic; color: #5f9ea0">-Identity</span><span style="color: #000000"> </span><span style="color: #800080">$userName</span><span style="color: #000000"> </span><span style="font-style: italic; color: #5f9ea0">-ErrorAction</span><span style="color: #000000"> </span><span style="color: #800000">SilentlyContinue</span><span style="color: #000000">
    }
    </span><span style="color: #0000ff">if</span><span style="color: #000000"> (</span><span style="color: #800080">$user</span><span style="color: #000000"> </span><span style="color: #ff0000">-ne</span><span style="color: #000000"> </span><span style="color: #800080">$null</span><span style="color: #000000">) {
      </span><span style="color: #800080">$web</span><span style="color: #000000"> | </span><span style="color: #5f9ea0; font-weight: bold">Set-SPUser</span><span style="color: #000000"> </span><span style="font-style: italic; color: #5f9ea0">-Identity</span><span style="color: #000000"> </span><span style="color: #800080">$user</span><span style="color: #000000"> </span><span style="font-style: italic; color: #5f9ea0">-SyncFromAD</span><span style="color: #000000">
    }
    </span><span style="color: #800080">$web</span><span style="color: #000000">.Dispose()
    </span><span style="color: #800080">$_</span><span style="color: #000000">.Dispose()
  }
}</span></pre>

<p>&#160;</p>

<p>Before I make any changes to demonstrate this script and the modifications we’ll make to it, let’s first see how my user is currently set in the Site Collection:</p>

<p><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blog.aptillon.com/wp-content/uploads/2011/12/image.png" width="789" height="662" /></p>

<p>And as shown in the People Picker:</p>

<p><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="SNAGHTMLa14e91b" border="0" alt="SNAGHTMLa14e91b" src="http://blog.aptillon.com/wp-content/uploads/2011/12/SNAGHTMLa14e91b.png" width="799" height="250" /></p>

<p>Note the “Name”/”Display Name”, “Work e-mail”/”E-Mail”, and “Title” fields.</p>

<p>Now I’ll change these values in Active Directory (make the “p” in my last name capitalized, change the title, and set the email) and then run the script (I saved the script as Sync-SPUser.ps1):</p>

<p><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="SNAGHTMLa17239b" border="0" alt="SNAGHTMLa17239b" src="http://blog.aptillon.com/wp-content/uploads/2011/12/SNAGHTMLa17239b.png" width="586" height="186" /></p>

<p>(Note that lowercase “p” is the correct spelling for my name, just in case you were wondering <img style="border-bottom-style: none; border-left-style: none; width: 10px; border-top-style: none; height: 10px; border-right-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://blog.aptillon.com/wp-content/uploads/2011/12/wlEmoticon-smile1.png" />). Now if we look at the user details in the Site Collection and the People Picker we should see the following:</p>

<p><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blog.aptillon.com/wp-content/uploads/2011/12/image1.png" width="789" height="662" /></p>

<p><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="SNAGHTMLa1a344d" border="0" alt="SNAGHTMLa1a344d" src="http://blog.aptillon.com/wp-content/uploads/2011/12/SNAGHTMLa1a344d.png" width="800" height="266" /></p>

<p>Notice that the the “Name” / “Display Name” and “Work e-mail” / “E-Mail” fields were updated but not the “Title” field. This is because the <font face="Courier New">Set-SPUser</font> cmdlet and <font face="Courier New">-SyncFromAD</font> parameter only updates these two fields. So how do you update the remaining fields? We simply need to add some code to our function which will grab the <font face="Courier New">SPListItem</font> corresponding to the user from the hidden “User Information List” and then update the corresponding fields manually. The following modified script does this for the “Title” field (note that I’ve changed the function signature to take the title in as a parameter):</p>

<pre><span style="color: #0000ff">function</span><span style="color: #000000"> </span><span style="color: #5f9ea0">Sync-SPUser</span><span style="color: #000000">([</span><span style="color: #008080">string</span><span style="color: #000000">]</span><span style="color: #800080">$userName</span><font style="background-color: #ffff00"><span style="color: #000000">, [</span><span style="color: #008080">string</span><span style="color: #000000">]</span><span style="color: #800080">$title</span></font><span style="color: #000000">) {
  </span><span style="color: #5f9ea0; font-weight: bold">Get-SPSite</span><span style="color: #000000"> </span><span style="font-style: italic; color: #5f9ea0">-Limit</span><span style="color: #000000"> </span><span style="color: #800000">All</span><span style="color: #000000"> | </span><span style="color: #5f9ea0; font-weight: bold">foreach</span><span style="color: #000000"> {
    </span><span style="color: #800080">$web</span><span style="color: #000000"> </span><span style="color: #ff0000">=</span><span style="color: #000000"> </span><span style="color: #800080">$_</span><span style="color: #000000">.RootWeb
    </span><span style="color: #0000ff">if</span><span style="color: #000000"> (</span><span style="color: #800080">$_</span><span style="color: #000000">.WebApplication.UseClaimsAuthentication) {
      </span><span style="color: #800080">$claim</span><span style="color: #000000"> </span><span style="color: #ff0000">=</span><span style="color: #000000"> </span><span style="color: #5f9ea0; font-weight: bold">New-SPClaimsPrincipal</span><span style="color: #000000"> </span><span style="color: #800080">$userName</span><span style="color: #000000"> </span><span style="font-style: italic; color: #5f9ea0">-IdentityType</span><span style="color: #000000"> </span><span style="color: #800000">WindowsSamAccountName</span><span style="color: #000000">
      </span><span style="color: #800080">$user</span><span style="color: #000000"> </span><span style="color: #ff0000">=</span><span style="color: #000000"> </span><span style="color: #800080">$web</span><span style="color: #000000"> | </span><span style="color: #5f9ea0; font-weight: bold">Get-SPUser</span><span style="color: #000000"> </span><span style="font-style: italic; color: #5f9ea0">-Identity</span><span style="color: #000000"> </span><span style="color: #800080">$claim</span><span style="color: #000000"> </span><span style="font-style: italic; color: #5f9ea0">-ErrorAction</span><span style="color: #000000"> </span><span style="color: #800000">SilentlyContinue</span><span style="color: #000000">
    } </span><span style="color: #0000ff">else</span><span style="color: #000000"> {
      </span><span style="color: #800080">$user</span><span style="color: #000000"> </span><span style="color: #ff0000">=</span><span style="color: #000000"> </span><span style="color: #800080">$web</span><span style="color: #000000"> | </span><span style="color: #5f9ea0; font-weight: bold">Get-SPUser</span><span style="color: #000000"> </span><span style="font-style: italic; color: #5f9ea0">-Identity</span><span style="color: #000000"> </span><span style="color: #800080">$userName</span><span style="color: #000000"> </span><span style="font-style: italic; color: #5f9ea0">-ErrorAction</span><span style="color: #000000"> </span><span style="color: #800000">SilentlyContinue</span><span style="color: #000000">
    }
    </span><span style="color: #0000ff">if</span><span style="color: #000000"> (</span><span style="color: #800080">$user</span><span style="color: #000000"> </span><span style="color: #ff0000">-ne</span><span style="color: #000000"> </span><span style="color: #800080">$null</span><span style="color: #000000">) {
      </span><span style="color: #800080">$web</span><span style="color: #000000"> | </span><span style="color: #5f9ea0; font-weight: bold">Set-SPUser</span><span style="color: #000000"> </span><span style="font-style: italic; color: #5f9ea0">-Identity</span><span style="color: #000000"> </span><span style="color: #800080">$user</span><span style="color: #000000"> </span><span style="font-style: italic; color: #5f9ea0">-SyncFromAD</span><span style="color: #000000">
      
<font style="background-color: #ffff00">      </font></span><font style="background-color: #ffff00"><span style="color: #800080">$list</span><span style="color: #000000"> </span><span style="color: #ff0000">=</span><span style="color: #000000"> </span><span style="color: #800080">$web</span><span style="color: #000000">.Lists[</span><span style="color: #800000">&quot;</span><span style="color: #800000">User Information List</span><span style="color: #800000">&quot;</span></font><font style="background-color: #ffff00"><span style="color: #000000">]
      </span><span style="color: #800080">$query</span><span style="color: #000000"> </span><span style="color: #ff0000">=</span><span style="color: #000000"> </span><span style="color: #5f9ea0; font-weight: bold">New-Object</span><span style="color: #000000"> </span><span style="color: #800000">Microsoft.SharePoint.SPQuery</span></font><span style="color: #000000">
<font style="background-color: #ffff00">      </font></span><font style="background-color: #ffff00"><span style="color: #800080">$query</span><span style="color: #000000">.Query </span><span style="color: #ff0000">=</span><span style="color: #000000"> </span><span style="color: #800000">&quot;</span><span style="color: #800000">&lt;Where&gt;&lt;Eq&gt;&lt;FieldRef Name='Name' /&gt;&lt;Value Type='Text'&gt;$userName&lt;/Value&gt;&lt;/Eq&gt;&lt;/Where&gt;</span><span style="color: #800000">&quot;</span></font><span style="color: #000000">
<font style="background-color: #ffff00">      </font></span><font style="background-color: #ffff00"><span style="color: #0000ff">foreach</span><span style="color: #000000"> (</span><span style="color: #800080">$item</span><span style="color: #000000"> </span><span style="color: #0000ff">in</span><span style="color: #000000"> </span><span style="color: #800080">$list</span><span style="color: #000000">.GetItems(</span><span style="color: #800080">$query</span></font><font style="background-color: #ffff00"><span style="color: #000000">)) {
        </span><span style="color: #800080">$item</span><span style="color: #000000">[</span><span style="color: #800000">&quot;</span><span style="color: #800000">JobTitle</span><span style="color: #800000">&quot;</span><span style="color: #000000">] </span><span style="color: #ff0000">=</span><span style="color: #000000"> </span><span style="color: #800080">$title</span></font><span style="color: #000000">
<font style="background-color: #ffff00">        </font></span><span style="color: #800080"><font style="background-color: #ffff00">$item</font></span><span style="color: #000000"><font style="background-color: #ffff00">.SystemUpdate()
      }
</font>    }
    </span><span style="color: #800080">$web</span><span style="color: #000000">.Dispose()
    </span><span style="color: #800080">$_</span><span style="color: #000000">.Dispose()
  }
}
</span></pre>

<p>The changes to the original function have been highlighted. Note that the internal field name for the “Title” field is “JobTitle” and that is what we are using to set the Title. Now if we run this modified script we should see the Title field updated:</p>

<p><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="SNAGHTMLa21bc70" border="0" alt="SNAGHTMLa21bc70" src="http://blog.aptillon.com/wp-content/uploads/2011/12/SNAGHTMLa21bc70.png" width="608" height="207" /></p>

<p><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="SNAGHTMLa236af7" border="0" alt="SNAGHTMLa236af7" src="http://blog.aptillon.com/wp-content/uploads/2011/12/SNAGHTMLa236af7.png" width="800" height="239" /></p>

<p>Okay, so what about the other fields (Department, Mobile Number, etc.)? You can see what fields are available to edit by running the following:</p>

<p><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="SNAGHTMLa265249" border="0" alt="SNAGHTMLa265249" src="http://blog.aptillon.com/wp-content/uploads/2011/12/SNAGHTMLa265249.png" width="899" height="286" /></p>

<p>In the preceding example I’m grabbing a specific item (in this case the item corresponding to my user) so that I can see the internal field names in context with the data stored by the field – this helps to make sure that I grab the correct field name (i.e., “JobTitle” vs. “Title”). Now you can just add additional fields to update right before the call to SystemUpdate() – simply follow the pattern established for the title field.</p>

<p>So, add this guy to your script library and you’ll be good to go next time someone changes their name, email, or job title.</p>

<p>-Gary</p>

<p style="padding-bottom: 20px; background-color: #500500; padding-left: 20px; padding-right: 20px; color: white; padding-top: 20px">View the original post on Gary’s personal blog for comments and all related downloads: <a title="Updating SharePoint 2010 User Information" href="http://blog.falchionconsulting.com/index.php/2011/12/updating-sharepoint-2010-user-information/">Updating SharePoint 2010 User Information</a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.aptillon.com/2011/12/22/updating-sharepoint-2010-user-information/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>SPListItem != SPListItem?</title>
		<link>http://blog.aptillon.com/2011/12/15/splistitem-splistitem/</link>
		<comments>http://blog.aptillon.com/2011/12/15/splistitem-splistitem/#comments</comments>
		<pubDate>Thu, 15 Dec 2011 15:38:41 +0000</pubDate>
		<dc:creator>David Mann</dc:creator>
				<category><![CDATA[David Mann]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[SharePoint]]></category>

		<guid isPermaLink="false">http://blog.aptillon.com/2011/12/15/splistitem-splistitem/</guid>
		<description><![CDATA[I’m not entirely sure what this means, but I found it curious… I had a big block of unoptimized code in a project I’m working on and so I lost track of what variables I had and where they had come from.&#160; At one point, I created an SPListItem by retrieving it from an SPListItemCollection.&#160; [...]]]></description>
			<content:encoded><![CDATA[<p>I’m not entirely sure what this means, but I found it curious…</p>  <p>I had a big block of unoptimized code in a project I’m working on and so I lost track of what variables I had and where they had come from.&#160; At one point, I created an SPListItem by retrieving it from an SPListItemCollection.&#160; So&#160; far, so good.&#160; Nothing unusual:</p>  <p><font face="Consolas">SPListItem itm = lic[0];</font></p>  <p>Later on, after checking that this item represented an SPFolder, I grabbed it’s corresponding folder object:</p>  <p><font face="Consolas">SPFolder myFolder = itm.Folder;</font></p>  <p>Later still, I had to grab a column value.&#160; Forgetting that I had the SPListItem directly, I went this route:</p>  <p><font face="Consolas">string myValue = (string)myFolder.Item[“myField”];</font></p>  <p>In stepping through my code, I found that myValue was null, when I knew that it did, in fact, have a value.&#160; Looking at my code to figure out what I could have f-ed up, I saw the itm variable again.&#160; I didn’t expect it would fix my problem, but it would be cleaner to work directly with it instead of going through the folder object, so I changed my code to:</p>  <p><font face="Consolas">string myValue = (string)itm[“myField”];</font></p>  <p>Now when stepping through my code, myValue wasn’t null, it threw an ArgumentException error.&#160; WTF?</p>  <p>So, in other words:</p>  <p><font face="Consolas">SPListItem != SPListItem.Folder.Item</font></p>  <p>even though both are SPListItems, and I would have assumed the same SPListItem (which they really are because both have the same ID, there’s just something screwy going on with the available fields).</p>  <p>This is mostly a note to myself to fire up Reflector and see what is going on when I have more time.&#160; I’ll try to remember to update this post if I can figure it out.</p>  <p>Imagine that…another head-scratcher from the SharePoint object model…</p>  <p><img style="border-bottom-style: none;border-left-style: none;border-top-style: none;border-right-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://blog.aptillon.com/wp-content/uploads/2011/12/wlEmoticon-smile.png" /></p>]]></content:encoded>
			<wfw:commentRss>http://blog.aptillon.com/2011/12/15/splistitem-splistitem/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SharePoint Tips</title>
		<link>http://blog.aptillon.com/2011/12/14/sharepoint-tips/</link>
		<comments>http://blog.aptillon.com/2011/12/14/sharepoint-tips/#comments</comments>
		<pubDate>Wed, 14 Dec 2011 16:10:46 +0000</pubDate>
		<dc:creator>David Mann</dc:creator>
				<category><![CDATA[David Mann]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[User Group]]></category>

		<guid isPermaLink="false">http://blog.aptillon.com/2011/12/14/sharepoint-tips/</guid>
		<description><![CDATA[Last night at the final @TSSSPUG meeting of 2011, Michael Mukalian and I presented an informal couple of sessions covering various tips that we’ve learned over the years of beating our heads against the SharePoint wall.&#160; Here’s a quick review of what I covered… &#160; JavaScript &#38; JQuery Intellisense Add the following lines to the [...]]]></description>
			<content:encoded><![CDATA[<p>Last night at the final <a href="http://www.tristatesharepoint.org/SitePages/Home.aspx" target="_blank">@TSSSPUG</a> meeting of 2011, <a href="http://www.mukalian.com/blog/" target="_blank">Michael Mukalian</a> and I presented an informal couple of sessions covering various tips that we’ve learned over the years of beating our heads against the SharePoint wall.&#160; Here’s a quick review of what I covered…</p>  <p>&#160;</p>  <p><strong><u><font color="#000000">JavaScript &amp; JQuery Intellisense</font></u></strong></p>  <p>Add the following lines to the top of your .js files to get intellisense for JQuery and the Client OM:</p>  <p>/// &lt;reference path=&quot;C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\MicrosoftAjax.js&quot; /&gt;    <br />/// &lt;reference path=&quot;c:\IntellisenseFiles\jQuery-1.7-vsdoc.js&quot; /&gt;     <br />/// &lt;reference path=&quot;C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\SP.core.debug.js&quot; /&gt;     <br />/// &lt;reference path=&quot;C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\SP.debug.js&quot; /&gt;</p>  <p>Note that the path in the second entry is to a folder on my dev machine where I put the –vsdoc files downloaded from the JQuery website.&#160; Adjust your path as appropriate.</p>  <p><strong><u><font color="#000000">Developer Dashboard</font></u></strong></p>  <p>I did a quick overview of the DevDash and why it is useful.</p>  <p><strong><u><font color="#000000">CKS:Dev</font></u></strong></p>  <p>There’s NO REASON not to use this tool.&#160; Just Do It.&#160; <a href="http://www.cksdev.com">www.cksdev.com</a></p>  <p><strong><u><font color="#000000">O365 FxCop Rules</font></u></strong></p>  <p>If you’re doing Office 365 development, this is another must-have tool: <a title="http://o365fxcoprules.codeplex.com/" href="http://o365fxcoprules.codeplex.com/">http://o365fxcoprules.codeplex.com/</a></p>  <p><strong><u><font color="#000000">Resolving Sandbox timeout errors</font></u></strong></p>  <p><u>On a development box only</u>, add the following entry to your HOSTS file to improve the responsiveness of your sandbox process when it is starting up: 127.0.0.1&#160;&#160;&#160;&#160; crl.microsoft.com</p>  <p><strong><u><font color="#000000">Adding a &quot;close&quot; link to the Status Bar with your status messages</font></u></strong></p>  <p>var statusId=SP.UI.Status.addStatus(&quot;Title&quot;, &quot;Hello World Status Message &lt;a href='javascript:SP.UI.Status.removeStatus(statusId)'&gt;[Close]&lt;/a&gt;&quot;);</p>  <p><strong><u><font color="#000000">Using PowerShell in the VS Pre/Post Deployment steps</font></u></strong></p>  <p>%windir%\sysnative\windowspowershell\v1.0\powershell -file &quot;$(ProjectDir)MyPSScriptFile.ps1&quot; where <strong>MyPSScriptFIle.ps1</strong> contains your PoSh commands to be run</p>  <p>(source: <a href="http://www.thesharepointbaker.co.uk/2011/12/post-deployment-powershell-sharepoint-visual-studio/">http://www.thesharepointbaker.co.uk/2011/12/post-deployment-powershell-sharepoint-visual-studio/</a>)</p>  <p><font color="#000000">Using LinqPad as a snippet compiler/tester</font></p>  <p>LinqPad: (free) <a title="http://www.linqpad.net/" href="http://www.linqpad.net/">http://www.linqpad.net/</a></p>  <p>&#160;</p>  <p>Hopefully folks got some value out of the session.</p>  <p>&#160;</p>  <p>Dave</p>]]></content:encoded>
			<wfw:commentRss>http://blog.aptillon.com/2011/12/14/sharepoint-tips/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fix &#8211; WP7 AdControl Disappears after Upgrade to 7.1</title>
		<link>http://blog.aptillon.com/2011/12/01/fix-wp7-adcontrol-disappears-after-upgrade-to-7-1/</link>
		<comments>http://blog.aptillon.com/2011/12/01/fix-wp7-adcontrol-disappears-after-upgrade-to-7-1/#comments</comments>
		<pubDate>Thu, 01 Dec 2011 13:39:30 +0000</pubDate>
		<dc:creator>Darrin Bishop</dc:creator>
				<category><![CDATA[Darrin Bishop]]></category>
		<category><![CDATA[Fix]]></category>
		<category><![CDATA[Windows Phone 7]]></category>
		<category><![CDATA[WP7]]></category>

		<guid isPermaLink="false">http://blog.aptillon.com/?p=391</guid>
		<description><![CDATA[Last night I cut over a few WP7 7.0 applications using the AdControl to 7.1 (Mango). In the process I lost the AdControl on all the application pages. No error, not complaint just an empty place where the AdControl should have been.  If I was paying close attention I could see a brief flicker of [...]]]></description>
			<content:encoded><![CDATA[<p>Last night I cut over a few WP7 7.0 applications using the AdControl to 7.1 (Mango). In the process I lost the AdControl on all the application pages. No error, not complaint just an empty place where the AdControl should have been.  If I was paying close attention I could see a brief flicker of the outline of the AdControl as though it was loading.</p>

<p>If you search the Internet you will find a few posts, most attempts to resolve this issue by explicitly setting the Test flag to false but in my case this was not the solution.  The solution was clear to me once I realized the AdControl has an ErrorOccurred event. Binding an event handler to this event made the debug very easy.</p>

<p>In all of my upgrade instances the applications required additional device Capability elements added to the WMAppManifest.xml file.  In all of the applications I converted from 7.0 to 7.1 the defined Capabilities  were :
<ul>
	<li>ID_CAP_NETWORKING</li>
	<li>ID_CAP_WEBBROWSERCOMPONENT</li>
</ul>
Note: This is not the default list of capabilities for the 7.0 projects but we remove those that are not needed before we deploy to the Marketplace</p>
<p>
The 7.1 version of the Ad control also required the following device capabilities to be included in the WMAppManifest.xml file:
<ul>
	<li>ID_CAP_PHONEDIALER</li>
	<li>ID_CAP_IDENTITY_USER</li>
	<li>ID_CAP_MEDIALIB</li>
</ul>
Adding these three capabilities to the WMAppManifest.xml file fixed the AdControl issue.</p>

<p>The key take away from this issue is to know there is an ErrorOccurred event on the AdControl and that you should define an event handler to this event whenever you have an issue with the control. You will save yourself some dev cycles.</p>]]></content:encoded>
			<wfw:commentRss>http://blog.aptillon.com/2011/12/01/fix-wp7-adcontrol-disappears-after-upgrade-to-7-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

