<?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>Inspired By Technology</title>
	<atom:link href="http://www.inspiredbytechnology.com/index.php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.inspiredbytechnology.com</link>
	<description>Sharing Knowledge</description>
	<lastBuildDate>Mon, 08 Aug 2011 17:28:11 +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>XSLT How To: Reordering and Alternate Styling based on Position</title>
		<link>http://www.inspiredbytechnology.com/index.php/2011/08/08/xslt-how-to-reordering-and-alternate-styling-based-on-position/</link>
		<comments>http://www.inspiredbytechnology.com/index.php/2011/08/08/xslt-how-to-reordering-and-alternate-styling-based-on-position/#comments</comments>
		<pubDate>Mon, 08 Aug 2011 16:59:32 +0000</pubDate>
		<dc:creator>Dave Yules</dc:creator>
				<category><![CDATA[XML/XSLT]]></category>
		<category><![CDATA[<xsl:choose]]></category>
		<category><![CDATA[<xsl:if]]></category>
		<category><![CDATA[<xsl:sort]]></category>
		<category><![CDATA[case]]></category>
		<category><![CDATA[Developer]]></category>
		<category><![CDATA[switch]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[xsl]]></category>

		<guid isPermaLink="false">http://www.inspiredbytechnology.com/?p=1025776365</guid>
		<description><![CDATA[While XSLT is fantastic for organizing and styling XML, when it comes to manipulating the sequence of the information in a way other than basic sorting, it sort of comes up short. Specifically, it seems there isn’t a prepackaged way to grab an item, then simultaneously place it higher in the list and remove it from its original location. This simply cannot be accomplished with the <xsl:sort> element.]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-1025776368" src="http://www.inspiredbytechnology.com/wp-content/uploads/2011/08/xsl.png" alt="" width="100" height="100" />While XSLT is fantastic for organizing and styling XML, when it comes to manipulating the sequence of the information in a way other than basic sorting, it <em>sort</em> of comes up short. Specifically, it seems there isn’t a prepackaged way to grab an item, then simultaneously place it higher in the list and remove it from its original location. This simply cannot be accomplished with the &lt;xsl:sort&gt; element. On top of this, I needed to implement alternate styling, which is easy, except for the point where removing one element causes the alternate styling to at some point become the opposite of what was intended.</p>
<h3>The Answer …Well, not yet.</h3>
<p>While it&#8217;s not the most efficient way to query and arrange the provided XML, I seemingly had no choice but to use multiple &lt;xsl:for-each&gt; statements on the same information. It did however provide the functionality I needed. Only problem was, my alternating style is based on the position() attribute:</p>
<p>&lt;xsl:when test=&#8221;position() mod 2 = 0&#8243;&gt;</p>
<p>So this all worked fine until the point where I filter out a specific entry. Unfortunately, this does not change the position() of each succeeding entry. I was left with both entries on either side of an entry that was filtered out having the same style. This was not what I was looking for, so I had to implement a switch-case to determine which alternating style to apply based on whether the filtered entry had been reached. So I implemented a global parameter that gets the position() of the entry to be moved, then implemented a switch-case that detects whether or not that entry has been reached. It looks like this:</p>
<h3>The Actual Answer</h3>
<h5>First, establish the position of said entry:</h5>
<pre>&lt;xsl:param name=<span style="color: #000080;">"<span style="color: #3366ff;">PersonID</span></span>" select="<span style="color: #3366ff;">9999</span>" /&gt;
&lt;xsl:param name="<span style="color: #3366ff;">PersonLocation</span>"&gt;
&lt;xsl:for-each select="<span style="color: #3366ff;">Root/PersonProfile</span>"&gt;
&lt;xsl:if test="<span style="color: #3366ff;">ID=$PersonID</span>"&gt;
&lt;xsl:value-of select="<span style="color: #3366ff;">position()</span>" /&gt;
&lt;/xsl:if&gt;
&lt;/xsl:for-each&gt;
&lt;/xsl:param&gt;</pre>
<p><span class="Apple-style-span" style="font-size: 17px; font-weight: bold; line-height: normal;">Then pick it out and display it wherever you please:</span></p>
<pre>&lt;xsl:for-each select="<span style="color: #3366ff;">Root/PersonProfile</span>"&gt;

&lt;xsl:if test="<span style="color: #3366ff;">position() = $PersonLocation</span>"&gt;

Style the entry here…

&lt;/xsl:if&gt;

&lt;/xsl:for-each&gt;</pre>
<p><span class="Apple-style-span" style="font-size: 17px; font-weight: bold; line-height: normal;">Now, restrict that entry, check whether the current entry is above or below it, and apply the appropriate styling:</span></p>
<pre>&lt;xsl:for-each select="<span style="color: #3366ff;">Root/UserProfile</span>"&gt;

&lt;xsl:if test="<span style="color: #3366ff;">position() != $PersonLocation</span>"&gt;

&lt;xsl:if test="<span style="color: #3366ff;">position() &amp;lt; $PersonLocation</span>"&gt;

&lt;xsl:choose&gt;

&lt;xsl:when test="<span style="color: #3366ff;">position() mod 2 = 0</span>"&gt;</pre>
<p>Style 1 here…</p>
<pre>&lt;/xsl:when&gt;

&lt;xsl:otherwise&gt;</pre>
<p>Style 2 here…</p>
<pre>&lt;/xsl:otherwise&gt;

&lt;/xsl:choose&gt;

&lt;/xsl:if&gt;

&lt;xsl:if test="<span style="color: #3366ff;">position() &amp;gt; $PersonLocation</span>"&gt;

&lt;xsl:choose&gt;

&lt;xsl:when test="<span style="color: #3366ff;">position() mod 2 = 0</span>"&gt;</pre>
<p>Style 2 here…</p>
<pre>&lt;/xsl:when&gt;

&lt;xsl:otherwise&gt;</pre>
<p>Style 1 here…</p>
<pre>&lt;/xsl:otherwise&gt;

&lt;/xsl:choose&gt;

&lt;/xsl:if&gt;

&lt;/xsl:if&gt;

&lt;/xsl:for-each&gt;</pre>
<p>So there you have it. A workaround for manipulating an entry and applying alternate styling that will always display properly.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.inspiredbytechnology.com/index.php/2011/08/08/xslt-how-to-reordering-and-alternate-styling-based-on-position/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SharePoint 2010 &#8211; Creating a Content Query Web Part (CQWP) Link Target</title>
		<link>http://www.inspiredbytechnology.com/index.php/2011/07/14/sharepoint-2010-creating-a-content-query-web-part-cqwp-link-target/</link>
		<comments>http://www.inspiredbytechnology.com/index.php/2011/07/14/sharepoint-2010-creating-a-content-query-web-part-cqwp-link-target/#comments</comments>
		<pubDate>Thu, 14 Jul 2011 20:50:44 +0000</pubDate>
		<dc:creator>Jonathan Dack</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[MS SharePoint]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[XML/XSLT]]></category>
		<category><![CDATA[.Net]]></category>
		<category><![CDATA[Content Query Web Part]]></category>
		<category><![CDATA[CQWP]]></category>
		<category><![CDATA[Developer]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[SharePoint 2010]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.inspiredbytechnology.com/?p=1025776342</guid>
		<description><![CDATA[When you setup a CQWP and point to a Links List it allows you to define a few fields of data in the output: 'Title' and 'Link' (unless you have an image as part of your link). This is fine, however we also want to provide a target value. I'm sure there's way to hack at the webpart and do something creative with the XSL, however I've come up with a much simpler method using a calculated field.]]></description>
			<content:encoded><![CDATA[<p>The Content Query Web Part (CQWP) is a powerful feature in the SharePoint WebPart toolbox. You can use it to roll-up content from a variety of list sources and then display the content using some pre-set display options. You can even manipulate the XSL for the display to change the overall output.</p>
<p>One thing I noticed was missing when rolling up Link Lists, is the ability to define a target for the link. You can, of course, go into the XSL for the display output and hard-code target=&#8221;_blank&#8221;, however this results in an &#8216;all or nothing&#8217; situation. Instead I wanted to create a field in the Link List called &#8216;LinkTarget&#8217; and allow the users to choose whether the link should open in a new page or in the current window.</p>
<p>When you setup a CQWP and point to a Links List it allows you to define a few fields of data in the output: &#8216;Title&#8217; and &#8216;Link&#8217; (unless you have an image as part of your link). This is fine, however we also want to provide a target value. I&#8217;m sure there&#8217;s way to hack at the webpart and do something creative with the XSL, however I&#8217;ve come up with a much simpler method using a calculated field.</p>
<h3>Create Your List Fields</h3>
<p>In your Links List Settings create the following columns:</p>
<table>
<tbody>
<tr>
<td style="background-color: #c4e424; color: white; font-weight: bold;">Column Name</td>
<td style="background-color: #c4e424; color: white; font-weight: bold;">Column Type</td>
<td style="background-color: #c4e424; color: white; font-weight: bold;">Comments</td>
</tr>
<tr>
<td>DisplayGroup</td>
<td>Single Line of Text</td>
<td></td>
</tr>
<tr>
<td>DisplayName</td>
<td>Single Line of Text</td>
<td></td>
</tr>
<tr>
<td>LinkURL</td>
<td>Hyperlink</td>
<td>I renamed the standard URL field</td>
</tr>
<tr>
<td>LinkTarget</td>
<td>Choice</td>
<td>Choices should include _blank</td>
</tr>
<tr>
<td>NewTitle</td>
<td>Single Line of Text</td>
<td>=DisplayName&amp;&#8221;|&#8221;&amp;LinkTarget</td>
</tr>
</tbody>
</table>
<p>Now add your CQWP in a webpart page, setup the data sources and use the following presentation:</p>
<p><img class="alignnone size-full wp-image-1025776343" title="CQWP" src="http://www.inspiredbytechnology.com/wp-content/uploads/2011/07/CQWP.png" alt="CQWP" width="280" height="752" /></p>
<p>Now you need to open up SharePoint Designer and manipulate the ItemStyle.xsl. The file can be located here:</p>
<p><img class="alignnone size-full wp-image-1025776344" title="ItemStyle" src="http://www.inspiredbytechnology.com/wp-content/uploads/2011/07/ItemStyle.png" alt="ItemStyle" width="630" height="148" /></p>
<p>Once you have opened up the ItemStyle.xsl file, navigate to the template called &#8216;Bullets&#8217; and add the following custom code so that your end result will look like this:</p>
<pre>&lt;xsl:template name="Bullets" match="Row[@Style='Bullets']" mode="itemstyle"&gt;
        &lt;xsl:variable name="SafeLinkUrl"&gt;
            &lt;xsl:call-template name="OuterTemplate.GetSafeLink"&gt;
                &lt;xsl:with-param name="UrlColumnName" select="'LinkUrl'"/&gt;
            &lt;/xsl:call-template&gt;
        &lt;/xsl:variable&gt;
        &lt;xsl:variable name="DisplayTitle"&gt;
            &lt;xsl:call-template name="OuterTemplate.GetTitle"&gt;
                &lt;xsl:with-param name="Title" select="@Title"/&gt;
                &lt;xsl:with-param name="UrlColumnName" select="'LinkUrl'"/&gt;
            &lt;/xsl:call-template&gt;
        &lt;/xsl:variable&gt;
        <span style="background-color: #ffff00;">&lt;xsl:variable name="TargetText"&gt;&lt;xsl:value-of select="substring-after($DisplayTitle,'|')"/&gt; &lt;/xsl:variable&gt;</span>
        &lt;div class="item link-item bullet"&gt;
            &lt;xsl:call-template name="OuterTemplate.CallPresenceStatusIconTemplate"/&gt;
            &lt;a href="{$SafeLinkUrl}" title="{@LinkToolTip}" <span style="background-color: #ffff00;">target="{$TargetText}"</span>&gt;
              &lt;xsl:if test="$ItemsHaveStreams = 'True'"&gt;
                &lt;xsl:attribute name="onclick"&gt;
                  &lt;xsl:value-of select="@OnClickForWebRendering"/&gt;
                &lt;/xsl:attribute&gt;
              &lt;/xsl:if&gt;
              &lt;xsl:if test="$ItemsHaveStreams != 'True' and @OpenInNewWindow = 'True'"&gt;
                &lt;xsl:attribute name="onclick"&gt;
                  &lt;xsl:value-of disable-output-escaping="yes" select="$OnClickTargetAttribute"/&gt;
                &lt;/xsl:attribute&gt;
              &lt;/xsl:if&gt;
              <span style="background-color: #ffff00;">&lt;xsl:value-of select="substring-before($DisplayTitle,'|')"/&gt; &lt;/a&gt;</span>
        &lt;/div&gt;
    &lt;/xsl:template&gt;</pre>
<p>Publish the ItemStyle.xsl and you&#8217;re all done. You now have bulleted links with the ability to control the link target.</p>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.inspiredbytechnology.com/index.php/2011/07/14/sharepoint-2010-creating-a-content-query-web-part-cqwp-link-target/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Customizing the SharePoint 2010 Welcome Menu (PersonalActions)</title>
		<link>http://www.inspiredbytechnology.com/index.php/2011/06/30/customizing-the-sharepoint-2010-welcome-menu-personalactions/</link>
		<comments>http://www.inspiredbytechnology.com/index.php/2011/06/30/customizing-the-sharepoint-2010-welcome-menu-personalactions/#comments</comments>
		<pubDate>Thu, 30 Jun 2011 14:04:44 +0000</pubDate>
		<dc:creator>Jonathan Dack</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[MS SharePoint]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[.Net]]></category>
		<category><![CDATA[Developer]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[SharePoint 2010]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.inspiredbytechnology.com/?p=1025776333</guid>
		<description><![CDATA[Creating a CustomAction is pretty easy, you just need to identify the GroupId and Location of the menu you wish to modify and then you're good to go. You even have a simple function called a URLAction where you can direct people to page when they click on your custom action. What isn't so obvious is if you actually wanted your application page to popup in a modal view. Here is the code I used to get this done.]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-1025776334" title="Feedback Control" src="http://www.inspiredbytechnology.com/wp-content/uploads/2011/06/feedbackImageDrop.png" alt="Feedback Control" width="259" height="231" />I support a SharePoint 2010 environment at my company and was recently asked to add an extra item to the welcome dropdown box (also know as the Personal Actions Menu) usually located at the top right of your SharePoint pages. This item was a feedback feature where users at any given location on the site could provide feedback, report a bug or add a general enhancement request.</p>
<p>I decided to store the data in a simple SharePoint list and implement a CustomAction Element using Visual Studio. I could have used a list view to manage the capture of the data, however I didn&#8217;t need all of the bells and whistles that came with one of those views and ultimatley created a custom application page with a form.</p>
<p>Creating a CustomAction is pretty easy, you just need to identify the GroupId and Location of the menu you wish to modify and then you&#8217;re good to go. You even have a simple function called a URLAction where you can direct people to a page when they click on your custom action. What isn&#8217;t so obvious is if you actually wanted your application page to popup in a modal view. Here is the code I used to get this done.</p>
<h3>The CustomAction</h3>
<p>Create a new blank SharePoint project in Visual Studio and then add a new &#8216;Empty Element&#8217; to your project (I called mine CustomActions). Open up the CustomActions file and you should see something like this:</p>
<p><span style="color: #0000ff;">&lt;?</span><span style="color: #800000;">xml</span> <span style="color: #ff0000;">version</span>=&#8221;<span style="color: #0000ff;">1.0</span>&#8221; <span style="color: #ff0000;">encoding</span><span style="color: #0000ff;">=</span>&#8220;<span style="color: #0000ff;">utf-8</span>&#8220;<span style="color: #0000ff;">?&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #800000;">Elements</span> <span style="color: #ff0000;">xmlns</span><span style="color: #0000ff;">=</span>&#8220;<span style="color: #0000ff;">http://schemas.microsoft.com/sharepoint/</span>&#8220;<span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #800000;">Elements</span><span style="color: #0000ff;">&gt;</span></p>
<p>Add the following so that your file now looks like this:</p>
<p><span style="color: #0000ff;">&lt;?</span><span style="color: #800000;">xml</span> <span style="color: #ff0000;">version</span><span style="color: #0000ff;">=</span>&#8220;<span style="color: #0000ff;">1.0</span>&#8221; <span style="color: #ff0000;">encoding</span><span style="color: #0000ff;"><span style="color: #ff0000;">=</span></span>&#8220;<span style="color: #0000ff;">utf-8</span>&#8220;<span style="color: #0000ff;">?&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #800000;">Elements</span> <span style="color: #ff0000;">xmlns</span><span style="color: #3366ff;">=</span>&#8220;<span style="color: #0000ff;">http://schemas.microsoft.com/sharepoint/</span>&#8220;<span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;</span><span style="color: #800000;">CustomAction</span> <span style="color: #ff0000;">Id</span><span style="color: #3366ff;">=</span>&#8220;<span style="color: #0000ff;">CustomGlobalLinks</span>&#8221;<br />
<span style="color: #ff0000;">ImageUrl</span><span style="color: #3366ff;">=</span>&#8220;<span style="color: #0000ff;">/Assets/FeatureLogo.png</span>&#8221;<br />
<span style="color: #ff0000;">Description</span><span style="color: #3366ff;">=</span>&#8220;<span style="color: #0000ff;">Provide feedback or Submit an Enhancement Request</span>&#8221;<br />
<span style="color: #ff0000;">Location</span><span style="color: #0000ff;">=</span>&#8220;<span style="color: #0000ff;">Microsoft.SharePoint.StandardMenu</span>&#8221;<br />
<span style="color: #ff0000;">GroupId</span><span style="color: #0000ff;">=</span>&#8220;<span style="color: #0000ff;">PersonalActions</span>&#8221;<br />
<span style="color: #ff0000;">Sequence</span><span style="color: #0000ff;">=</span>&#8220;<span style="color: #0000ff;">1001</span>&#8221;<br />
<span style="color: #ff0000;">Title</span><span style="color: #0000ff;">=</span>&#8220;<span style="color: #0000ff;">Feedback</span>&#8220;&gt;<br />
<span style="color: #0000ff;">&lt;</span><span style="color: #800000;">UrlAction</span> <span style="color: #ff0000;">Url</span><span style="color: #0000ff;">=</span>&#8220;<span style="color: #0000ff;">javascript:(function () { var o = { url:&#8217;/_layouts/CustomGlobalLinks/Feedback.aspx&#8217;, title: &#8216;Feedback&#8217;, allowMaximize: false, showClose: true, width: 480, height: 280 }; SP.UI.ModalDialog.showModalDialog(o); }) ();</span>&#8220;<span style="color: #0000ff;">/&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #800000;">CustomAction</span><span style="color: #0000ff;">&gt;</span><br />
<span style="color: #0000ff;">&lt;/</span><span style="color: #800000;">Elements</span><span style="color: #0000ff;">&gt;</span></p>
<p>Let&#8217;s break this down. The ImageUrl will give you a logo to the left of your Action on the menu; this is optional. The location refers to where you want to put your action and the GroupId refers to which group on the menu you want to add it too. I&#8217;ve used the PersonActions group.</p>
<p>I added some custom JavaScript to the URLAction which executes SP.UI.ModalDialog.showModalDialog and displays your application page in a modal. I actually found this script on another blog, however I can&#8217;t find it any more to give credit. I&#8217;ll certainly add the credit when I find it again.</p>
<h3>The Application Page</h3>
<p>Add a new Application Page to your project (I called mine Feedback). Add your controls (e.g. drop downs, text boxes etc.) and then hook them up to your feedback list (already created in your SharePoint environment).</p>
<p>On the submission of your form, you can close your modal by calling &#8216;window.frameElement.commitPopup();&#8217; Here is some quick code on pulling content from your SPList to popluate a dropdown and how to write back:</p>
<h4>Categories Dropdown</h4>
<p><span style="color: #008080;">SPList</span> FeedbackList;<br />
<span style="color: #008080;">SPSite</span> site = <span style="color: #008080;">SPContext</span>.Current.Site;<br />
&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;</p>
<p>FeedbackType.Items.Add(<span style="color: #ff0000;">&#8220;&#8211; SELECT &#8211;&#8221;</span>);<br />
<span style="color: #008080;">SPFieldChoice </span>cf = (<span style="color: #008080;">SPFieldChoice</span>)FeedbackList.Fields[<span style="color: #ff0000;">"Category"</span>];<br />
<span style="color: #3366ff;">foreach </span>(<span style="color: #3366ff;">string </span>type <span style="color: #3366ff;">in </span>cf.Choices)<br />
{<br />
FeedbackType.Items.Add(type);<br />
}<br />
FeedbackType.DataBind();</p>
<h4>Write back to the SPList</h4>
<p><span style="color: #008080;">SPWeb </span>web = site.RootWeb;<br />
<span style="color: #008080;">SPListItemCollection </span>ItemCollection = FeedbackList.Items;<br />
<span style="color: #008080;">SPListItem </span>ListItem = ItemCollection.Add();<br />
ListItem[<span style="color: #ff0000;">"Category"</span>] = FeedbackType.SelectedItem.Text;<br />
ListItem[<span style="color: #ff0000;">"Feedback"</span>] = FeedbackText.Text;<br />
ListItem.Update();<br />
successfulSubmit();</p>
<p><img class="alignnone size-full wp-image-1025776337" title="feedback Image" src="http://www.inspiredbytechnology.com/wp-content/uploads/2011/06/feedbackImage.png" alt="feedback Image" width="510" height="348" /></p>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.inspiredbytechnology.com/index.php/2011/06/30/customizing-the-sharepoint-2010-welcome-menu-personalactions/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Sharepoint Security: Minimum Rights Required to Check SPBasePermissions</title>
		<link>http://www.inspiredbytechnology.com/index.php/2011/06/15/sharepoint-security-minimum-rights-required-to-check-spbasepermissions/</link>
		<comments>http://www.inspiredbytechnology.com/index.php/2011/06/15/sharepoint-security-minimum-rights-required-to-check-spbasepermissions/#comments</comments>
		<pubDate>Wed, 15 Jun 2011 12:00:04 +0000</pubDate>
		<dc:creator>Dave Yules</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[MS SharePoint]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[.Net]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Secure Button]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[Sharepoint Security]]></category>
		<category><![CDATA[SPBasePermissions]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://www.inspiredbytechnology.com/?p=1025776324</guid>
		<description><![CDATA[Recently I was tasked with securing an ASP Button on our Sharepoint 2010 portal using C#. What we needed was to check and see if the SPContext.Current.User had specific rights to an SPList, then display the button if they did.]]></description>
			<content:encoded><![CDATA[<h3>Introduction</h3>
<p>Recently I was tasked with securing an ASP Button on our Sharepoint 2010 portal using C#. What we needed was to check and see if the <span style="color: #339966">SPContext</span>.Current.User had specific rights to an SPList, then display the button if they did.</p>
<h3>Getting There…</h3>
<p>Through some web-scouring I was able to gather the following line of code:</p>
<p><span style="color: #3366ff">bool </span>HasPermission = (YourSPList.EffectiveBasePermissions &amp; <span style="color: #339966">SPBasePermissions</span>.<span style="color: #00ccff">ViewFormPages</span>) != 0;</p>
<p>This code returns true if the user has rights to <em>View Application Pages</em>. You can check against many other rights; there’s a list of <span style="color: #339966">SPBasePermissions </span>here: <a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spbasepermissions.aspx">http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spbasepermissions.aspx</a></p>
<h3>The Brick Wall</h3>
<p>This was all going quite well until I deployed the control to our portal. After implementing the control, when I tried to visit the page as a user who didn’t have any rights to the list, I received an access denied screen. This was not the desired effect.</p>
<p>Once again I was scouring the internet, trying to better understand not only the rights that can be assigned to an SPList, but also the minimum level of rights to check permissions. Unfortunately, the only answer I could find was that a user had to have “Read” rights to the SPList. This is unacceptable for our situation because the content of these lists can be confidential.</p>
<h3>The Answer</h3>
<p>It’s quite simple. Create a custom permission level on your site, with <strong>Open</strong> as the only right assigned. Once you’ve assigned this permission level to users, they can check their permissions against the SPList programmatically. Aside from that, they’ll never know it was even there.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.inspiredbytechnology.com/index.php/2011/06/15/sharepoint-security-minimum-rights-required-to-check-spbasepermissions/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Adding an &#8216;Up Folder&#8217; button to a SharePoint 2010 List View Webpart</title>
		<link>http://www.inspiredbytechnology.com/index.php/2011/06/06/adding-an-up-folder-button-to-a-sharepoint-2010-list-view-webpart/</link>
		<comments>http://www.inspiredbytechnology.com/index.php/2011/06/06/adding-an-up-folder-button-to-a-sharepoint-2010-list-view-webpart/#comments</comments>
		<pubDate>Mon, 06 Jun 2011 12:30:54 +0000</pubDate>
		<dc:creator>Jonathan Dack</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[MS SharePoint]]></category>
		<category><![CDATA[.Net]]></category>
		<category><![CDATA[Developer]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[SharePoint 2010]]></category>
		<category><![CDATA[Up Folder]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[XSLTListViewWebPart]]></category>

		<guid isPermaLink="false">http://www.inspiredbytechnology.com/?p=1025776312</guid>
		<description><![CDATA[Why oh why did Microsoft remove the button to navigate up within a SharePoint 2010 document library? Luckily someone took action on this issue back in 2008 when they noticed it was mising from SharePoint 2007 however their code is only applicable to SharePoint 2007. Here is a 2010 Version.]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-1025776313" title="Folder Up" src="http://www.inspiredbytechnology.com/wp-content/uploads/2011/06/FolderUp.png" alt="Folder Up" width="128" height="128" />Why oh why did Microsoft remove the button to navigate up from within the document library? In their wisdom Microsoft decided to put this control in the ribbon of a list, however what if you are displaying a document library through the SharePoint List View Webpart (or the XSLTListViewWebPart)? Luckily someone took action on this issue back in 2008 when they noticed it was mising from SharePoint 2007. They have written a very good blog post on the subject, however it is only applicable to SharePoint 2007 <a href="http://blog.thekid.me.uk/archive/2008/11/03/adding-an-up-folder-button-to-a-sharepoint-list-view-webpart.aspx">http://blog.thekid.me.uk/archive/2008/11/03/adding-an-up-folder-button-to-a-sharepoint-list-view-webpart.aspx</a>.</p>
<p>Leading on from this code I decided to take a stab at a SharePoint 2010 version. There are some differences, including the fact that we are now using an XSLTListViewWebPart and not a ListViewWebPart. In addition, some work was needed to hide the navigation button when you hit the root of the document library. I also created the code in the new SharePoint 2010 standard, using a Feature with a CustomAction pointing to a User Control. The end result looks like this:</p>
<p><span style="text-decoration: underline;"><strong>Library Root</strong></span> </p>
<p><strong><a href="http://www.inspiredbytechnology.com/wp-content/uploads/2011/06/NavigateUp_Root.png"><img class="size-full wp-image-1025776314 alignnone" title="Navigate Up Root" src="http://www.inspiredbytechnology.com/wp-content/uploads/2011/06/NavigateUp_Root.png" alt="Navigate Up Root" width="753" height="160" /></a></strong></p>
<p><span style="text-decoration: underline;"><strong>In a Folder</strong></span></p>
<p><span style="text-decoration: underline;"><strong><img class="alignnone size-full wp-image-1025776315" title="Navigate Up Folder" src="http://www.inspiredbytechnology.com/wp-content/uploads/2011/06/NavigateUp_Folder.png" alt="Navigate Up Folder" width="751" height="160" /></strong></span></p>
<p>Rather than list out a stream of code, I&#8217;ve uploaded the WSP package for you to use. <a title="SharePoint 2010 Up Folder" href="http://www.dacksolutions.com/downloads/Dack.NavigateUpToolbar.zip" target="_blank">You can download this here</a></p>
<p>Once you have added the solution to your farm, you will need to deploy it via Central Admin and then activate the feature in the relevant site collection.</p>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.inspiredbytechnology.com/index.php/2011/06/06/adding-an-up-folder-button-to-a-sharepoint-2010-list-view-webpart/feed/</wfw:commentRss>
		<slash:comments>21</slash:comments>
		</item>
		<item>
		<title>How a Learning Management System can be part of a KM Portal Strategy</title>
		<link>http://www.inspiredbytechnology.com/index.php/2011/05/17/how-a-learning-management-system-can-be-part-of-a-km-portal-strategy/</link>
		<comments>http://www.inspiredbytechnology.com/index.php/2011/05/17/how-a-learning-management-system-can-be-part-of-a-km-portal-strategy/#comments</comments>
		<pubDate>Tue, 17 May 2011 12:30:57 +0000</pubDate>
		<dc:creator>Jonathan Dack</dc:creator>
				<category><![CDATA[Knowledge Management]]></category>
		<category><![CDATA[MS SharePoint]]></category>
		<category><![CDATA[Education]]></category>
		<category><![CDATA[KM]]></category>
		<category><![CDATA[Learning Management System]]></category>
		<category><![CDATA[LMS]]></category>
		<category><![CDATA[Profiscience]]></category>
		<category><![CDATA[TutorPro]]></category>
		<category><![CDATA[UniversitySite]]></category>
		<category><![CDATA[viLMS]]></category>

		<guid isPermaLink="false">http://www.inspiredbytechnology.com/?p=1025776289</guid>
		<description><![CDATA[A KM initiative is about collecting experience, best practices and best work product in an effort to create a knowledge repository that individuals in an organization can utilize to make their lives more efficient and support their position at the organization. I believe this includes education offered by the organization.]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-1025776300" title="Training" src="http://www.inspiredbytechnology.com/wp-content/uploads/2011/05/training1.png" alt="Training" width="175" height="126" />A KM initiative is about collecting experience, best practices and best work product in an effort to create a knowledge repository that individuals in an organization can utilize to make their lives more efficient and support their position at the organization. I believe this includes education offered by the organization.</p>
<p>Too often you see education being offered in a variety of ways within the same organization. The IT department will have some form of training being offered and monitored by a home grown interface. Professional development will rely on a calendar and use some other method of tracking, whilst HR may look to the personnel system for assistance. As an individual, this makes it difficult to find what training options are available, and it is almost impossible to see if any training is offered which may be relevant to a particular project I&#8217;m currently working on.</p>
<p>This is where a centralized Learning Management System is beneficial. All departments in the organization will offer, track and report on training using the same tool. This will not only allow trainers to keep resources, scheduling and historical data in one place, but will also provide and single location for all training content offered to individuals seeking courses.</p>
<h3>So how does this fit into a KM Portal?</h3>
<p>Well, imagine an LMS exists which can be embedded into the same platform you are using for your KM Portal. If you are using SharePoint, such a product exists. Now imagine you have the LMS content indexed as part of your enterprise search implementation, and imagine you can break out the LMS content using SharePoint audiences and display content to users based on relevancy. You will end up with a KM portal which can also provide the following:</p>
<ul>
<li>If a user searches for a topic, they will not only get documents, Wiki articles and experience. They will now also get available training being offered on the subject, or past training resources.</li>
<li>If you had a department/practice specific page you can incorporate upcoming training courses relating to that group.</li>
<li>If you had a department/practice specific page you can incorporate recent training reviews from peers of that group.</li>
</ul>
<p>All of a sudden you have extended your search objects to include a new entity, &#8216;training&#8217;. Which is a valuable piece of knowledge being offered to an individual which is often overlooked or buried amongst the inefficiencies of a training management structure. If I&#8217;m searching for content relating to &#8216;healthcare litigation&#8217; in addition to documents, people, matters and articles on the topic, shouldn&#8217;t I also get potential webinars or training materials which might ultimately help me complete the project?</p>
<h3>Potential LMS vendors in the legal verticle</h3>
<ul>
<li>TutorEnterprise <em><a title="tutorpro" href="http://www.tutorpro.com" target="_blank">(from TutorPro)</a></em></li>
<li>UniversitySite <em><a title="profiscience" href="http://www.profiscience.com" target="_blank">(from Profiscience)</a></em></li>
<li>viEval <em><a title="viDesktop" href="http://www.videsktop.com" target="_blank">(from viDesktop)</a></em></li>
</ul>
<p>Although all of these products have their own set of pro&#8217;s and con&#8217;s, we found that UniversitySite offered the greatest flexibility in terms of SharePoint and enterprise search integration, as well as modular webparts which can be placed anywhere in a SharePoint environment and will offer up any piece of LMS content. We also liked the way that their architecture was similar to SharePoint 2010 in that they control their content using audiences. I understand that TutorPro will be following a similar model in a new release and may have a lot more potential in the SharePoint space.</p>
<p>I hope this was somewhat helpful to anyone considering a LMS product and trying to find ways to justify the cost. If you look at a LMS from the angle of KM, you may find an easier sell internally.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.inspiredbytechnology.com/index.php/2011/05/17/how-a-learning-management-system-can-be-part-of-a-km-portal-strategy/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Embedding a PDF Object in a SharePoint 2010 Web part using C#</title>
		<link>http://www.inspiredbytechnology.com/index.php/2011/03/31/embedding-a-pdf-object-in-a-sharepoint-2010-web-part-using-c/</link>
		<comments>http://www.inspiredbytechnology.com/index.php/2011/03/31/embedding-a-pdf-object-in-a-sharepoint-2010-web-part-using-c/#comments</comments>
		<pubDate>Thu, 31 Mar 2011 14:14:38 +0000</pubDate>
		<dc:creator>Dave Yules</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[MS SharePoint]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[.Net]]></category>
		<category><![CDATA[Adobe PDF]]></category>
		<category><![CDATA[Developer]]></category>
		<category><![CDATA[iFrame]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.inspiredbytechnology.com/?p=1025776248</guid>
		<description><![CDATA[Recently I was assigned the task of displaying a PDF in a SharePoint Web part. I figured it’d be easy enough to display it in an iframe or simply embed it on the page, but unfortunately my assumption couldn’t have been further from the truth.]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-thumbnail wp-image-1025776254" title="Adobe PDF" src="http://www.inspiredbytechnology.com/wp-content/uploads/2011/03/pdf_logo-150x150.png" alt="Adobe PDF" width="150" height="150" />Recently I was assigned the task of displaying a PDF in a SharePoint Web part. I figured it’d be easy enough to display it in an &lt;iframe&gt; or simply embed it on the page, but unfortunately my assumption couldn’t have been further from the truth.</p>
<h3>Attempting to load the PDF in an &lt;iframe&gt;</h3>
<p>Quite simply, and by default, SharePoint does not allow users to automatically open documents within a browser window. There is a setting on the web application called <em>Browser File Handling</em>, which if set to <em>Permissive </em>is supposed to allow documents to open within the browser. Alas, this setting does not afford the ability to view PDFs within the browser window. Also, within the Document Library, there’s a setting called <em>Opening Documents in the Browser</em>, which defaults to opening files within the browser anyway… So SharePoint is working against us.</p>
<h3>Using the &lt;embed /&gt; tag</h3>
<p>The &lt;embed /&gt; tag was deprecated for XHTML in favor of the &lt;object&gt; tag, so it’s not “supported” in Visual Studio. There is however a way around this; create a Literal control in C# and then write it to your page at run-time to avoid any compile errors. Upon assigning the src attribute, this strategy proves fruitful as it simply embeds the PDF in the window as desired. This is great, except for the fact that this strategy is completely invalid. I wanted to do one better.</p>
<h3>Using the &lt;object&gt; tag</h3>
<p>The &lt;object&gt; tag is a not only a valid XHTML control; it’s also supported in Visual Studio. Unfortunately, it requires a Class, ClassID, or ProgID attribute. I wasted hours scouring the web for this specific ClassID, and in the end, I could not locate it. This drove me to create a new strategy; a hybrid of the &lt;embed /&gt; and &lt;object&gt; strategies. This way I can ensure maximum browser support while doing my best to implement valid code.</p>
<p><span style="color: #339966;">//Create your URL to the pdf file, including path and URL variables</span><br />
<span style="color: #0000ff;">string </span>url = web.Url + <span style="color: #993300;">&#8220;/&#8221;</span> + <span style="color: #993300;">&#8220;DocumentLibrary&#8221;</span> + &#8220;/&#8221; + CurrentMonday.ToString(<span style="color: #993300;">&#8220;MM-dd-yyyy&#8221;</span>) + <span style="color: #993300;">&#8220;.pdf&#8221;</span> +<br />
<span style="color: #993300;">&#8220;#scrollbar=0&amp;statusbar=0&amp;navpanes=0&amp;toolbar=1&amp;zoom=75&#8243;</span>;<br />
<span style="color: #339966;">//Establish Literal control</span><br />
<span style="color: #33cccc;">Literal </span>l1 = <span style="color: #0000ff;">new </span><span style="color: #33cccc;">Literal</span>();<br />
<span style="color: #339966;">//Write the Object code to the Literal</span><br />
l1.Text = <span style="color: #993300;">&#8220;&lt;object id=&#8217;AcrobatFrame&#8217; type=&#8217;application/pdf&#8217; classid=&#8217;clsid:CA8A9780-280D-11CF-A24D-444553540000&#8242; width=&#8217;711&#8242; height=&#8217;956&#8242;&gt;&lt;param name=&#8217;src&#8217; value=&#8217;&#8221;</span> + url + <span style="color: #993300;">&#8220;&#8216; /&gt;&lt;a href=&#8217;&#8221;</span> + url + <span style="color: #993300;">&#8220;&#8216;&gt;Click here to download &#8220;</span> + CurrentMonday.ToString(<span style="color: #993300;">&#8220;MM-dd-yyyy&#8221;</span>) + <span style="color: #993300;">&#8220;.pdf&lt;/a&gt;&lt;/object&gt;&#8221;</span>;<br />
<span style="color: #339966;">//Add the Literal to the Page</span><br />
Panel.Controls.Add(l1);</p>
<h3>Acrobat URL variables</h3>
<p>In the code above you can see that I am passing URL variables to define what application components are visible and the zoom of the pdf. This way I can set a static height and width for the object because I know the size of the document will always be the same. <a title="Adobe Acrobat PDF URL Variables" href="http://partners.adobe.com/public/developer/en/acrobat/PDFOpenParameters.pdf" target="_blank">See a list of all URL variables</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.inspiredbytechnology.com/index.php/2011/03/31/embedding-a-pdf-object-in-a-sharepoint-2010-web-part-using-c/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>SharePoint 2010 Discussion Board Alternative</title>
		<link>http://www.inspiredbytechnology.com/index.php/2011/03/24/sharepoint-2010-discussion-board-alternative/</link>
		<comments>http://www.inspiredbytechnology.com/index.php/2011/03/24/sharepoint-2010-discussion-board-alternative/#comments</comments>
		<pubDate>Thu, 24 Mar 2011 13:12:20 +0000</pubDate>
		<dc:creator>Jonathan Dack</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Knowledge Management]]></category>
		<category><![CDATA[MS SharePoint]]></category>
		<category><![CDATA[.Net]]></category>
		<category><![CDATA[Discussion Board]]></category>
		<category><![CDATA[Forum]]></category>
		<category><![CDATA[KM]]></category>
		<category><![CDATA[SharePoint]]></category>

		<guid isPermaLink="false">http://www.inspiredbytechnology.com/?p=1025776203</guid>
		<description><![CDATA[An ongoing project of mine is to create a SharePoint portal for my company that not only supports the concepts of knowledge management, but also provides a framework to support business process management. The topic of a discussion board/forum actually crosses into both areas. Whilst there is a large component focused on internal collaboration, there is also a valuable process from a human resources perspective, on how to share that information throughout the organization.]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-1025776205" title="Speech Bubbles" src="http://www.inspiredbytechnology.com/wp-content/uploads/2011/03/Speech-Bubbles.png" alt="Discussion Board" width="184" height="114" />An ongoing project of mine is to create a SharePoint portal for my company that not only supports the concepts of knowledge management, but also provides a framework to support business process management. The topic of a discussion board/forum actually crosses into both areas. Whilst there is a large component focused on internal collaboration, there is also a valuable process from a human resources perspective, on how to share that information throughout the organization.</p>
<p>Ultimately I chose not to use the native &#8216;Discussion Board&#8217; feature in SharePoint, and here is why.</p>
<h3>Existing Process</h3>
<p>A process already existed in our old intranet whereby a user can subscribe to an internal distribution list to receive all discussion items. This is managed by having a dedicated mailbox with an auto-forward rule which sends all emails to the distribution list. This design allowed the mailbox to also be visible on the intranet.</p>
<h3>Problems with the Existing Process</h3>
<p>Yes it sort of works, however the big problem I have is the fact that the current process is an all or nothing approach, which can leave you feeling like your own company is spamming you on a daily basis. Not to mention the fact that there is email clogging up mailboxes. We also don&#8217;t have much control over content moderation. Although we want the discussion to be open, there are certain topics that should be moderated.</p>
<h3>The Requirements</h3>
<ul>
<li>Seperate discussion boards for each topic (e.g. Sport Tickets)</li>
<li>Each discussion board can have independant moderation controls</li>
<li>Users can subscribe to each discussion board by RSS or Email</li>
<li>The discussion board must user SharePoint user profiles and security</li>
<li>The discussion boards must be presented together in a forum like fashion</li>
<li>The presentation must be editable, including styles and layout</li>
</ul>
<h3>What can SharePoint offer me to support this?</h3>
<p>SharePoint does have discussion boards, however there is no easy way to lay them out for the user in a forum like fashion unless you build some custom webparts. The current SharePoint layout is:</p>
<ul>
<li>Discussion Board (e.g. Sport Tickets)
<ul>
<li>Discussion</li>
</ul>
</li>
</ul>
<p>Whereas we need:</p>
<ul>
<li>Rollup of Discussion Boards
<ul>
<li>Discussion Board (e.g. Sport Tickets)
<ul>
<li>Discussion</li>
</ul>
</li>
</ul>
</li>
</ul>
<h3>Solution</h3>
<p>I looked at a few options but finally settled on <a title="Social Squared" href="http://www.lightningtools.com/social-squared/default.aspx" target="_blank">Social Squared from Lightening Tools</a> as it was able to respond to all of our requirements listed above. Although their product data is not stored in SharePoint, the user interface is all webparts and is searchable from within the portal. In addition to all of the security, moderation and email controls we now have a nice user friendly interface for our users. This is not our custom example, however you get the idea of what is possible:</p>
<p><img class="alignnone size-full wp-image-1025776208" title="social-squared-forums" src="http://www.inspiredbytechnology.com/wp-content/uploads/2011/03/social-squared-forums.png" alt="social squared forums" width="548" height="304" /></p>
<p>In the end we now have a solution that not only is capable of providing the same functionality that the old solution provided (getting email blasts for every single topic), but also the flexibility for the user to subscribe to certain topics only.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.inspiredbytechnology.com/index.php/2011/03/24/sharepoint-2010-discussion-board-alternative/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Export Gridview to CSV in a SharePoint 2010 Webpart</title>
		<link>http://www.inspiredbytechnology.com/index.php/2011/03/09/export-gridview-to-csv-in-a-sharepoint-2010-webpart/</link>
		<comments>http://www.inspiredbytechnology.com/index.php/2011/03/09/export-gridview-to-csv-in-a-sharepoint-2010-webpart/#comments</comments>
		<pubDate>Wed, 09 Mar 2011 14:00:20 +0000</pubDate>
		<dc:creator>Jonathan Dack</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Knowledge Management]]></category>
		<category><![CDATA[MS SharePoint]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[.Net]]></category>
		<category><![CDATA[Developer]]></category>
		<category><![CDATA[Export to CSV]]></category>
		<category><![CDATA[Export to Excel]]></category>
		<category><![CDATA[KM]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.inspiredbytechnology.com/?p=1025776183</guid>
		<description><![CDATA[I was recently tasked with creating a Gridview in a SharePoint 2010 Webpart. In addition to assigning data to the Gridview, I also needed to create a way to export the data. The code to export to Excel was working, but with ugly user prompts. so I went with CSV. Here's the code...]]></description>
			<content:encoded><![CDATA[<p>I was recently tasked with creating a Gridview in a SharePoint 2010 Webpart. In addition to assigning data to the Gridview, I also needed to create a way to export the data. Typically you would go down the route of exporting to Excel so I looked at some code from another blogger <a href="http://mattberseth.com/blog/2007/04/export_gridview_to_excel_1.html">http://mattberseth.com/blog/2007/04/export_gridview_to_excel_1.html</a>. This worked, however Excel did not recognize the file format as the document is basically a text file. As a result the user would get an ugly prompt saying something like &#8220;cannot verify the file format, would you still like to open&#8221;. This was not acceptable. So I tried using the code from the blog mentioned above to create a CSV file, which opened with no error, although the document was not formatted with data correctly because a CSV is a comma delimited text file.</p>
<p>So I now know that I can overcome the Excel document open error with a CSV, I just need to create the code to do the export and here it is:</p>
<h4>Convert the contents of the GridView Cells from controls to text</h4>
<p><span style="color: #0000ff;">private string</span> getGridCellText(<span style="color: #008080;">TableCell</span> tc)<br />
{<br />
        <span style="color: #0000ff;">string</span> cellText = &#8220;&#8221;;<br />
        if (tc.HasControls())<br />
        {<br />
                <span style="color: #0000ff;">foreach</span> (<span style="color: #008080;">Control</span> c <span style="color: #0000ff;">in</span> tc.Controls)<br />
                {<br />
                       <span style="color: #0000ff;">if</span> (c.GetType() == <span style="color: #0000ff;">typeof</span>(<span style="color: #008080;">LinkButton</span>))<br />
                       {<br />
                              <span style="color: #008080;">LinkButton</span> lb = c <span style="color: #0000ff;">as</span> <span style="color: #008080;">LinkButton</span>;<br />
                              cellText = lb.Text;<br />
                        }<br />
                        <span style="color: #0000ff;">else if</span> (c.GetType() == <span style="color: #0000ff;">typeof</span>(<span style="color: #008080;">HyperLink</span>))<br />
                        {<br />
                               <span style="color: #008080;">HyperLink</span> h1 = c <span style="color: #0000ff;">as</span> <span style="color: #008080;">HyperLink</span>;<br />
                               cellText = h1.Text;<br />
                        }<br />
                }<br />
        }<br />
        <span style="color: #0000ff;">else</span><br />
        {<br />
                cellText = tc.Text;<br />
        }<br />
        <span style="color: #0000ff;">return</span> cellText;<br />
}</p>
<h4>Process the export request</h4>
<p><span style="color: #0000ff;">public void</span> exporttoExcel(<span style="color: #008080;">GridView</span> grv)<br />
{<br />
        <span style="color: #008080;">StringBuilder</span> sb = new <span style="color: #008080;">StringBuilder</span>();<br />
        <span style="color: #008080;">GridViewRow</span> grHeader = grv.HeaderRow;<br />
        <span style="color: #0000ff;">int</span> counter = 0;</p>
<p>        <span style="color: #0000ff;">foreach</span> (<span style="color: #008080;">TableCell</span> tc <span style="color: #0000ff;">in</span> grHeader.Cells)<br />
        {<br />
                sb.Append(<span style="color: #ff0000;">&#8220;\&#8221;" </span>+ grv.Columns[counter].HeaderText + <span style="color: #ff0000;">&#8220;\&#8221;,&#8221;</span>);<br />
                counter++;<br />
        }<br />
        sb.AppendLine();</p>
<p>        <span style="color: #0000ff;">foreach</span> (<span style="color: #008080;">GridViewRow</span> gr in grv.Rows)<br />
        {<br />
                <span style="color: #0000ff;">foreach</span> (<span style="color: #008080;">TableCell</span> tc <span style="color: #0000ff;">in</span> gr.Cells)<br />
                {<br />
                       sb.Append(<span style="color: #ff0000;">&#8220;\&#8221;"</span> + getGridCellText(tc) + <span style="color: #ff0000;">&#8220;\&#8221;,&#8221;</span>);<br />
                }<br />
                sb.AppendLine();<br />
        }</p>
<p>        Response.Clear();<br />
        Response.ClearHeaders();<br />
        Response.ClearContent();<br />
        Response.<span style="color: #888888;">AddHeader</span>(<span style="color: #ff0000;">&#8220;content-disposition&#8221;</span>, <span style="color: #ff0000;">&#8220;attachment; filename=Export.csv&#8221;</span>);<br />
        Response.ContentType = <span style="color: #ff0000;">&#8220;text/csv&#8221;</span>;<br />
        Response.AddHeader(<span style="color: #ff0000;">&#8220;Pragma&#8221;</span>, <span style="color: #ff0000;">&#8220;public&#8221;</span>);<br />
        Response.Write(sb.ToString());<br />
        Response.End();<br />
}</p>
<h4>Button click event</h4>
<p><span style="color: #0000ff;">public void</span> export(<span style="color: #0000ff;">object</span> sender, <span style="color: #008080;">EventArgs</span> e)<br />
{<br />
        exporttoExcel();<br />
}</p>
<h4>You now have the code to do your export and it should all work, however something went wrong! It only works once, and everything else on the page seems to be disabled.</h4>
<p>Apparantly, SharePoint updates some kind of timestamp hash on the form before it is actually submitted to the server. This is done in order to prevent the form from being submit more than once if the user clicks before the Postback is completed, which is a good thing &#8211; except when trying to do what we are trying to do here. To get past this you will need to also add the following JavaScript to the onClientClick event for your button:</p>
<p><span style="color: #0000ff;">function</span> postExport() {</p>
<p>       window.WebForm_OnSubmit = <span style="color: #0000ff;">function</span> ()<br />
       { <span style="color: #0000ff;">return true</span>; };<br />
}</p>
<p><span style="color: #ff0000;">OnClientClick</span><span style="color: #0000ff;">=&#8221;postExport()&#8221;</span></p>
<p>I hope this helps someone. Happy Coding!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.inspiredbytechnology.com/index.php/2011/03/09/export-gridview-to-csv-in-a-sharepoint-2010-webpart/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>KwizCom WiKi Plus for SharePoint 2010</title>
		<link>http://www.inspiredbytechnology.com/index.php/2011/02/25/kwizcom-wiki-plus-for-sharepoint-2010/</link>
		<comments>http://www.inspiredbytechnology.com/index.php/2011/02/25/kwizcom-wiki-plus-for-sharepoint-2010/#comments</comments>
		<pubDate>Fri, 25 Feb 2011 13:00:03 +0000</pubDate>
		<dc:creator>Jonathan Dack</dc:creator>
				<category><![CDATA[Knowledge Management]]></category>
		<category><![CDATA[MS SharePoint]]></category>
		<category><![CDATA[KM]]></category>
		<category><![CDATA[KwizCom]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[WiKi]]></category>

		<guid isPermaLink="false">http://www.inspiredbytechnology.com/?p=1025776140</guid>
		<description><![CDATA[I was recently tasked with looking into the WiKi capabilities of SharePoint 2010 in support of department/practice group level WiKi's which need to be searchable via our Enterprise Search Engine.]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-1025776170" title="WiKi Plus" src="http://www.inspiredbytechnology.com/wp-content/uploads/2011/02/wiki_plus.png" alt="WiKi Plus" width="128" height="128" />I was recently tasked with looking into the WiKi capabilities of SharePoint 2010 in support of department/practice group level WiKi&#8217;s which need to be searchable via our Enterprise Search Engine. I was a little shocked to see that although Microsoft had created the foundation for this functionality, It lacked a lot of features and flexibility. In addition, you needed the Enterprise Edition of SharePoint 2010 to create a new WiKi site, and I wasn&#8217;t about to spend tens of thousands on that license for a WiKi feature (we have no other need for Enterprise Edition at this time and only have the Standard Edition). I was therefore forced to look at alternative options.</p>
<p>I reached out to a bunch of peers through the <a title="ILTA" href="http://www.iltanet.org" target="_blank">ILTA</a> organization and received suggestions to look at the following products:</p>
<ul>
<li><a title="Confluence" href="http://www.atlassian.com/software/confluence" target="_blank">Confluence</a> <em>by Atlassian</em></li>
<li><a title="Media WiKi" href="http://www.mediawiki.org" target="_blank">Media WiKi</a> <em>Open Source</em></li>
<li><a title="PBWorks" href="http://www.pbworks.com" target="_blank">PBWorks</a> <em>by PBwiki, Inc</em></li>
<li><a title="WiKi Plus" href="http://www.kwizcom.com/sharepoint-add-ons/sharepoint-wiki-plus/overview" target="_blank">WiKi Plus</a> <em>by KWizcom</em></li>
</ul>
<p><strong>I had two required features which would be a deal-breaker if not met by a solution:</strong></p>
<ol>
<li>It had to be integrated with SharePoint 2010</li>
<li>It needed to store its data within the SharePoint architecture to allow for my enterprise search engine to find the content (I didn&#8217;t feel like paying to have a custom connector built)</li>
</ol>
<table>
<tbody>
<tr>
<td style="background-color: transparent; border-left: 0; border-top: 0;"></td>
<td style="background-color: #c4e424; color: white; font-weight: bold;">Integrates with SharePoint</td>
<td style="background-color: #c4e424; color: white; font-weight: bold;">Stores Data in SharePoint</td>
<td style="background-color: #c4e424; color: white; font-weight: bold;">Architecture</td>
</tr>
<tr>
<td style="background-color: #c4e424; color: white; font-weight: bold;">Confluence</td>
<td>Some functionality via Web Parts</td>
<td>No</td>
<td>Java, MySQL, ProstgreSQL</td>
</tr>
<tr>
<td style="background-color: #c4e424; color: white; font-weight: bold;">Media WiKi</td>
<td>Not out of the box.</td>
<td>No</td>
<td>PHP, MySQL, ProstgreSQL</td>
</tr>
<tr>
<td style="background-color: #c4e424; color: white; font-weight: bold;">PBWorks</td>
<td>Not out of the box.</td>
<td>No</td>
<td>Hosted Solutions</td>
</tr>
<tr>
<td style="background-color: #c4e424; color: white; font-weight: bold;">WiKi Plus</td>
<td>Yes, fully integrated</td>
<td>Yes</td>
<td>Built into SharePoint 2010</td>
</tr>
</tbody>
</table>
<p>All of the products offer great features, some better than others. However only one met my minimum requirements which was WiKi Plus from KWizCom. Here is a quick review of their product:</p>
<h4>Key Wiki Plus Features Not Included with SharePoint 2010</h4>
<ul>
<li>Page Cloning</li>
<li>Export to MS Word or PDF</li>
<li>WiKi Page Printing</li>
<li>Automatic Table of Contents</li>
<li>MS Visio Support</li>
<li>Copy/Paste Images</li>
<li>Copy/Paste from MS Word (Retaining Styles)</li>
<li>Advanced User Level Reporting</li>
</ul>
<p>KWizCom put a nice document together outlining what they add to an &#8220;out of the box&#8221; SharePoint 2010 Wiki. <a href="http://www.inspiredbytechnology.com/wp-content/uploads/2011/02/kwizcom_WikiPlus_vs_sharepoint_2010.pdf" target="_blank">KWizcom_WikiPlus_vs_sharepoint_2010</a>.</p>
<h4>Installation (SharePoint 2010)</h4>
<p>At the moment, the installation isn&#8217;t great. They have an executable for SharePoint 2007, however with 2010 you need to manually install and deploy a variety of WSP packages. One of which will not deploy via command shell, so you need to do this using Central Admin. After 3 attempts I finally got the product up and running. Hopefully they can do something to fix this in the future.</p>
<h4>Storage</h4>
<p>When you create a new WiKi Plus site it creates a bunch of SharePoint libraries to store the data. This means that whether you are using SharePoint Search or another product to search SharePoint, your content is fully indexed. Exactly what I needed.</p>
<h4>Security</h4>
<p>Unlike some organizations, security is less of an obstacle. Out strategy is to deploy multiple WiKis (one for each department and practice group) and allow for content to be editable by any member of those teams. The rest of the firm will have read-only access. WiKi Plus utilizes SharePoint security to manage access, and you can use pre-defined groups or create new ones.</p>
<h4>Adding Content</h4>
<p>I was in a meeting with one of our Department Directors talking about the concept of using a WiKi to manage the way they communicate procedures and processes to the firm and I was able to bring up my test environment of WiKi Plus in SharePoint. She was very impressed by how easy it was to create new content and have that content instantly available through either search, WiKi navigation or a Tag Cloud. WiKi Plus also supports templates, which can be used to create a new page with a pre-defined layout, as well as changing the layout when your editing the page.</p>
<p>I&#8217;ll still continue to play around with KWizCom&#8217;s WiKi plus, however it seems to have all of the main features i&#8217;m looking for. I Haven&#8217;t tried out the notification features yet, but I should test those soon and i&#8217;ll add my findings to this post.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.inspiredbytechnology.com/index.php/2011/02/25/kwizcom-wiki-plus-for-sharepoint-2010/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

