<?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>Glyn Clough&#039;s Blog - All about Microsoft SharePoint</title>
	<atom:link href="http://www.glynblogs.com/feed" rel="self" type="application/rss+xml" />
	<link>http://www.glynblogs.com</link>
	<description>Sharing my thoughts and experiences in the SharePoint world</description>
	<lastBuildDate>Tue, 31 Jan 2012 22:17:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Syntax for SharePoint 2010 Enterprise Search Queries</title>
		<link>http://www.glynblogs.com/2012/01/syntax-for-sharepoint-2010-enterprise-search-queries.html</link>
		<comments>http://www.glynblogs.com/2012/01/syntax-for-sharepoint-2010-enterprise-search-queries.html#comments</comments>
		<pubDate>Tue, 31 Jan 2012 22:17:02 +0000</pubDate>
		<dc:creator>Glyn Clough</dc:creator>
				<category><![CDATA[SharePoint 2010]]></category>
		<category><![CDATA[Knowledge Resource]]></category>
		<category><![CDATA[Search]]></category>

		<guid isPermaLink="false">http://www.glynblogs.com/?p=719</guid>
		<description><![CDATA[<p>Recently I was asked if I knew how to create a search that returned results for items created in the last 7 days. I knew I could do this but couldn&#8217;t remember exactly the right syntax for the query I was trying to create. So I pinged off a couple of search terms and quickly <span style="color:#777"> . . . &#8594; Read More: <a href="http://www.glynblogs.com/2012/01/syntax-for-sharepoint-2010-enterprise-search-queries.html">Syntax for SharePoint 2010 Enterprise Search Queries</a></span>]]></description>
			<content:encoded><![CDATA[<p>Recently I was asked if I knew how to create a search that returned results for items created in the last 7 days. I knew I could do this but couldn&#8217;t remember exactly the right syntax for the query I was trying to create. So I pinged off a couple of search terms and quickly found some examples of what I was looking for.</p>
<p>Whilst doing so though I happened to come across a really <a href="http://msdn.microsoft.com/en-us/library/ee558911.aspx" target="_blank">great resource on MSDN for SharePoint Enterprise Search queries</a> &#8211; showing what is possible and the various ways of doing so. Did you know for example that you can define <strong>synonyms</strong> in your query, e.g.:</p>
<blockquote><p>WORDS(TV, Television)</p></blockquote>
<p>Or that you <strong>can&#8217;t include any white space</strong> between the property name, property operator and property value when restricting by specific property, e.g. this will <strong>not</strong> restrict to results authored by me:</p>
<blockquote><p>author: &#8220;Glyn Clough&#8221;<em> &#8211; note there&#8217;s a space after the colon!</em></p></blockquote>
<p>So mostly for myself, but also in case this is valuable to you &#8211; here are the relevant links:</p>
<ul>
<li><a href="http://msdn.microsoft.com/en-us/library/ff394619.aspx" target="_blank">Free-Text Keyword Queries</a></li>
<li><a href="http://msdn.microsoft.com/en-us/library/ff394509.aspx" target="_blank">Property Restriction Keyword Queries</a></li>
<li><a href="http://msdn.microsoft.com/en-us/library/ee872310.aspx" target="_blank">Using Operators in Keyword Queries</a></li>
</ul>
<p>I definitely recommend giving these a skim to refresh your memory on just how powerful SharePoint Search is!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.glynblogs.com/2012/01/syntax-for-sharepoint-2010-enterprise-search-queries.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Viewing Timer Job History for a Specific Date and Time Period</title>
		<link>http://www.glynblogs.com/2011/12/viewing-timer-job-history-for-a-specific-date-and-time-period.html</link>
		<comments>http://www.glynblogs.com/2011/12/viewing-timer-job-history-for-a-specific-date-and-time-period.html#comments</comments>
		<pubDate>Thu, 15 Dec 2011 17:47:44 +0000</pubDate>
		<dc:creator>Glyn Clough</dc:creator>
				<category><![CDATA[SharePoint 2010]]></category>
		<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://www.glynblogs.com/?p=707</guid>
		<description><![CDATA[<p>Central Administration provides several ways to view timer job history for a SharePoint farm. From the Job History page, you can view by Service, Web Application, Server, Job Definition or Failed Jobs. This is a really useful resource when you’re analysing issues with a specific job or service. However, if you want to investigate by <span style="color:#777"> . . . &#8594; Read More: <a href="http://www.glynblogs.com/2011/12/viewing-timer-job-history-for-a-specific-date-and-time-period.html">Viewing Timer Job History for a Specific Date and Time Period</a></span>]]></description>
			<content:encoded><![CDATA[<p>Central Administration provides several ways to view timer job history for a SharePoint farm. From the <strong>Job History</strong> page, you can view by Service, Web Application, Server, Job Definition or Failed Jobs. This is a really useful resource when you’re analysing issues with a specific job or service. However, if you want to investigate by a particular time period then you don’t really have any options other than to click through page after page after page…</p>
<p><a href="http://www.glynblogs.com/wp-content/uploads/2011/12/Timer-Job-History-Options.png" rel="lightbox[707]"><img src="http://www.glynblogs.com/wp-content/uploads/2011/12/Timer-Job-History-Options.png" alt="Timer Job History Options" title="Timer Job History Options" width="164" height="156" class="alignnone size-full wp-image-708" /></a></p>
<p>Fortunately the job history is available to access through PowerShell. I found this <a href="http://social.technet.microsoft.com/Forums/en-US/sharepoint2010setup/thread/bdc98d84-d06a-4f5a-ab89-ff621e33b167/">TechNet forum post</a> which pointed me in the right direction, and also a useful <a href="http://www.hancockcomputertech.com/blog/2011/10/02/sharepoint-2010-powershell-list-all-timer-job-history-a-certain-time-range-to-csv-file/">blog post and script</a> by Dave Hancock. (Dave’s script looks like it does exactly what I needed but unfortunately I had issues getting it to run).</p>
<p>So, below is a script I’ve put together which I run in the Windows Integrated Scripting Environment to output a grid view of all timer jobs between two dates and times, for all web applications in the farm:</p>
<p><strong>Update 19/12/2011:</strong> I&#8217;ve made a small modification (at the suggestion of <a href="http://www.glynblogs.com/2011/12/viewing-timer-job-history-for-a-specific-date-and-time-period.html" title="Jaap Vossers">Jaap Vossers</a>) so that the script now lists any jobs that either start in the specified range, or end in the specified range.</p>
<pre class="brush: powershell; title: ;">
cls
# Add SharePoint cmdlets reference
Add-PSSnapin microsoft.sharepoint.powershell -ErrorAction SilentlyContinue

function Get-TimerJobs {
    param(
        [DateTime] $startTime,
        [DateTime] $endTime
    )

    Get-SPWebApplication | foreach {
        $_.JobHistoryEntries |
             where{ ($startTime -le $_.StartTime -and $_.StartTime -le $endTime) -or
                    ($startTime -le $_.EndTime -and $_.EndTime -le $endTime) } |
                sort StartTime |
                select JobDefinitionTitle,WebApplicationName,ServerName,Status,StartTime,EndTime,@{Expression={($_.EndTime - $_.StartTime).TotalSeconds};Label=&quot;Duration (secs)&quot;}
    }
}

$startDate = Get-Date &quot;15/12/2011 11:00 AM&quot;
$endDate = Get-Date &quot;15/12/2011 11:50 AM&quot;

$results = Get-TimerJobs -startTime $startDate -endTime $endDate
$results | Out-GridView
</pre>
<p>Which gives an output like the below (I’ve removed server name and web application name from the screenshot) from which I can easily spot if there are any failed jobs or jobs that took an unusually long time:<br />
<a href="http://www.glynblogs.com/wp-content/uploads/2011/12/Timer-Job-History-Capture.png" rel="lightbox[707]"><img src="http://www.glynblogs.com/wp-content/uploads/2011/12/Timer-Job-History-Capture-300x186.png" alt="Timer Job History Capture" title="Timer Job History Capture" width="300" height="186" class="alignnone size-medium wp-image-709" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.glynblogs.com/2011/12/viewing-timer-job-history-for-a-specific-date-and-time-period.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Finding a Correlation ID using Fiddler</title>
		<link>http://www.glynblogs.com/2011/12/finding-a-correlation-id-using-fiddler.html</link>
		<comments>http://www.glynblogs.com/2011/12/finding-a-correlation-id-using-fiddler.html#comments</comments>
		<pubDate>Fri, 09 Dec 2011 15:15:53 +0000</pubDate>
		<dc:creator>Glyn Clough</dc:creator>
				<category><![CDATA[SharePoint 2010]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://www.glynblogs.com/?p=703</guid>
		<description><![CDATA[<p>When working with SharePoint it’s inevitable that at some point you will come across a Correlation ID on your screen! These are invaluable for tracking down issues when you’re building new functionality – and are handily displayed in the onscreen error messages so that they can be plugged into ULS Viewer to track down the <span style="color:#777"> . . . &#8594; Read More: <a href="http://www.glynblogs.com/2011/12/finding-a-correlation-id-using-fiddler.html">Finding a Correlation ID using Fiddler</a></span>]]></description>
			<content:encoded><![CDATA[<p>When working with SharePoint it’s inevitable that at some point you will come across a <strong>Correlation ID</strong> on your screen! These are invaluable for tracking down issues when you’re building new functionality – and are handily displayed in the onscreen error messages so that they can be plugged into <a href="http://archive.msdn.microsoft.com/ULSViewer" title="ULS Viewer">ULS Viewer</a> to track down the root cause…</p>
<p>However, what if there’s an issue that you want to track down that doesn’t result in the error message being displayed? E.g. perhaps something isn’t firing when it should and you need to track down this <em>&#8220;non-event&#8221;</em>.</p>
<p>Well, thanks to a little trick gleaned from working with the talented <a href="http://blog.vossers.com/" title="Jaap Vossers">Jaap Vossers</a>, I’ve seen that this is easy to do! <a href="http://www.fiddler2.com/fiddler2/" title="Fiddler">Fiddler</a> is an invaluable tool for all web development, and SharePoint is no exception. What is really useful in this scenario is that SharePoint returns the Correlation ID as a <strong>HTTP response header</strong> &#8211; as you can see in the screenshot below the <strong>SPRequestGuid</strong> is what we&#8217;re after.</p>
<p><a href="http://www.glynblogs.com/wp-content/uploads/2011/12/Fiddler-Correlation-ID.png" rel="lightbox[703]"><img src="http://www.glynblogs.com/wp-content/uploads/2011/12/Fiddler-Correlation-ID-300x104.png" alt="Fiddler Correlation ID" title="Fiddler Correlation ID" width="300" height="104" class="alignnone size-medium wp-image-702" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.glynblogs.com/2011/12/finding-a-correlation-id-using-fiddler.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Displaying a random list item with XSL</title>
		<link>http://www.glynblogs.com/2011/11/displaying-a-random-list-item-with-xsl.html</link>
		<comments>http://www.glynblogs.com/2011/11/displaying-a-random-list-item-with-xsl.html#comments</comments>
		<pubDate>Wed, 30 Nov 2011 22:00:35 +0000</pubDate>
		<dc:creator>Glyn Clough</dc:creator>
				<category><![CDATA[SharePoint 2007]]></category>
		<category><![CDATA[SharePoint 2010]]></category>
		<category><![CDATA[CQWP]]></category>
		<category><![CDATA[Lists]]></category>
		<category><![CDATA[XLV]]></category>
		<category><![CDATA[XSL]]></category>

		<guid isPermaLink="false">http://www.glynblogs.com/?p=692</guid>
		<description><![CDATA[<p>This week I re-discovered a technique for displaying a random item from a list using XSL. This can apply to both Content Query Web Parts (CQWP) and XSLT List View Web Parts (XLV) and is actually a very trivial piece of XSL.</p> <p>The technique goes something like:</p> Get a count of how many items to <span style="color:#777"> . . . &#8594; Read More: <a href="http://www.glynblogs.com/2011/11/displaying-a-random-list-item-with-xsl.html">Displaying a random list item with XSL</a></span>]]></description>
			<content:encoded><![CDATA[<p>This week I re-discovered a technique for <strong>displaying a random item from a list</strong> using XSL. This can apply to both Content Query Web Parts (CQWP) and XSLT List View Web Parts (XLV) and is actually a very trivial piece of XSL.</p>
<p>The technique goes something like:</p>
<ol>
<li>Get a count of how many items to choose a random item from, say RowCount</li>
<li>Return a random number between 1 and RowCount</li>
<li>Use that random number to display a list item</li>
</ol>
<p>The important bit is discovering/ remembering that there is a function available to use in SharePoint in the <a href="http://msdn.microsoft.com/en-us/library/dd583143(v=office.11).aspx">ddwrt namespace</a> that generates a random number between two given numbers. It is this <em>ddwrt:Random(1, RowCount)</em> function that allows us to achieve our objective.<br />
<span id="more-692"></span><br />
The XSL could look something like this:</p>
<pre class="brush: xml; title: ;">
&lt;xsl:stylesheet
  version=&quot;1.0&quot;
  exclude-result-prefixes=&quot;x d xsl ddwrt&quot;
  xmlns:x=&quot;http://www.w3.org/2001/XMLSchema&quot;
  xmlns:d=&quot;http://schemas.microsoft.com/sharepoint/dsp&quot;
  xmlns:xsl=&quot;http://www.w3.org/1999/XSL/Transform&quot;
  xmlns:ddwrt=&quot;http://schemas.microsoft.com/WebParts/v2/DataView/runtime&quot;&gt;
  &lt;xsl:template match=&quot;/&quot;&gt;
	&lt;xsl:variable name=&quot;Rows&quot; select=&quot;/dsQueryResponse/Rows/Row&quot; /&gt;
	&lt;xsl:variable name=&quot;RowCount&quot; select=&quot;count($Rows)&quot; /&gt;
	&lt;xsl:variable name=&quot;RandomNumber&quot; select=&quot;ddwrt:Random(1, $RowCount)&quot; /&gt;

	&lt;xsl:for-each select=&quot;$Rows[position() = $RandomNumber]&quot;&gt;
		&lt;xsl:value-of select=&quot;@Title&quot; /&gt;
	&lt;/xsl:for-each&gt;
  &lt;/xsl:template&gt;
&lt;/xsl:stylesheet&gt;
</pre>
<p>Note, even though we&#8217;re only displaying a single item we are still querying and returning potentially many items. For this reason I&#8217;d only recommend using this technique on relatively small lists.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.glynblogs.com/2011/11/displaying-a-random-list-item-with-xsl.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Lync Online Observation: Missing Photos With Federated Users</title>
		<link>http://www.glynblogs.com/2011/11/lync-online-observation-missing-photos-with-federated-users.html</link>
		<comments>http://www.glynblogs.com/2011/11/lync-online-observation-missing-photos-with-federated-users.html#comments</comments>
		<pubDate>Fri, 04 Nov 2011 17:10:24 +0000</pubDate>
		<dc:creator>Glyn Clough</dc:creator>
				<category><![CDATA[Miscellaneous]]></category>
		<category><![CDATA[Lync]]></category>
		<category><![CDATA[Office 365 Grid]]></category>

		<guid isPermaLink="false">http://www.glynblogs.com/?p=684</guid>
		<description><![CDATA[<p>After a few teething problems, I finally managed to get my Office 365 account (Plan P1) working with the Lync for Mac client. This isn’t a post about how those problems were resolved (update the client to version 14.0.1!) – but rather a comment on a simple observation made when I finally started to use Lync for the <span style="color:#777"> . . . &#8594; Read More: <a href="http://www.glynblogs.com/2011/11/lync-online-observation-missing-photos-with-federated-users.html">Lync Online Observation: Missing Photos With Federated Users</a></span>]]></description>
			<content:encoded><![CDATA[<p>After a few teething problems, I finally managed to get my <strong>Office 365</strong> account (Plan P1) working with the <strong>Lync for Mac</strong> client. This isn’t a post about how those problems were resolved (update the client to version 14.0.1!) – but rather a comment on a simple observation made when I finally started to use Lync for the first time.<br />
 <br />
The first thing I wanted to do after signing-in successfully was to, well, check that I could send a message. Step forward <a href="http://tristanwatkins.com/">Tristan Watkins</a> (general infrastructure guru and previous <a href="http://community.office365.com/en-us/b/office_365_technical_blog/archive/2011/10/27/grid-user-of-the-week-tristan-watkins.aspx" title="Tristan Watkins - Office 365 Grid User of the Week">Office 365 Grid User of the Week</a>) as my chosen test subject! The conversation went something like this:</p>
<p><a href="http://www.glynblogs.com/wp-content/uploads/2011/11/Lync-First-Conversation.png" rel="lightbox[684]"><img src="http://www.glynblogs.com/wp-content/uploads/2011/11/Lync-First-Conversation-240x300.png" alt="Lync - First Conversation" title="Lync - First Conversation" width="240" height="300" class="alignnone size-medium wp-image-687" /></a><br />
 <br />
Hmmm. Now leaving aside the intelligent conversation the interesting thing here is that Tristan has a photo associated with his account, but yet I can’t see it? Why not?<br />
<span id="more-684"></span> <br />
Well it appears that Tristan&#8217;s Lync contact card details are synced with an on-premises Active Directory, and that this is where the photo property is being set. Tristan is using what I believe to be the default setting of &#8216;<em>Default corporate picture</em>&#8216; in his Lync client, and not explicitly providing a public web address to a photo.<br />
 <br />
<a href="http://www.glynblogs.com/wp-content/uploads/2011/11/Lync-Default-Corporate-Picture.png" rel="lightbox[684]"><img src="http://www.glynblogs.com/wp-content/uploads/2011/11/Lync-Default-Corporate-Picture-300x254.png" alt="Lync - Default Corporate Picture" title="Lync - Default Corporate Picture" width="300" height="254" class="alignnone size-medium wp-image-686" /></a><br />
 <br />
I think the interesting observation from a user perspective here is that when Tristan is using Lync with guys <strong>inside his organisation then they can see the corporate pictures and yet people outside the organisation can&#8217;t</strong>. However, as Lync Online easily allows me to create a contacts list with people both in and outside my organisation one may be expecting all of the contacts to have a similar experience. To ensure that consistent experience then it appears that the option to show a picture from a web address needs to be chosen.<br />
 <br />
So what does this mean? Well first up, I think it&#8217;s just something that if you&#8217;re federating your AD to Lync Online it&#8217;s good to be aware of. On a technical level then I&#8217;m guessing that it means that the AD user picture (<em>thumbnailPhoto</em>?) isn&#8217;t included as part of the federation &#8211; and perhaps is never likely to be because it&#8217;s stored as a BLOB. To get consistency perhaps some form of one-off sync could be used or maybe store a public URL in AD? I don&#8217;t know, but maybe somebody out there can work it out; Tristan…?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.glynblogs.com/2011/11/lync-online-observation-missing-photos-with-federated-users.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Inspecting the CAML of a Content Query Web Part</title>
		<link>http://www.glynblogs.com/2011/08/inspecting-the-caml-of-a-content-query-web-part.html</link>
		<comments>http://www.glynblogs.com/2011/08/inspecting-the-caml-of-a-content-query-web-part.html#comments</comments>
		<pubDate>Thu, 04 Aug 2011 08:15:44 +0000</pubDate>
		<dc:creator>Glyn Clough</dc:creator>
				<category><![CDATA[SharePoint 2010]]></category>
		<category><![CDATA[CQWP]]></category>

		<guid isPermaLink="false">http://www.glynblogs.com/?p=669</guid>
		<description><![CDATA[<p>I saw a message on the twitter tag #SPHelp today from @paulschaeflein asking how to troubleshoot the Content Query Web Part. After recently rediscovering a post I’d written on a bug with the CQWP it was fresh in my memory that I’d previously had to do a similar thing. In particular I’d wanted to inspect <span style="color:#777"> . . . &#8594; Read More: <a href="http://www.glynblogs.com/2011/08/inspecting-the-caml-of-a-content-query-web-part.html">Inspecting the CAML of a Content Query Web Part</a></span>]]></description>
			<content:encoded><![CDATA[<p>I saw a message on the twitter tag <a href="http://twitter.com/#!/search/realtime/%23SPHelp">#SPHelp</a> today from <a href="http://twitter.com/#!/paulschaeflein">@paulschaeflein</a> asking how to <strong>troubleshoot the Content Query Web Part</strong>. After recently rediscovering a <a title="CQWP PageQueryString Filter Bug" href="http://www.glynblogs.com/2010/05/cqwp-pagequerystring-filter-bug.html">post I’d written on a bug with the CQWP</a> it was fresh in my memory that I’d previously had to do a similar thing. In particular I’d wanted to <strong>inspect the CAML query</strong> used by a specific web part.</p>
<p>Assuming that you have access to the logs it’s actually quite a straight forward process to see the query that’s being used. Here’s an example:<br />
<span id="more-669"></span><br />
First I’ll create a CQWP on a page which simply goes away and gets all pages across the site collection which have ‘<em>Glyn</em>’ in the title and where created after the turn of the year. I set this up like so:<br />
<a href="http://www.glynblogs.com/wp-content/uploads/2011/08/CQWP-Configured-Properties.png" rel="lightbox[669]"><img class="alignnone size-medium wp-image-674" title="CQWP Configured Properties" src="http://www.glynblogs.com/wp-content/uploads/2011/08/CQWP-Configured-Properties-143x300.png" alt="CQWP Configured Properties" width="143" height="300" /></a></p>
<p>Having done this I can now see the results as I expect:<br />
<a href="http://www.glynblogs.com/wp-content/uploads/2011/08/CQWP-Configured.png" rel="lightbox[669]"><img class="alignnone size-full wp-image-673" title="CQWP Configured" src="http://www.glynblogs.com/wp-content/uploads/2011/08/CQWP-Configured.png" alt="CQWP Configured" width="138" height="84" /></a></p>
<p>Now assuming that I want to view <strong>the underlying CAML query</strong> that is used for this web part I simply have to look in the log files. To do this I use the essential <a href="http://archive.msdn.microsoft.com/ULSViewer">ULS Viewer</a>, and open up the logs so that I can see real-time results (having first ensured that I have temporarily increased the logging level to ‘verbose’).</p>
<p>Next I simply add a filter to the logs to see entries where the message field contains the string “<em>&lt;where&gt;</em>”. I could also filter by the <em>Product: Web Content Management</em> and the <em>Category: Publishing</em>. From here I can actually see the CAML query that is being used for my web part!<br />
<a href="http://www.glynblogs.com/wp-content/uploads/2011/08/CQWP-ULS-Logs.png" rel="lightbox[669]"><img class="alignnone size-medium wp-image-675" title="CQWP ULS Logs" src="http://www.glynblogs.com/wp-content/uploads/2011/08/CQWP-ULS-Logs-300x112.png" alt="CQWP ULS Logs" width="300" height="112" /></a></p>
<p>Stripping out the relevant bits of the CAML I see that in my example the query looks like this (note how it uses the GUIDs of the field names):</p>
<pre class="brush: xml; title: ;">
&lt;Query&gt;
	&lt;Where&gt;
		&lt;And&gt;
			&lt;Gt&gt;
				&lt;FieldRef ID=&quot;{8c06beca-0777-48f7-91c7-6da68bc07b69}&quot; Nullable=&quot;True&quot; Type=&quot;DateTime&quot;/&gt;
				&lt;Value Type=&quot;DateTime&quot;&gt;2011-01-01T00:00:00Z&lt;/Value&gt;
			&lt;/Gt&gt;
			&lt;Contains&gt;
				&lt;FieldRef ID=&quot;{fa564e0f-0c70-4ab9-b863-0177e6ddd247}&quot; Nullable=&quot;True&quot; Type=&quot;Text&quot;/&gt;
				&lt;Value Type=&quot;Text&quot;&gt;Glyn&lt;/Value&gt;
			&lt;/Contains&gt;
		&lt;/And&gt;
	&lt;/Where&gt;
	&lt;OrderBy&gt;
		&lt;FieldRef ID=&quot;{8c06beca-0777-48f7-91c7-6da68bc07b69}&quot; Nullable=&quot;True&quot; Type=&quot;DateTime&quot; Ascending=&quot;FALSE&quot;/&gt;
	&lt;/OrderBy&gt;
&lt;/Query&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.glynblogs.com/2011/08/inspecting-the-caml-of-a-content-query-web-part.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>XLV Bug: Unable to use folders with cross-site XLV</title>
		<link>http://www.glynblogs.com/2011/08/xlv-bug-unable-to-use-folders-with-cross-site-xlv.html</link>
		<comments>http://www.glynblogs.com/2011/08/xlv-bug-unable-to-use-folders-with-cross-site-xlv.html#comments</comments>
		<pubDate>Wed, 03 Aug 2011 17:55:25 +0000</pubDate>
		<dc:creator>Glyn Clough</dc:creator>
				<category><![CDATA[SharePoint 2010]]></category>
		<category><![CDATA[Lists]]></category>
		<category><![CDATA[XLV]]></category>

		<guid isPermaLink="false">http://www.glynblogs.com/?p=656</guid>
		<description><![CDATA[<p>As I was writing up a post in my collection of bugs with the XSLT List View Web Part I received a comment on a previous post regarding using the XLV with a list from a different site. The commenter (thanks Roy!) was reporting an issue when viewing a document library from one site on <span style="color:#777"> . . . &#8594; Read More: <a href="http://www.glynblogs.com/2011/08/xlv-bug-unable-to-use-folders-with-cross-site-xlv.html">XLV Bug: Unable to use folders with cross-site XLV</a></span>]]></description>
			<content:encoded><![CDATA[<p>As I was writing up a post in my <strong>collection of bugs with the XSLT List View Web Part</strong> I received a comment on a previous post regarding <a href="http://www.glynblogs.com/2011/07/creating-an-xslt-list-view-web-part-from-a-different-site.html" title="Creating an XSLT List View Web Part from a Different Site">using the XLV with a list from a different site</a>. The commenter (thanks Roy!) was reporting an issue when viewing a document library from one site on another site – but only <strong>when trying to use folders in the library</strong>!</p>
<p>I’ve therefore added this post to my series: </p>
<ul>
<li><a href="http://www.glynblogs.com/2011/07/xlv-bug-view-settings-lost-on-saved-xslt-list-view-web-part.html" title="XLV Bug: View settings lost on saved XSLT List View Web Part">View settings lost on saved XSLT List View Web Part</a></li>
<li><a href="http://www.glynblogs.com/2011/08/xlv-bug-content-type-enabled-list-xlv-can%e2%80%99t-be-added-to-sites.html" title="XLV Bug: Content type enabled list XLV can’t be added to sites">Content type enabled list XLV can’t be added to sites</a></li>
<li><a href="http://www.glynblogs.com/2011/05/xlv-bug-xsl-link-property-and-the-ecb-menu.html" title="XLV Bug: XSL Link Property and the ECB Menu">XSL Link Property and the ECB Menu</a></li>
<li>Multiple web front ends, conflicts and the XLV</li>
<li><strong><em>Unable to use folders with cross-site XLV</em></strong> (this post!)</li>
</ul>
<p><span id="more-656"></span></p>
<h3>The Bug</h3>
<p>This is a very straight forward bug to describe. You place an XSLT List View Web Part of your document library onto a different site than where the library resides – perhaps by saving the web part into the gallery through SharePoint Designer, or perhaps <a href="http://www.glynblogs.com/2011/07/creating-an-xslt-list-view-web-part-from-a-different-site.html" title="Creating an XSLT List View Web Part from a Different Site">by creating the <em>.webpart</em> file manually</a>. After doing so you try to click on a folder item to see the contents of that folder in your XLV – as per the expected behaviour. In doing so you get to see an error message like this:<br />
<a href="http://www.glynblogs.com/wp-content/uploads/2011/08/XLV-Bug-No-Item-Exists.png" rel="lightbox[656]"><img src="http://www.glynblogs.com/wp-content/uploads/2011/08/XLV-Bug-No-Item-Exists-300x170.png" alt="XLV Bug No Item Exists Error" title="XLV Bug No Item Exists Error" width="300" height="170" class="alignnone size-medium wp-image-658" /></a></p>
<p>This error seems to occur no matter if you add the web part through SharePoint Designer or via the browser.</p>
<h3>Example</h3>
<p>Here’s an example of this in action. I’ll first create a document library containing a folder. Using SharePoint Designer 2010 I’ll then save a web part to the gallery for this document library. Adding this web par to the site where the library exists via the browser and I get the web part, fully functional, as expected.<br />
<a href="http://www.glynblogs.com/wp-content/uploads/2011/08/XLV-Folder-View.png" rel="lightbox[656]"><img src="http://www.glynblogs.com/wp-content/uploads/2011/08/XLV-Folder-View-300x60.png" alt="XLV Folder View" title="XLV Folder View" width="300" height="60" class="alignnone size-medium wp-image-659" /></a></p>
<p>Now, I navigate to a different site and add the web part again. At first glance it appears that everything is working as expected – however I then click on a folder to view the contents of that folder. BOOM – that’s where I see the error message shown above.</p>
<h3>Explanation &#038; Workaround</h3>
<p>I haven’t been able to find the root cause of this issue – however my suspicion is that this is an error in the out of the box XSL. This is because the error message seems fairly clear that it is looking in the ‘wrong place’, i.e. in the current site rather than the library’s site. This <em>feels</em> like an error that could be foreseen/ bypassed in the XSL to me.</p>
<p>In terms of a workaround then I’m stumped again unfortunately. The only option I can think of is to avoid the situation by setting up your view to not sure folders – which is less than ideal.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.glynblogs.com/2011/08/xlv-bug-unable-to-use-folders-with-cross-site-xlv.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>XLV Bug: Content type enabled list XLV can’t be added to sites</title>
		<link>http://www.glynblogs.com/2011/08/xlv-bug-content-type-enabled-list-xlv-can%e2%80%99t-be-added-to-sites.html</link>
		<comments>http://www.glynblogs.com/2011/08/xlv-bug-content-type-enabled-list-xlv-can%e2%80%99t-be-added-to-sites.html#comments</comments>
		<pubDate>Tue, 02 Aug 2011 19:34:07 +0000</pubDate>
		<dc:creator>Glyn Clough</dc:creator>
				<category><![CDATA[SharePoint 2010]]></category>
		<category><![CDATA[Lists]]></category>
		<category><![CDATA[XLV]]></category>

		<guid isPermaLink="false">http://www.glynblogs.com/?p=643</guid>
		<description><![CDATA[<p>Another instalment of my mini-series about some bugs that I’ve encountered with the XSLT List View Web Part – this time looking at an error that occurs if you try and show a content type enabled list on a different site using the XLV.</p> <p>This post is part of a series consisting of several other <span style="color:#777"> . . . &#8594; Read More: <a href="http://www.glynblogs.com/2011/08/xlv-bug-content-type-enabled-list-xlv-can%e2%80%99t-be-added-to-sites.html">XLV Bug: Content type enabled list XLV can’t be added to sites</a></span>]]></description>
			<content:encoded><![CDATA[<p>Another instalment of my mini-series about some bugs that I’ve encountered with the <strong>XSLT List View Web Part</strong> – this time looking at <strong>an error that occurs if you try and show a content type enabled list on a different site using the XLV</strong>.</p>
<p>This post is part of a series consisting of several other bugs I’ve seen with the XSLT List View Web Part:</p>
<ul>
<li><a title="XLV Bug: View settings lost on saved XSLT List View Web Part" href="http://www.glynblogs.com/2011/07/xlv-bug-view-settings-lost-on-saved-xslt-list-view-web-part.html">View settings lost on saved XSLT List View Web Part</a></li>
<li><strong><em>Content type enabled list XLV can’t be added to sites</em></strong> (this post!)</li>
<li><a title="XLV Bug: XSL Link Property and the ECB Menu" href="http://www.glynblogs.com/2011/05/xlv-bug-xsl-link-property-and-the-ecb-menu.html">XSL Link Property and the ECB Menu</a></li>
<li>Multiple web front ends, conflicts and the XLV</li>
<li><a href="http://www.glynblogs.com/2011/08/xlv-bug-unable-to-use-folders-with-cross-site-xlv.html" title="XLV Bug: Unable to use folders with cross-site XLV">Unable to use folders with cross-site XLV</a></li>
</ul>
<p>I’ve previously posted on how it’s possible to <a title="Creating an XSLT List View Web Part from a Different Site" href="http://www.glynblogs.com/2011/07/creating-an-xslt-list-view-web-part-from-a-different-site.html">display the XLV on a different site to the original list</a> without the need to resort to SharePoint Designer. This is a nice solution for a really really useful web part, especially when <a title="Overriding the presentation of an XSLT List View Web Part" href="http://www.glynblogs.com/2011/04/overriding-the-presentation-of-an-xslt-list-view-web-part.html">combined with easily added custom XSL in the XLV</a>. However, I’ve run into a problem with this when the list I’m trying to display has content types enabled!<br />
<span id="more-643"></span><br />
&#8212;-<br />
<strong>Update 03/10/11:</strong> This issue has been corrected in the August 2011 Cumulative Update! I have been able to add an XLV for a list on a different site. Note &#8211; when adding an XLV to a publishing page I had a few &#8216;<em>list does not exist</em>&#8216; errors which for a while prevent me viewing the page. By editing and immediately saving the XLV before saving the page I was able to bypass these errors.<br />
&#8212;-</p>
<p>As I’m sure you’re all aware (but just to be completely clear!) content types can be enabled on a list by navigating to <em>List Settings &gt; Advanced Settings</em> and selecting <em>allow management of content types</em>. If your solutions are anything like mine then I’d bet that content types are (rightly) used on the majority of your lists.<br />
<a href="http://www.glynblogs.com/wp-content/uploads/2011/08/Allow-Management-Of-Content-Types.png" rel="lightbox[643]"><img class="alignnone size-medium wp-image-647" title="Allow Management Of Content Types" src="http://www.glynblogs.com/wp-content/uploads/2011/08/Allow-Management-Of-Content-Types-300x65.png" alt="Allow Management Of Content Types" width="300" height="65" /></a></p>
<h3>The Bug</h3>
<p>I have seen no issues when enabling content types and using the XLV on the same site as where the list resides – even when customising the XSL or using web part connections etc. The issue occurs when exporting an XLV (perhaps through SPD or perhaps manually) to the web part gallery and then choosing to add this web part to a new site. The error received at this point is pretty hard to miss! And in fact I’ve found no satisfactory way to get past this without going into the <strong>web part maintenance page</strong> and completely deleting the web part (without resorting to custom code).<br />
<a href="http://www.glynblogs.com/wp-content/uploads/2011/08/XLV-Bug-Unexpected-Error.png" rel="lightbox[643]"><img class="alignnone size-medium wp-image-650" title="XLV Bug Unexpected Error" src="http://www.glynblogs.com/wp-content/uploads/2011/08/XLV-Bug-Unexpected-Error-300x163.png" alt="XLV Bug Unexpected Error" width="300" height="163" /></a></p>
<h3>Example</h3>
<p>Here’s an example of this in action. I simply create a new out of the box Tasks list – which by default has content types enabled on it. I then add an XLV to a page in the same site for this new list.<br />
<a href="http://www.glynblogs.com/wp-content/uploads/2011/08/XLV-Bug-Tasks-XLV.png" rel="lightbox[643]"><img src="http://www.glynblogs.com/wp-content/uploads/2011/08/XLV-Bug-Tasks-XLV-300x102.png" alt="XLV Bug Tasks XLV" title="XLV Bug Tasks XLV" width="300" height="102" class="alignnone size-medium wp-image-648" /></a></p>
<p>Next, after exporting the web part through SharePoint Designer 2010 and adding it to the web part gallery (making sure to reference the same list, not a relative list) I then go to a different site and try to add the web part. That’s when I see the error above!</p>
<p>How do I know that this is related to content types? Well, simply go back to the list and disable the allow management of content types option and refresh the page where you’ve tried to add the web part. You’ll now notice that the web part displays! (And it displays using the default view of the list, not the one saved in the web part as per <a title="XLV Bug: View settings lost on saved XSLT List View Web Part" href="http://www.glynblogs.com/2011/07/xlv-bug-view-settings-lost-on-saved-xslt-list-view-web-part.html">another bug I mention in this series</a>)<br />
<a href="http://www.glynblogs.com/wp-content/uploads/2011/08/XLV-Bug-Tasks-XLV-Reverted.png" rel="lightbox[643]"><img src="http://www.glynblogs.com/wp-content/uploads/2011/08/XLV-Bug-Tasks-XLV-Reverted-300x106.png" alt="XLV Bug Tasks XLV Reverted" title="XLV Bug Tasks XLV Reverted" width="300" height="106" class="alignnone size-medium wp-image-649" /></a></p>
<p>Obviously by disabling content types we’ve completely altered the functionality of the list and so this isn’t a viable solution – however it is a great diagnostic aid in pointing out where the root cause of the issue may lie.</p>
<h3>Explanation</h3>
<p>This is a long term issue on our current project and one that has appeared in various guises over the last 6 months or more. A colleague, Stuart Starrs, did some digging around and actually wrote a web part as a potential workaround for the issue. You can find <a href="http://www.intheknow.it/xsitexlverror.ashx">a detailed post with source code on his blog</a>.</p>
<p>It appears that the trouble lies with the code which is creating the ‘toolbar’ for the XLV, as you can see from the below error taken from the ULS logs:</p>
<pre class="brush: plain; title: ;">
System.ArgumentException: Value does not fall within the expected range.
 at Microsoft.SharePoint.SPWeb.GetWebRelativeUrlFromUrl(String strUrl, Boolean includeQueryString, Boolean canonicalizeUrl)
 at Microsoft.SharePoint.SPWeb.GetFolder(String strUrl)
 at Microsoft.SharePoint.WebControls.NewMenu.AddMenuItems()
 at Microsoft.SharePoint.WebControls.ToolBarMenuButton.CreateChildControls()
 at Microsoft.SharePoint.WebControls.NewMenu.CreateChildControls()
 at System.Web.UI.Control.EnsureChildControls()
 at Microsoft.SharePoint.WebControls.TemplateBasedControl.OnLoad(EventArgs e)
 at Microsoft.SharePoint.WebControls.ToolBarMenuButton.OnLoad(EventArgs e)
 at System.Web.UI.Control.LoadRecursive()
 at System.Web.UI.Control.LoadRecursive()
 at System.Web.UI.Control.LoadRecursive()
 at System.Web.UI.Control.LoadRecursive()
 at System.Web.UI.Control.LoadRecursive()
 at System.Web.UI.Control.AddedControl(Control control, Int32 index)
 at Microsoft.SharePoint.WebPartPages.DataFormWebPart.CreateChildControls()
 at Microsoft.SharePoint.WebPartPages.BaseXsltListWebPart.CreateChildControls()
 at Microsoft.SharePoint.WebPartPages.WebPartMobileAdapter.CreateChildControls()
 at System.Web.UI.Control.EnsureChildControls()
 at System.Web.UI.Control.PreRenderRecursiveInternal()
 at System.Web.UI.Control.PreRenderRecursiveInternal()
 at System.Web.UI.Control.PreRenderRecursiveInternal()
 at System.Web.UI.Control.PreRenderRecursiveInternal()
 at System.Web.UI.Control.PreRenderRecursiveInternal()
 at System.Web.UI.Control.PreRenderRecursiveInternal()
 at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
</pre>
<h3>Workarounds</h3>
<p>As this is such a fundamental issue it’s a very tricky one to say what a suitable workaround is. Other than not using content types on list (!!!) the custom web part from Stuart is definitely the only way we’ve found so far. However, I have been chasing this up with Microsoft and they have recognised it as a bug – and there are hopes that at some point a fix will make it into a cumulative update.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.glynblogs.com/2011/08/xlv-bug-content-type-enabled-list-xlv-can%e2%80%99t-be-added-to-sites.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>XLV Bug: View settings lost on saved XSLT List View Web Part</title>
		<link>http://www.glynblogs.com/2011/07/xlv-bug-view-settings-lost-on-saved-xslt-list-view-web-part.html</link>
		<comments>http://www.glynblogs.com/2011/07/xlv-bug-view-settings-lost-on-saved-xslt-list-view-web-part.html#comments</comments>
		<pubDate>Thu, 28 Jul 2011 08:08:17 +0000</pubDate>
		<dc:creator>Glyn Clough</dc:creator>
				<category><![CDATA[SharePoint 2010]]></category>
		<category><![CDATA[Lists]]></category>
		<category><![CDATA[SharePoint Designer 2010]]></category>
		<category><![CDATA[XLV]]></category>

		<guid isPermaLink="false">http://www.glynblogs.com/?p=627</guid>
		<description><![CDATA[<p>After working with the XSLT List View Web Part for a good while now I’ve discovered some great features and a few annoying niggles or bugs. Whilst I’ll continue to post new finds and interesting techniques, I thought it worthwhile gathering the list of bugs together into a series – as I believe they’re something <span style="color:#777"> . . . &#8594; Read More: <a href="http://www.glynblogs.com/2011/07/xlv-bug-view-settings-lost-on-saved-xslt-list-view-web-part.html">XLV Bug: View settings lost on saved XSLT List View Web Part</a></span>]]></description>
			<content:encoded><![CDATA[<p>After working with the <strong>XSLT List View Web Part</strong> for a good while now I’ve discovered some great features and a few annoying niggles or bugs. Whilst I’ll continue to post new finds and interesting techniques, I thought it worthwhile gathering the list of bugs together into a series – as I believe they’re something you should be aware of if planning on using the XLV extensively in your solution (and why wouldn’t you!).</p>
<p>The series will consist of:</p>
<ul>
<li><strong><em>View settings lost on saved XSLT List View Web Part</em></strong> (this post!)</li>
<li><a href="http://www.glynblogs.com/2011/08/xlv-bug-content-type-enabled-list-xlv-can%e2%80%99t-be-added-to-sites.html" title="XLV Bug: Content type enabled list XLV can’t be added to sites">Content type enabled list XLV can’t be added to sites</a></li>
<li><a href="http://www.glynblogs.com/2011/05/xlv-bug-xsl-link-property-and-the-ecb-menu.html" title="XLV Bug: XSL Link Property and the ECB Menu">XSL Link Property and the ECB Menu</a> (published in May 2011)</li>
<li>Multiple web front ends, conflicts and the XLV</li>
<li><a href="http://www.glynblogs.com/2011/08/xlv-bug-unable-to-use-folders-with-cross-site-xlv.html" title="XLV Bug: Unable to use folders with cross-site XLV">Unable to use folders with cross-site XLV</a></li>
</ul>
<p><span id="more-627"></span></p>
<h3>The Bug</h3>
<p>Having configured your list view exactly how you need; possibly having spent a while adding/ removing columns, choosing sort orders and filters etc you now decide that you want to re-use all your effort by having exactly the same XLV on a different page, or even site.</p>
<p>The first step is to export your web part. This can be done via SharePoint Designer 2010 or by the <a href="http://www.glynblogs.com/2011/07/creating-an-xslt-list-view-web-part-from-a-different-site.html" title="Creating an XSLT List View Web Part from a Different Site">XLV export/ import method</a> that I’ve previously posted. You now try and add your web part to a page using the browser, i.e. not using SharePoint Designer.</p>
<p>Immediately after adding the web part everything is looking great – the list view is displayed exactly as it was on wherever you exported it from. Now you hit <em>Save</em> or <em>Check In</em>… and the XLV <strong>reverts to the default view on the list!</strong> Your carefully configured view has just been lost – and that’s the bug <img src='http://www.glynblogs.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h3>Example</h3>
<p>Here’s an example of this in action. First I add a simple custom list to a page, modify the view and, just because we can, jump into SPD 2010 to add some custom formatting:<br />
<a href="http://www.glynblogs.com/wp-content/uploads/2011/07/Customised-XLV.png" rel="lightbox[627]"><img src="http://www.glynblogs.com/wp-content/uploads/2011/07/Customised-XLV.png" alt="Customised XLV" title="Customised XLV" width="299" height="216" class="alignnone size-full wp-image-632" /></a></p>
<p>I now use SharePoint Designer to export the web part and add it to the gallery:<br />
<a href="http://www.glynblogs.com/wp-content/uploads/2011/07/Export-web-part-option-in-SPD2010.png" rel="lightbox[627]"><img src="http://www.glynblogs.com/wp-content/uploads/2011/07/Export-web-part-option-in-SPD2010.png" alt="Export web part option in SPD2010" title="Export web part option in SPD2010" width="104" height="85" class="alignnone size-full wp-image-633" /></a></p>
<p>Now, I go back to the browser, create a new page and add the web part. There’s my nicely configured view…<br />
<a href="http://www.glynblogs.com/wp-content/uploads/2011/07/Added-XLV-with-correct-view-in-edit-mode.png" rel="lightbox[627]"><img src="http://www.glynblogs.com/wp-content/uploads/2011/07/Added-XLV-with-correct-view-in-edit-mode-300x198.png" alt="Added XLV with correct view in edit mode" title="Added XLV with correct view in edit mode" width="300" height="198" class="alignnone size-medium wp-image-631" /></a></p>
<p>But now I hit save on the page and BOOM there goes my view back to the default on the list:<br />
<a href="http://www.glynblogs.com/wp-content/uploads/2011/07/XLV-reverting-to-default-view.png" rel="lightbox[627]"><img src="http://www.glynblogs.com/wp-content/uploads/2011/07/XLV-reverting-to-default-view-300x96.png" alt="XLV reverting to default view" title="XLV reverting to default view" width="300" height="96" class="alignnone size-medium wp-image-634" /></a></p>
<p>So my view has been changed, including my sort order and columns chosen to display – but strangely my custom formatting is still there! What is going on…</p>
<h3>Explanation</h3>
<p>I lack the skills to step through the underlying code of what exactly happens when the imported web part is attempted to be saved back to the page – however I think we can infer a few things from the behaviour and by inspecting the web part properties (of an exported XLV).</p>
<p>Firstly – why is the custom formatting still there, plus the web part title, chrome settings etc etc. Well I think we can confidentially assume that those particular properties of the web part are persisting. Looking at the <em>.webpart</em> file of an XLV we can find the corresponding properties and their values.</p>
<p>So where are the view settings defined in the properties. Well, I can only assume that this is in the property called <strong>XmlDefinition</strong>. Looking at this property we can see that it defines the CAML necessary for the view – plus it seems to reference an actual view on the list itself… </p>
<p>I found this <a href="http://stefan-stanev-sharepoint-blog.blogspot.com/2010/02/listviewwebpart-spview-two-sides-of.html" title="ListViewWebPart &#038; SPView – two sides of the same coin ">excellent post by Stefan Stanev</a> who goes into a great amount of detail explaining that when you add a list view web part to a page there is actually a view created on the list itself! The view is set to hidden and so you never know it’s there – but it’s fascinating that it exists.</p>
<p>Now we think we know that the XmlDefinition property is where an XLV gets its view settings from we should be able to use this to give an XLV a particular view which can be imported again and again right? Well, you’d think so… but unfortunately I haven’t been able to get it to work yet.</p>
<p>It feels like I’m tantalising close to working this out – but then hey, why should I have to? I can add an exported XLV into the gallery using a supported tool like SPD. When adding to a page this then appears to take on the view settings, only to have them lost on saving a page. That sounds like a bug to me!</p>
<h3>Workarounds</h3>
<p>The (only slightly) good news is that you can use <strong>SharePoint Designer</strong> to add a web part to the page and it <strong>will remember the view settings!</strong> Obviously there is something going on behind the scenes different to what happens when adding through the browser.</p>
<p>Another option is to set the default view on the list to be the same as your web part view &#8211; and then this will be the view used when adding the web part.</p>
<p>[This was done on SP2010 RMT – I haven’t looked at SP1 yet] </p>
]]></content:encoded>
			<wfw:commentRss>http://www.glynblogs.com/2011/07/xlv-bug-view-settings-lost-on-saved-xslt-list-view-web-part.html/feed</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Listing all web parts in a site collection with PowerShell</title>
		<link>http://www.glynblogs.com/2011/07/listing-all-web-parts-in-a-site-collection-with-powershell.html</link>
		<comments>http://www.glynblogs.com/2011/07/listing-all-web-parts-in-a-site-collection-with-powershell.html#comments</comments>
		<pubDate>Wed, 20 Jul 2011 18:41:01 +0000</pubDate>
		<dc:creator>Glyn Clough</dc:creator>
				<category><![CDATA[SharePoint 2010]]></category>
		<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://www.glynblogs.com/?p=614</guid>
		<description><![CDATA[<p>As our current project has progressed we’ve quite naturally ended up with many pages of content. This is good news and highlights the success of the project – however in a solution with development on-going there are times when it is difficult to stay on top of all the content.</p> <p>In particular if we’re interested <span style="color:#777"> . . . &#8594; Read More: <a href="http://www.glynblogs.com/2011/07/listing-all-web-parts-in-a-site-collection-with-powershell.html">Listing all web parts in a site collection with PowerShell</a></span>]]></description>
			<content:encoded><![CDATA[<p>As our current project has progressed we’ve quite naturally ended up with many pages of content. This is good news and highlights the success of the project – however in a solution with development on-going there are times when it is difficult to stay on top of all the content.</p>
<p>In particular if we’re interested in how a change to an existing piece of custom development may affect the users &#8211; or perhaps identifying where a configuration change may be required – it is a daunting prospect to have to go through the site by hand. Step forward PowerShell!<br />
<span id="more-614"></span><br />
The below script <strong>loops through all pages in a site collection</strong> that are in either a publishing site (i.e. in a ‘pages’ library) or in a non-publishing site (i.e. in a ‘site pages’ library). [It currently doesn’t check the root of sites for pages (e.g. default.aspx) but could be easily modified to do so.] When it finds a page, the script then <strong>finds all web parts on a page</strong>. After looping through all the pages in all the sites of a site collection the results are then displayed in a grid view.</p>
<p><a href="http://www.glynblogs.com/wp-content/uploads/2011/07/List-All-Web-Parts-Grid-View.png" rel="lightbox[614]"><img src="http://www.glynblogs.com/wp-content/uploads/2011/07/List-All-Web-Parts-Grid-View-300x188.png" alt="List All Web Parts - Grid View" title="List All Web Parts - Grid View" width="300" height="188" class="alignnone size-medium wp-image-616" /></a></p>
<p>This can then be copied and pasted into Excel and manipulated as required. (Note: I&#8217;ve deliberately made the URL columns impossible to read here!)</p>
<p>To use the script, either copy the contents into the <strong>Windows PowerShell Integrated Script Editor</strong> (ISE) and run from there, or save locally as a .ps1 and run directly from PowerShell. Don&#8217;t forget to update the URL at the bottom of the script!</p>
<pre class="brush: powershell; title: ;">
cls

# Add SharePoint cmdlets reference
Add-PSSnapin microsoft.sharepoint.powershell -ErrorAction SilentlyContinue 

function enumerateWebParts($Url) {
    $site = new-object Microsoft.SharePoint.SPSite $Url 

    foreach($web in $site.AllWebs) {
        if ([Microsoft.SharePoint.Publishing.PublishingWeb]::IsPublishingWeb($web)) {
            $pWeb = [Microsoft.SharePoint.Publishing.PublishingWeb]::GetPublishingWeb($web)
            $pages = $pWeb.PagesList

            Write-Host &quot;Processing Web:&quot; $pWeb.Url &quot;...&quot; -ForegroundColor Magenta

            foreach ($item in $pages.Items) {
                $fileUrl = $webUrl + &quot;/&quot; + $item.File.Url
                Write-Host &quot;   &quot; $fileUrl -ForegroundColor Green
                $manager = $item.file.GetLimitedWebPartManager([System.Web.UI.WebControls.Webparts.PersonalizationScope]::Shared);
                $wps = $manager.webparts
                $wps | select-object @{Expression={$pWeb.Url};Label=&quot;Web URL&quot;},@{Expression={$fileUrl};Label=&quot;Page URL&quot;}, DisplayTitle, IsVisible, @{Expression={$_.GetType().ToString()};Label=&quot;Type&quot;}
            }
        }
        else {
            Write-Host &quot;   Not a publishing web:&quot; $web.Url&quot;. Looking for Site Pages library.&quot; -ForegroundColor Magenta
            $pages = $null
            $pages = $web.Lists[&quot;Site Pages&quot;]

            if ($pages) {
                Write-Host &quot;   &quot; $pages.Title &quot;found.&quot; -ForegroundColor Green

                foreach ($item in $pages.Items) {
                    $fileUrl = $webUrl + &quot;/&quot; + $item.File.Url
                    $manager = $item.file.GetLimitedWebPartManager([System.Web.UI.WebControls.Webparts.PersonalizationScope]::Shared);
                    $wps = $manager.webparts
                    $wps | select-object @{Expression={$pWeb.Url};Label=&quot;Web URL&quot;},@{Expression={$fileUrl};Label=&quot;Page URL&quot;}, DisplayTitle, IsVisible, @{Expression={$_.GetType().ToString()};Label=&quot;Type&quot;}
                }
            }
            else {
                Write-Host &quot;    Site Pages library not found.&quot; -ForegroundColor Red
            }
        }

        Write-Host &quot;... completed processing&quot; $web &quot;...&quot; -ForegroundColor Magenta
    }
}

$row = enumerateWebParts('http://mysitecollection')
$row | Out-GridView
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.glynblogs.com/2011/07/listing-all-web-parts-in-a-site-collection-with-powershell.html/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>
