<?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>BinaryJam</title>
	<atom:link href="http://www.binaryjam.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.binaryjam.com</link>
	<description>A place for Sharepoint and rantings</description>
	<lastBuildDate>Tue, 31 Jan 2012 14:42:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>CEWP &#8211; Making Use of Coin Slider II &#8211; SPServices Version</title>
		<link>http://www.binaryjam.com/2012/01/31/cewp-making-use-of-coin-slider-ii-spservices-version/</link>
		<comments>http://www.binaryjam.com/2012/01/31/cewp-making-use-of-coin-slider-ii-spservices-version/#comments</comments>
		<pubDate>Tue, 31 Jan 2012 14:42:09 +0000</pubDate>
		<dc:creator>Binaryjam</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.binaryjam.com/?p=647</guid>
		<description><![CDATA[Part II of the blog posts now, adding a quick tweak to auto populate the images from an ImageLibrary. In the last post we created all the elements needed for this next piece, if you have that working then great. First a couple of things Get the latest SPServices version be sure to match the [...]]]></description>
			<content:encoded><![CDATA[<p>Part II of the blog posts now, adding a quick tweak to auto populate the images from an ImageLibrary.</p>
<p>In the last post we created all the elements needed for this next piece, if you have that working then great.</p>
<p>First a couple of things</p>
<p>Get the latest SPServices version be sure to match the versions correctly especially where jQuery 1.7 and SPServices versions are concerned, changes in jQuery caused some problems in peoples libraries.&nbsp; Put that library in the place you like to store them (_layouts, portal root, site collection, doc lib which ever I stuck it in my SPFolder in the site collection)</p>
<p>Add a new field to your Image Library, a checkbox and call it active.</p>
<p>Paste this code (after you modify the include statements to point at the places you stored them).</p>
<p>&nbsp;</p>
<p>I haven&#8217;t put any error trapping in this code or loading pictures or messages to say activate at least one image you idiot but you can and I would if this was going on a real site.  You could extend this code to get descriptions from the image library and if there was one add it to the slider text.</p>
<p>&nbsp;</p>
<p> <br/>
<pre>
<pre class="brush: plain; title: ; notranslate">

&lt;link rel=&quot;stylesheet&quot; href=&quot;/sites/SliderDemo/jQueryExtras/coin-slider-styles.css&quot;&gt;
&lt;script src=&quot;/sites/SliderDemo/jQueryExtras/coin-slider.min.js&quot;&gt;&lt;/script&gt;
&lt;script src=&quot;/sites/SliderDemo/jQueryExtras/jquery.SPServices-0.7.0.min.js&quot;&gt;&lt;/script&gt;

&lt;div id=&quot;gamesHolder&quot; style=&quot;width:468px; height:280px; overflow-y:hidden&quot;&gt;
    &lt;div id=&quot;games&quot;&gt;
    &lt;/div&gt;
&lt;/div&gt;

&lt;script&gt;jQuery(function($) {

    $().SPServices(
       {
         operation: &quot;GetListItems&quot;,
         async: true,
         listName: &quot;ImageLibrary&quot;,
         CAMLQuery : &quot;&lt;Query&gt;&lt;Where&gt;&lt;Eq&gt;&lt;FieldRef Name='active' /&gt;&lt;Value Type='Boolean'&gt;1&lt;/Value&gt;&lt;/Eq&gt;&lt;/Where&gt;&lt;/Query&gt;&quot;,
         CAMLViewFields: &quot;&lt;ViewFields&gt;&lt;FieldRef Name='Title' /&gt;&lt;FieldRef Name='ows_FileRef' /&gt;&lt;/ViewFields&gt;&quot;,
         completefunc: function(data)
           {
                var theMiddle=&quot;&quot;;
                $(data.responseXML).find(&quot;z\\:row, row&quot;).each(function(){
                    var getimage= &quot;/&quot; + $(this).attr(&quot;ows_FileRef&quot;).substring( $(this).attr(&quot;ows_FileRef&quot;).indexOf(&quot;#&quot;) +1 );

                    theMiddle +='&lt;a href=&quot;' + getimage + '&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;' + getimage + '&quot; alt=&quot;' + $(this).attr(&quot;Title&quot;) + '&quot; /&gt;&lt;/a&gt;';

                });

                $(theMiddle).appendTo('#games');
                $('#games').coinslider({ hoverPause: false, height:246, width:618});

            }
       }
    ); 

});
&lt;/script&gt;
</pre>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.binaryjam.com/2012/01/31/cewp-making-use-of-coin-slider-ii-spservices-version/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CEWP &#8211; Making use of Coin Slider jQuery</title>
		<link>http://www.binaryjam.com/2012/01/31/cewp-making-use-of-coin-slider-jquery/</link>
		<comments>http://www.binaryjam.com/2012/01/31/cewp-making-use-of-coin-slider-jquery/#comments</comments>
		<pubDate>Tue, 31 Jan 2012 09:03:55 +0000</pubDate>
		<dc:creator>Binaryjam</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.binaryjam.com/?p=637</guid>
		<description><![CDATA[This post is how to use a small jQuery library within a CEWP to provide sliders. First some pre-reqs. Download jQuery (latest) and Coin Slider jQuery plugin. Place the jQuery library in a Choose one. SPFolder _layouts Document Library Any old web you have access to &#160; You need to choose a location, I prefer [...]]]></description>
			<content:encoded><![CDATA[<p>This post is how to use a small jQuery library within a CEWP to provide sliders.</p>
<p>First some pre-reqs.</p>
<p>Download <a href="http://jquery.com/" target="_blank">jQuery</a> (latest) and <a href="http://workshop.rs/projects/coin-slider/" target="_blank">Coin Slider</a> jQuery plugin.</p>
<p>Place the jQuery library in a </p>
<blockquote><p>Choose one.</p>
<ul>
<li>SPFolder
<li>_layouts
<li>Document Library
<li>Any old web you have access to </li>
</ul>
</blockquote>
<p>&nbsp;</p>
<p>You need to choose a location, I prefer master pages and putting things in _Layout, but if you dont have access to the server then you could utilise SharePoint Designer to create a folder in a site collection, again here I prefer the top top top&nbsp; level Site Collection so that anywhere I use this the same js files come from the same place and get cached.</p>
<p>Place the CoinSlider CSS and JS files either in the same location (not master page though) or perhaps in the local site collection you are about to create this content in.</p>
<p>In my Code example I have already a jQuery in my masterpage, so I dont load it again.&nbsp; I put the other files in an SPFolder in the site collection call jQueryExtras, you can reference them&nbsp; from where you put them.</p>
<p>&nbsp;</p>
<p>Next you need an Image Library, just create one somewhere, ideally unique for the content you are to display, as later on I might get to publish the next article that loads the images using SPServices, but then I might not.</p>
<p>In this image library place the images you want to slide, these should ideally be &#8220;landscape&#8221; style better still CinemaScope style. Those long thin pictures just work better in sliders. All these images MUST be the same size.</p>
<p>I used images from another sliders content (the nivo slider which I struggled to get to work, it was just easier than trying to find content) you could use images from your own stock or the demo just remember to change the image sizes in the right places (css/js).</p>
<p>Now that you have your JS and CSS includes in your locations and your image library populated with images we can create a CEWP, so on the page you want this go create one and hit the EDIT Source Editor</p>
<p>&nbsp;</p>
<p> Paste this lot in, it is important that you <b>set the height and width</b> in the javascript to match your images, if you don&#8217;t expect lots of formatting issues.  I tried this on MOSS and in IE7+ it wornt work in IE6, which is a pain for me as I have to find another slider now. <br/>
<pre>
<pre class="brush: plain; title: ; notranslate"> &lt;link rel=&quot;stylesheet&quot; href=&quot;/sites/SliderDemo/jQueryExtras/coin-slider-styles.css&quot;&gt;
&lt;script src=&quot;/sites/SliderDemo/jQueryExtras/coin-slider.min.js&quot;&gt;&lt;/script&gt;

&lt;div id=&quot;gamesHolder&quot;&gt;
    &lt;div id=&quot;games&quot;&gt;
       &lt;a href=&quot;http://www.binaryjam.com/&quot; target=&quot;_blank&quot;&gt;
          &lt;img alt=&quot;Wall-E&quot; src=&quot;/sites/SliderDemo/SliderImages/walle.jpg&quot;&gt;
          &lt;span&gt;&lt;b&gt;Wall-E&lt;/b&gt;&lt;br&gt;A Film about a robot. &lt;/span&gt;
       &lt;/a&gt;
       &lt;a href=&quot;http://www.binaryjam.com/&quot; target=&quot;_blank&quot;&gt;
          &lt;img alt=&quot;Finding Nemo&quot; src=&quot;/sites/SliderDemo/SliderImages/nemo.jpg&quot;&gt;
       &lt;/a&gt;
       &lt;a href=&quot;http://www.binaryjam.com/&quot; target=&quot;_blank&quot;&gt;
           &lt;img alt=&quot;Toy Story&quot; src=&quot;/sites/SliderDemo/SliderImages/toystory.jpg&quot;&gt; &lt;/a&gt;
       &lt;a href=&quot;http://www.binaryjam.com/&quot; target=&quot;_blank&quot;&gt;
           &lt;img alt=&quot;Up&quot; src=&quot;/sites/SliderDemo/SliderImages/up.jpg&quot;&gt; &lt;/a&gt;
    &lt;/div&gt;
&lt;/div&gt;
&lt;script&gt;jQuery(function($) {
	$('#games').coinslider({ hoverPause: false, height:246, width:618});
});
&lt;/script&gt;

&lt;!-- --&gt;

&lt;!- Force Stupid blog code window to be bigger --&gt;

&lt;!-- --&gt;
</pre>
</pre>
<p>Have fun</p>
]]></content:encoded>
			<wfw:commentRss>http://www.binaryjam.com/2012/01/31/cewp-making-use-of-coin-slider-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Error When talking to SharePoint Web Services in code</title>
		<link>http://www.binaryjam.com/2012/01/04/error-when-talking-to-sharepoint-web-services-in-code/</link>
		<comments>http://www.binaryjam.com/2012/01/04/error-when-talking-to-sharepoint-web-services-in-code/#comments</comments>
		<pubDate>Wed, 04 Jan 2012 13:17:34 +0000</pubDate>
		<dc:creator>Binaryjam</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[Sharepoint]]></category>

		<guid isPermaLink="false">http://www.binaryjam.com/?p=632</guid>
		<description><![CDATA[I&#8217;ve been trying to talk to SharePoint&#8217;s web services in C# for a couple of hours now. Something I do in JS all the time, but rarely in a clients C# app. I&#8217;ve been getting the same error over and over again, but keep getting an error when trying to do anything. Guid should contain [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been trying to talk to SharePoint&#8217;s web services in C# for a couple of hours now. Something I do in JS all the time, but rarely in a clients C# app.</p>
<p>I&#8217;ve been getting the same error over and over again, but keep getting an error when trying to do anything.</p>
<blockquote><p>Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).</p>
</blockquote>
<p>I had dutifully copied the example code from the MSDN site and got a web reference to the Lists Web Service of course</p>
<p>and commented out the URL code in the example because that points at their site, not mine, which is pointed to by my web reference.</p>
<blockquote><p>/*Set the Url property of the service for the path to a subsite.*/ listService.Url = <a href="http://MyServer/sites/MySiteCollection/_vti_bin/Lists.asmx">http://MyServer/sites/MySiteCollection/_vti_bin/Lists.asmx</a>;</p>
</blockquote>
<p>WRONG!!!!!</p>
<p>If you are getting this error then it is because you commented out the URL.</p>
<p>When you add a web reference you are adding a WSDL file which is then compiled.&nbsp; The WSDL is not specific to your site location, </p>
<p>if you open up the WSDL XML the section right at the bottom is pointing to elsewhere, the root of the WebApplciation not the RootWeb / Site you are interested in.</p>
<pre>&lt;wsdl:service name="Lists"&gt;&nbsp;&nbsp;&nbsp;&nbsp; &lt;wsdl:port name="ListsSoap" binding="tns:ListsSoap"&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;soap:address location="http://my.binaryjam.com/_vti_bin/lists.asmx" /&gt;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/wsdl:port&gt;&nbsp;&nbsp;&nbsp;&nbsp; &lt;wsdl:port name="ListsSoap12" binding="tns:ListsSoap12"&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;soap12:address location="http://my.binaryjam.com/_vti_bin/lists.asmx" /&gt;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/wsdl:port&gt;
&lt;/wsdl:service&gt;</pre>
<p>You need that line in the code that sets the listService.Url value, without it you are going to go mad trying to track down this bug, cos I didn&#8217;t find the answer online, I had to use fiddler.&nbsp; Of course this article will now exist. <img src='http://www.binaryjam.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  </p>
<p>&nbsp;</p>
</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:a24dff01-8d97-4681-8c44-cff52825efa6" class="wlWriterSmartContent">Technorati Tags: <a href="http://technorati.com/tags/sharepoint" rel="tag">sharepoint</a>,<a href="http://technorati.com/tags/development" rel="tag">development</a>,<a href="http://technorati.com/tags/web%20services" rel="tag">web services</a></div>
]]></content:encoded>
			<wfw:commentRss>http://www.binaryjam.com/2012/01/04/error-when-talking-to-sharepoint-web-services-in-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Embracing the dark side &#8211; Part 3, Image browser enhancement to a form</title>
		<link>http://www.binaryjam.com/2011/12/20/embracing-the-dark-side-part-3-image-browser-enhancement-to-a-form/</link>
		<comments>http://www.binaryjam.com/2011/12/20/embracing-the-dark-side-part-3-image-browser-enhancement-to-a-form/#comments</comments>
		<pubDate>Tue, 20 Dec 2011 16:20:51 +0000</pubDate>
		<dc:creator>Binaryjam</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.binaryjam.com/?p=620</guid>
		<description><![CDATA[Continuing from the previous post, Customising a List form, we are now at the point when we can start to do something useful with these techniques as let&#8217;s face it adding hello world to a form doesn&#8217;t really add value. So in this post I am going to add a customisation to make the input [...]]]></description>
			<content:encoded><![CDATA[<p><img style="margin: 0px 5px 0px 0px" align="left" src="http://www.binaryjam.com/wp-content/uploads/2011/12/SPD_thumb.jpg">
<p>Continuing from the previous post, Customising a List form, we are now at the point when we can start to do something useful with these techniques as let&#8217;s face it adding hello world to a form doesn&#8217;t really add value.</p>
<p>So in this post I am going to add a customisation to make the input forms new or edit a little more useful and therefore encouraging user adoption.</p>
<p>Have you ever used the URL field ?&nbsp; Perhaps formatted as a picture ? It looks like this on the form</p>
<p><a href="http://www.binaryjam.com/wp-content/uploads/2011/12/Normal-Picture-Link.jpg"><img style="border-right-width: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" border="0" alt="Normal Picture Link" src="http://www.binaryjam.com/wp-content/uploads/2011/12/Normal-Picture-Link_thumb.jpg" width="470" height="107"></a> </p>
<p>The absolute height of usability that one. Is it better in 2010, my other dev box is off at the minute. Thing is we can make this better.&nbsp; In my scenario the user needs to select an image from an existing Image Library.</p>
<p>By providing the users with an extra &#8220;button&#8221; we can add some javascript to give them the ability to browse the image library right there in the add new item page (or edit) and select the image, no messing about cut and pasting urls, which for some users is just a little too much for them to deal with. Instead they See a picture like this to pick an image from</p>
<p><a href="http://www.binaryjam.com/wp-content/uploads/2011/12/CropperCapture10.jpg"><img style="border-right-width: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" border="0" alt="CropperCapture[10]" src="http://www.binaryjam.com/wp-content/uploads/2011/12/CropperCapture10_thumb.jpg" width="306" height="273"></a> </p>
<p>&nbsp;</p>
<p>Below you can see the added hyperlink, the picture field populated and a preview image.</p>
<p><em>The more observant will notice this version picks thumbnails automatically.</em></p>
<p><a href="http://www.binaryjam.com/wp-content/uploads/2011/12/CropperCapture9.jpg"><img style="border-right-width: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" border="0" alt="CropperCapture[9]" src="http://www.binaryjam.com/wp-content/uploads/2011/12/CropperCapture9_thumb.jpg" width="508" height="185"></a> </p>
<p>The code to do this relies on jQuery being included in a master page, if you do not do this by default in your SharePoint implementation, then </p>
<ol>
<li>Consider doing so
<li>If not, you can always add a script tag referencing it in directly in the page</li>
</ol>
<p>The example code below relies on you determining certain things and setting the code constants to the values you have determined, e.g. the Image List Name and Guid, the jQuery field selector for the picture block, this is something that can only be done by rendering the form and figuring out the ID of that first text box of the field.</p>
<p>In my example the jQuery selector is </p>
<p>
<pre class="brush: plain; title: ; notranslate"> &lt;/p&gt; &lt;p&gt;var pictureFormFieldSelector='input[id$=&quot;UrlFieldUrl&quot;]';&lt;/p&gt; &lt;p&gt;</pre>
</p>
<p>Which locates an input box with the ID ending in &#8220;UrlFieldUrl&#8221;. The Real name, in my case, happens to be &#8220;ctl00$m$g_df4349ae_3a85_4882_93ef_c7c49eb75719$ctl00$ctl04$ctl07$ctl00$ctl00$ctl04$ctl00$ctl00$UrlFieldUrl&#8221;.</p>
<p>I use that tag to automatically add the HTML for the &#8220;Click Here&#8221; link and determine the layout of the page for adding the preview Image.</p>
<p>The code for the Dialog Picker is Standard SharePoint, the Asset Picker, and I took the idea from a blog post , in this chaps blog he is using it on a toolpart.</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="http://fahadzia.com/blog/2009/11/using-sharepoint-image-picker-to-select-images/" target="_blank">http://fahadzia.com/blog/2009/11/using-sharepoint-image-picker-to-select-images/</a></p>
<p>&nbsp;</p>
<p>So here is the code I use to implement this in a page.</p>
<p>&lt;script&gt;</p>
<p>&nbsp;</p>
<p>//NoConflict is enabled in my environment<br />//Pass to documentLoad this function&nbsp; <br />jQuery(function ($) {
<p>&nbsp;&nbsp;&nbsp; //Constants that refer to the Image List <br />&nbsp;&nbsp;&nbsp; //an attempt to generalise this code, fingers crossed<br />&nbsp;&nbsp;&nbsp; var baseUrl=L_Menu_BaseUrl;<br />&nbsp;&nbsp;&nbsp; var imageListName=&#8221;MyImageList&#8221;;<br />&nbsp;&nbsp;&nbsp; var imageListGuid=&#8221;{F406F2AA-5518-4E46-86F5-9CDDC5CF8F38}&#8221;;<br />&nbsp;&nbsp;&nbsp; //This is the jQuery selector to identify the specific Picture Block we are to target<br />&nbsp;&nbsp;&nbsp; var pictureFormFieldSelector=&#8217;input[id$="UrlFieldUrl"]&#8216;;<br />&nbsp;&nbsp;&nbsp; //Grab the Form Element Block, <br />&nbsp;&nbsp;&nbsp; var $formBlock=$(&#8216;#onetIDListForm&#8217;);<br />&nbsp;&nbsp;&nbsp; if ($formBlock.length&gt;0)<br />&nbsp;&nbsp;&nbsp; {
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $(pictureFormFieldSelector).parent().prepend(&#8216;&lt;input id=&#8221;findThatTxt&#8221; type=&#8221;hidden&#8221;&gt;Click &lt;a href=&#8221;#&#8221; id=&#8221;advancedBrowse&#8221;&gt;here&lt;/a&gt; for advanced browse&lt;/span&gt;&lt;br/&gt;&#8217;);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; with(new AssetPickerConfig(&#8216;myAssetPickerObj&#8217;))&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DefaultAssetImageLocation=&#8217;~SiteCollection/&#8217; + imageListName;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb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p; }} <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $(&#8220;#advancedBrowse&#8221;).click(function() {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; APD_LaunchAssetPickerUseConfigCurrentUrl(&#8220;myAssetPickerObj&#8221;);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ( $(&#8216;#findThatTxt&#8217;).val()!=&#8221;" )<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />
<blockquote>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var imageLocation = $(&#8216;#findThatTxt&#8217;).val();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var urlStart = document.location.protocol + &#8220;//&#8221; + document.location.host;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var finalImg = urlStart + imageLocation;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var editPoint = imageLocation.lastIndexOf(&#8220;/&#8221;);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var previewImg = urlStart + imageLocation.substring(0, editPoint) + &#8220;/_t/&#8221; + imageLocation.substring(editPoint + 1).replace(/\./g, &#8220;_&#8221;) + &#8220;.jpg&#8221;; </p>
</blockquote>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $(pictureFormFieldSelector).val(previewImg);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if($(&#8216;#previewImg&#8217;).length==0)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $(pictureFormFieldSelector).parent().append(&#8216;&lt;IMG id=&#8221;previewImg&#8221; src=&#8221;&#8216; + previewImg+ &#8216;&#8221; /&gt;&#8217;);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $(&#8216;#previewImg&#8217;).show();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $(&#8216;#previewImg&#8217;).attr(&#8220;src&#8221;,&nbsp; previewImg);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $(pictureFormFieldSelector).val(&#8220;&#8221;);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if($(&#8216;#previewImg&#8217;).length&gt;0)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $(&#8216;#previewImg&#8217;).hide();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return false;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; });<br />&nbsp;&nbsp;&nbsp; }<br />}); </p>
<p>&nbsp;</p>
<p>&lt;/script&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.binaryjam.com/2011/12/20/embracing-the-dark-side-part-3-image-browser-enhancement-to-a-form/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Embracing the dark side &#8211; Part 2, Customising a List Form</title>
		<link>http://www.binaryjam.com/2011/12/15/embracing-the-dark-side-part-2-customising-a-list-form/</link>
		<comments>http://www.binaryjam.com/2011/12/15/embracing-the-dark-side-part-2-customising-a-list-form/#comments</comments>
		<pubDate>Thu, 15 Dec 2011 10:16:41 +0000</pubDate>
		<dc:creator>Binaryjam</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.binaryjam.com/2011/12/15/embracing-the-dark-side-part-2-customising-a-list-form/</guid>
		<description><![CDATA[There are many things that Designer can do and I&#8217;ve seen many an article on DVWP but what I didn&#8217;t know, until I saw @sympmarc do it, was customising a List form in designer, something I&#8217;ve done in Studio before with rendering templates etc but never seen it done on-the-fly as it were. Where to [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.binaryjam.com/wp-content/uploads/2011/12/SPD.jpg" rel="lightbox"><img style="border-right-width: 0px; margin: 0px 5px 0px 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" border="0" alt="SPD" align="left" src="http://www.binaryjam.com/wp-content/uploads/2011/12/SPD_thumb.jpg" width="187" height="132"></a> </p>
<p>There are many things that Designer can do and I&#8217;ve seen many an article on DVWP but what I didn&#8217;t know, until I saw @sympmarc do it, was customising a List form in designer, something I&#8217;ve done in Studio before with rendering templates etc but never seen it done on-the-fly as it were.</p>
<p>Where to start ?</p>
<p>Well designer of course, but what do I mean by that, what&#8217;s the best approach to do this ? Is there one. Yes, I think so and I got clues as to what I think this should be at SharePoint Saturday.</p>
<p>First we need somewhere to play so create yourself a test site and a list, create a few fields, it doesn&#8217;t matter what as this first post is just about how to go about editing a form.</p>
<p><a rel="lightbox" href="http://www.binaryjam.com/wp-content/uploads/2011/12/image.png"><img style="border-right-width: 0px; margin: 0px 5px 0px 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" border="0" alt="image" align="left" src="http://www.binaryjam.com/wp-content/uploads/2011/12/image_thumb.png" width="174" height="108" rel="lightbox"></a> </p>
<p>Now open the Site in Designer, if you&#8217;ve never done this then a dialog will open and you have to select your site from the list you can see, or navigate to it somehow, but easiest is to just cut and paste the Site Collection URL into the box and click open, do not put a filename, so that default.aspx you pasted in there, just scrub that out. Great.</p>
<p>&nbsp;</p>
<p>Now in Designer you should have your site collection open and in the Folder window, if you cannot see it hit Alt-F1, you can see the structure of your site. </p>
<p><a rel="lightbox" href="http://www.binaryjam.com/wp-content/uploads/2011/12/image1.png"><img style="border-right-width: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" border="0" alt="image" align="right" src="http://www.binaryjam.com/wp-content/uploads/2011/12/image_thumb1.png" width="244" height="167" rel="lightbox"></a></p>
<p>Expand the Lists folder and the list itself and you should see something like this.</p>
<p>Here you can see two of my lists one stupidly named based on an announcements list, but key to what we are about to do you can see the specific pages of the forms associated with this list underneath the list itself.</p>
<p>This is what we are going to change.&nbsp; First we are going to make a slight change to the NewForm.aspx.&nbsp; BUT for safety sake we are not going to edit the original, you might make a mess, we are going to make a copy of it to make our changes and then make sure the list points at this version, then we can always switch it back.</p>
<p>So to do this, counter-intuitively open the NewForm.aspx by dbl clicking it now immediately &#8220;Save As&#8221; and type in the name AdvancedNewForm.aspx (or whatever you think suits your needs).&nbsp; You could of course edit any of the forms like this.</p>
<p>Doing this (should) do two things, first it will make a copy of the new form under the list, but importantly it should have set the default form for an item to be our new version.&nbsp; </p>
<p>&nbsp;</p>
<p><a rel="lightbox" href="http://www.binaryjam.com/wp-content/uploads/2011/12/image2.png"><img style="border-right-width: 0px; margin: 0px 5px 0px 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" border="0" alt="image" align="left" src="http://www.binaryjam.com/wp-content/uploads/2011/12/image_thumb2.png" width="244" height="237" rel="lightbox"></a>You need to check this has happened, so right click the List in the folders windows and select properties. Now click the tab Supporting Files, the new item form should be pointing at your AdvancedNewForm.aspx.&nbsp; If it is not then you can select it.</p>
<p>You do this by</p>
<p><strong>N.B.Important step easily missed </strong></p>
<p><strong>&nbsp;&nbsp; 1. Select the Content type specific forms option for ITEM from the combo box</strong></p>
<p>&nbsp;&nbsp; 2. For your new item form select the browse button and navigate to your selected form.</p>
<p>&nbsp;</p>
<p>If you do not do step 1 then it will look like it worked but then refuse to change the item and you will go mad trying to figure out what is going on, cos designer will not tell you you&#8217;ve done it wrong.</p>
<p>&nbsp;</p>
<p>Our new page should be open in the main window of designer<a rel="lightbox" href="http://www.binaryjam.com/wp-content/uploads/2011/12/image3.png"><img style="border-right-width: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" border="0" alt="image" align="right" src="http://www.binaryjam.com/wp-content/uploads/2011/12/image_thumb3.png" width="244" height="191" rel="lightbox"></a> by default it should be a split window for those happy with code and design surfaces, if you need to change this view at the bottom of the window is an option to <a href="http://www.binaryjam.com/wp-content/uploads/2011/12/image4.png"><img style="border-right-width: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" border="0" alt="image" align="left" src="http://www.binaryjam.com/wp-content/uploads/2011/12/image_thumb4.png" width="244" height="47"></a>change this, it&#8217;s easily missed so I point it out here.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>Now in the code look for</p>
<p><code>&nbsp;&nbsp;&nbsp; &lt;asp:content runat="server" contentplaceholderid="PlaceHolderMain"&gt;</code>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>After this we are just going to put some text to customise our form, &#8220;Hello Word&#8221;, enter <a rel="lightbox" href="http://www.binaryjam.com/wp-content/uploads/2011/12/image5.png"><img style="border-right-width: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" border="0" alt="image" align="right" src="http://www.binaryjam.com/wp-content/uploads/2011/12/image_thumb5.png" width="244" height="195"></a>this text and save the form.&nbsp; Go back to your site in a browser and click new on your list and you should see the custom form now and not the original. Not the most exciting example but this describes the process of doing that customisation.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>You will be doing far more complicated customisations than this eventually, but it&#8217;s important to note how to start doing this.</p>
<p>For those devs amongst you this will go against the grain as directly editing source code on a live system with no Source Code Control.&nbsp; </p>
<p>For every one there are some other practices you can learn from here where I made some mistakes and have paid for it in losing my changes.</p>
<p>Firstly when developing a complex solution for your form, DONT do it on live, take a copy of what you want to change a develop it on another site, on a dev machine, wherever just not on the live one, unless of course its not actually in use at the time you are doing it.</p>
<p>Secondly, if you have Visual Studio and TFS or other editor and source code control, take a copy of the changes and save them into a file under your TFS project and do checkins or create multiple copies called version 1,2,3 etc.&nbsp; DONT just have your only copy in SharePoint.&nbsp; I lost a lot of work when I mistakenly deleted a dev site collection of mine.</p>
<p>Just because this is an easy approach to developing don&#8217;t treat it as such. For each demo or customisation create a new properly named site collection that matches your TFS project, don&#8217;t call your site collection test you might delete it.</p>
<p>That&#8217;s it for this post.&nbsp; A Simple guide on editing those custom forms in designer with a few tips to make sure you don&#8217;t mess up.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp; </p>
<p><a rel="lightbox" href="http://www.binaryjam.com/wp-content/uploads/2011/12/image1.png"></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.binaryjam.com/2011/12/15/embracing-the-dark-side-part-2-customising-a-list-form/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Embracing the dark side &#8211; Part 1</title>
		<link>http://www.binaryjam.com/2011/12/15/embracing-the-dark-side-part-1/</link>
		<comments>http://www.binaryjam.com/2011/12/15/embracing-the-dark-side-part-1/#comments</comments>
		<pubDate>Thu, 15 Dec 2011 10:16:01 +0000</pubDate>
		<dc:creator>Binaryjam</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.binaryjam.com/2011/12/15/embracing-the-dark-side-part-1/</guid>
		<description><![CDATA[I&#8217;m a Dev. I spend my SharePoint time in Visual Studio and notepad. For me the spectre of SharePoint designer has always loomed but never been of much interest to me, it was and always would be the evil FrontPage and no change of name was going to make it any different.  I feel the [...]]]></description>
			<content:encoded><![CDATA[<p><img style="margin: 0px 5px 0px 0px;" src="http://lh4.ggpht.com/_jy3LtyO6I0g/SgvcFKqARcI/AAAAAAAAGbk/t_I0Rjpkoro/spd2010_thumb%5B4%5D.jpg" alt="" width="176" height="122" align="left" />I&#8217;m a Dev. I spend my SharePoint time in Visual Studio and notepad. For me the spectre of SharePoint designer has always loomed but never been of much interest to me, it was and always would be the evil FrontPage and no change of name was going to make it any different.  I feel the same way about marathon bars.</p>
<p>Despite having had SharePoint in the company since 2003, user adoption isn&#8217;t great, sure there is a Portal and lots of team sites, and Farms popping up all over the place (its a big, big company) when I finally get to meet real end users there is not a lot of love for the product.</p>
<p>Recently I&#8217;ve been getting requests for applications, copies of applications (all written in asp.net not SharePoint) which almost do the same job as the original but not enough to just clone it, but also the requirements are almost OOTB a SharePoint list.</p>
<p>Users seem to hate SharePoint, well hate is a little strong, but dislike the interface and functionality so much that they would genuinely consider forking out for a whole new app with all the requisite dev/hosting/support costs associated with it.</p>
<p>To save money for everyone I was tasked with making some tweaks to Lists to make the user experience better, but If I crack open Visual Studio then along comes a project with all the people and dev costs you would normally get, for not a lot of benefit on small amount of changes.</p>
<p>A change of approach was needed, I knew it, boss knew it, it was time to rip the film off the designer box and start hacking away.</p>
<p>Since then I&#8217;ve done a couple of demos projects and a couple of real world modifications to OOTB sites to make the users experience much more fluid a little less web page &#8220;refreshy&#8221;, more dynamic.</p>
<p>So in the following posts I&#8217;m going to describe how as a poweruser or dev tasked with saving money on projects and getting the most out of the platform you have, can start to make a few tweaks, hopefully you can use the code yourselves, yes! I said code! I am a developer after all, I&#8217;m not just adding a couple of images, I&#8217;m javascripting, jQuerying.  You can&#8217;t have dynamic without code anymore and an animated gif on it&#8217;s own isn&#8217;t enough.</p>
<p>Follow-up articles</p>
<p><a title="Permalink to Embracing the dark side – Part 2" href="http://www.binaryjam.com/2011/12/15/embracing-the-dark-side-part-2/">Embracing the dark side – Part 2</a></p>
<p><a href="http://www.binaryjam.com/2011/12/20/embracing-the-dark-side-part-3-image-browser-enhancement-to-a-form/">Embracing the dark side &#8211; Part 3</a></p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.binaryjam.com/2011/12/15/embracing-the-dark-side-part-1/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Upgrading SharePoint 2007 to 2010 &#8211; Find those missing EventReceivers / Features / SiteDefs</title>
		<link>http://www.binaryjam.com/2011/08/04/upgrading-sharepoint-2007-to-2010-find-those-missing-eventreceivers-features-sitedefs/</link>
		<comments>http://www.binaryjam.com/2011/08/04/upgrading-sharepoint-2007-to-2010-find-those-missing-eventreceivers-features-sitedefs/#comments</comments>
		<pubDate>Thu, 04 Aug 2011 15:46:35 +0000</pubDate>
		<dc:creator>Binaryjam</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.binaryjam.com/2011/08/04/upgrading-sharepoint-2007-to-2010-find-those-missing-eventreceivers-features-sitedefs/</guid>
		<description><![CDATA[I&#8217;ve got a job to do, Im going to be working on upgrading a 2007 SharePoint environment with a huge amount of customisations. the first task was run that Pre-Upgrade check, and along with the thousands of problems it threw up were a couple of interesting ones. Firstly, Missing SiteTemplates.&#160; Really How and more importantly [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve got a job to do, Im going to be working on upgrading a 2007 SharePoint environment with a huge amount of customisations.</p>
<p>the first task was run that Pre-Upgrade check, and along with the thousands of problems it threw up were a couple of interesting ones.</p>
<p>Firstly, Missing SiteTemplates.&nbsp; Really How and more importantly WHERE, because it doesnt tell you, all I got was this </p>
<ul>
<li>name = Unknown, language = 1053, template id = 1, count = 2, status = Missing</li>
</ul>
<p>I don&#8217;t even have language 1053 installed.</p>
<p>Secondly &#8220;The following event receiver assembly(s) are referenced by the content, but they are not installed on the web server&#8221;. Again how does that happen ? and WHERE.</p>
<p>Thirdly &#8220;The following feature(s) are referenced by the content, but they are not installed on the web server&#8221;, there is a bit of a theme here, can you guess what it is, yes WHERE!</p>
<p>So the answer was quick see if anyone has done something like this and lets create an mashup of those scripts.&nbsp; So I take no credit other than the skeleton of this script. (For the originals see links at bottom of page).</p>
<p>So this is the kind of script I threw together, it&#8217;s not necessarily finished, but I thought that it would be handy to at least post it and perhaps someone might find it handy.</p>
<p>This only spits information out and not that well, I could spend longer formatting it, I probably will at some point.&nbsp; You will have to edit it according to your own requirements, you will know what they are when you run the upgrade. Also this doesn&#8217;t do everything it&#8217;s a start though.</p>
<p>&nbsp;</p>
<pre>
<pre class="brush: powershell; title: ; notranslate">
[void][System.Reflection.Assembly]::LoadWithPartialName(&quot;Microsoft.SharePoint&quot;)
###############################################################
#Get Base Objects
###############################################################
function GetBaseObjects
{
    trap {&quot;The WebApplication URL is invalid&quot;}
    $script:wa=[Microsoft.SharePoint.Administration.SPWebApplication]::Lookup($SiteUrl);
} 

###############################################################
#Main Processing Loop
############################################################### 

function ProcessWebApplication
{ 

    cls
    Write-Host &quot;Starting Scan&quot;
    $i=0;
    foreach ($site in $wa.Sites)
    {
        $siteCount=$wa.Sites.Count
           Write-Progress -id 1 -activity &quot;Scanning SPSites&quot; -status &quot;Percent scanned: &quot; -PercentComplete (($i / $siteCount)  * 100)
        $i++
        #Check for Missing Features
        foreach ($feature in $site.features) {
            if ($feature.definition -eq $null)
            {
                write-host (&quot;Missing site feature:&quot; + $feature.DefinitionId  + &quot;, &quot; + $feature.parent )
            }
        }
        foreach ($web in $site.AllWebs)
        {
            $ok=$true;
            $webCount=$site.AllWebs.Count
            #Check for this lang code as I have an
	    #    unidentified Template in this lang code
	    #Checking for lang rather than name as not sure whether
            #    unidentified is stored as that or null or whatever
            if ($web.Language -eq &quot;1053&quot;)
            {
                if($ok)
                {
                    Write-Host(&quot;SPWeb:&quot; + $web.Url )
                    $ok=$false;
                }
                Write-Host(&quot;Langauge is set to 1053 possible missing template&quot;)
            }
            $lists = $web.Lists | where {$_.EventReceivers.Count -gt 0}
            foreach ($list in $lists)
            {
                $evts = $list.EventReceivers
                if ($evts.Count -gt 0)
                {
                    foreach ($evt in $evts)
                    {
                        $found=$false
                        if ($evt.Assembly -like &quot;BinaryJam.SharePoint.EvRcExample1*&quot;) { $found=$true }
                        if ($evt.Assembly -like &quot;BinaryJam.SharePoint.EvRcExample2*&quot;) { $found=$true }
                        if ($evt.Assembly -like &quot;BinaryJam.SharePoint.EvRcExample3*&quot;) { $found=$true }
                        if ($found)
                        {
                            if($ok)
                            {
                                Write-Host(&quot;SPWeb:&quot; + $web.Url )
                                $ok=$false;
                            }
                            Write-Host(&quot;    &quot; + $list.RootFolder.ServerRelativeUrl + &quot;, &quot; + $evt.Id +
                                       &quot;, &quot; + $evt.Class  + &quot;, &quot; + $evt.Type) 

                        } 

                    }
                }
            } 

            $web.Dispose()
        }
        $site.Dispose()
    }
    &quot;Completed Scan&quot;
    $web=$null
    $site=$null
} 

###############################################################
#Clean up your room
###############################################################
function CleanUp
{
    trap{continue}
    $script:wa=$null
} 

###############################################################
# Validate args
###############################################################
function ValidateArgs($arg)
{
    if ($arg.Length -ne 1 -or $arg[0] -eq &quot;-?&quot; )
    {
        Write-Host &quot;Usage: .\FindingMissingStuff.ps1 &lt;spsiteurl&gt;&quot;;
        return $false;
    }
    $script:SiteUrl = $arg[0];
    return $true
} 

###############################################################
# Main
###############################################################
cls
if (ValidateArgs $args)
{
    GetBaseObjects
    ProcessWebApplication
    CleanUp
}
</pre>
</pre>
<p>&nbsp;</p>
<p>These are the two sites I gleaned the salient information from and I just embedded it within my own powershell structure I use for most my stuff.</p>
<p>&nbsp;</p>
<p><a title="http://blogs.blackmarble.co.uk/blogs/rhepworth/archive/2010/11/19/powershell-to-find-missing-features-in-sharepoint-2010.aspx" href="http://blogs.blackmarble.co.uk/blogs/rhepworth/archive/2010/11/19/powershell-to-find-missing-features-in-sharepoint-2010.aspx">http://blogs.blackmarble.co.uk/blogs/rhepworth/archive/2010/11/19/powershell-to-find-missing-features-in-sharepoint-2010.aspx</a></p>
<p><a title="http://blog.falchionconsulting.com/index.php/2009/03/deleting-orphaned-event-receivers-using-powershell" href="http://blog.falchionconsulting.com/index.php/2009/03/deleting-orphaned-event-receivers-using-powershell">http://blog.falchionconsulting.com/index.php/2009/03/deleting-orphaned-event-receivers-using-powershell</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.binaryjam.com/2011/08/04/upgrading-sharepoint-2007-to-2010-find-those-missing-eventreceivers-features-sitedefs/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Multiple jQuery on a page</title>
		<link>http://www.binaryjam.com/2011/06/23/multiple-jquery-on-a-page/</link>
		<comments>http://www.binaryjam.com/2011/06/23/multiple-jquery-on-a-page/#comments</comments>
		<pubDate>Thu, 23 Jun 2011 11:45:57 +0000</pubDate>
		<dc:creator>Binaryjam</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.binaryjam.com/2011/06/23/multiple-jquery-on-a-page/</guid>
		<description><![CDATA[Technorati Tags: jQuery,javascript I have been doing some messing about with jQuery in SharePoint and I want to understand what is going on when there are multiple declarations of different versions on a page. The way it seems to work is last one referenced wins.&#160; This is because the execution of the jQuery code sets [...]]]></description>
			<content:encoded><![CDATA[<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:f25e2245-e366-47bb-b718-5200831f0038" class="wlWriterSmartContent">Technorati Tags: <a href="http://technorati.com/tags/jQuery" rel="tag">jQuery</a>,<a href="http://technorati.com/tags/javascript" rel="tag">javascript</a></div>
<p>I have been doing some messing about with jQuery in SharePoint and I want to understand what is going on when there are multiple declarations of different versions on a page.</p>
<p>The way it seems to work is last one referenced wins.&#160; This is because the execution of the jQuery code sets window.jQuery = the current jQuery object.</p>
<p>I was wondering well what happens to the docReady function pointer stack, as that is surely contained within the version of jQuery that was executed.</p>
<p>Well truth is it&#8217;s complicated.&#160; The code you see below will execute 161 and 144 code and the events will occur in each ones own code block (closures), but then the values you get out of jQuery are that of the last one executed despite it being a closure, because the clousre version of $ you call in your first doc ready returns the window.jQuery object,</p>
<p>not your closure so this code will always spit out 1.4.41.4.4 despite executing code</p>
<p>from both code blocks.</p>
<p>What does this mean, I haven&#8217;t got a clue, but I encourage you to debug this in firebug and see what code executes where, and if someone can explain to me why I see two function pointers in my 1.4.4 readyList code, that would be nice.</p>
<p>In conclusion I suppose I would say one version of jQuery would be nice on a page, if MS could kindly put something into sharepoint to manage it so we are all doing the same thing I&#8217;d appreciate that, and if the jQuery team could &quot;just finish already&quot; <img src='http://www.binaryjam.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<table border="0" cellspacing="0" cellpadding="2" width="400">
<tbody>
<tr>
<td valign="top" width="400"><script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.6.1.js"></script>
<p>&lt;html&gt;            <br />&lt;head&gt; </p>
<p>&lt;script src=&quot;<a href="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.6.1.js" ?="?">http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.6.1.js&quot;</a> &gt;&lt;/script&gt; </p>
<p>&lt;/head&gt;            <br />&lt;body&gt; </p>
<p>The Version is </p>
<p>&lt;div id=&quot;dave&quot;&gt;&lt;/div&gt; </p>
<p>&lt;script&gt; </p>
<p>&#160;&#160;&#160; $(function (){$(&#8216;#dave&#8217;).append($().jquery)}); </p>
<p>&lt;/script&gt; </p>
<p>&lt;script src=&quot;<a href="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.4.4.js" ?="?">http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.4.4.js&quot;</a> &gt;&lt;/script&gt;             <br />&lt;script&gt; </p>
<p>&#160;&#160;&#160; $(function (){$(&#8216;#dave&#8217;).append($().jquery)}); </p>
<p>&lt;/script&gt; </p>
<p>&lt;/body&gt;            <br />&lt;/html&gt;</p>
</p>
</td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://www.binaryjam.com/2011/06/23/multiple-jquery-on-a-page/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Creating TFS task Items from Powershell &#8211; From SPDisposeCheck Output</title>
		<link>http://www.binaryjam.com/2011/05/27/creating-tfs-task-items-from-powershell-from-spdisposecheck-output/</link>
		<comments>http://www.binaryjam.com/2011/05/27/creating-tfs-task-items-from-powershell-from-spdisposecheck-output/#comments</comments>
		<pubDate>Fri, 27 May 2011 13:13:16 +0000</pubDate>
		<dc:creator>Binaryjam</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[Sharepoint]]></category>

		<guid isPermaLink="false">http://www.binaryjam.com/2011/05/27/creating-tfs-task-items-from-powershell-from-spdisposecheck-output/</guid>
		<description><![CDATA[Now one for the SharePoint people.  You have ran SPDisposeCheck on the dire piece of code your lackey wrote (or youself for that matter) and forgot to run the SPDisposeCheck.  Whoosh loads of entries to validate and change the code for.  Being good people using TFS for source code and task management you want an [...]]]></description>
			<content:encoded><![CDATA[<p>Now one for the SharePoint people.  You have ran SPDisposeCheck on the dire piece of code your lackey wrote (or youself for that matter) and forgot to run the SPDisposeCheck.  Whoosh loads of entries to validate and change the code for. </p>
<p>Being good people using TFS for source code and task management you want an entry for each item to check.</p>
<p>Using the built in XML handling facilities from PowerShell this is an easy task.</p>
<p>First run SPDisposeCheck with the output set to XML You will get something like this</p>
<table border="0" cellspacing="0" cellpadding="2" width="745">
<tbody>
<tr>
<td width="743" valign="top"><span style="font-size: xx-small;">&lt;?xml version=&#8221;1.0&#8243; encoding=&#8221;ibm850&#8243;?&gt;<br />
&lt;ArrayOfProblem xmlns:xsi=&#8221;</span><a href="http://www.w3.org/2001/XMLSchema-instance"><span style="font-size: xx-small;">http://www.w3.org/2001/XMLSchema-instance&#8221;</span></a><span style="font-size: xx-small;"> xmlns:xsd=&#8221;</span><a href="http://www.w3.org/2001/XMLSchema"><span style="font-size: xx-small;">http://www.w3.org/2001/XMLSchema&#8221;</span></a><span style="font-size: xx-small;">&gt;<br />
  &lt;Problem&gt;<br />
    &lt;ID&gt;SPDisposeCheckID_110&lt;/ID&gt;<br />
    &lt;Module&gt;BinaryJam.CrappyCode.dll&lt;/Module&gt;<br />
    &lt;Method&gt;BinaryJam.CrappyCode.ApplicationPages.EditSiteProperties.GetPortalRootWeb&lt;/Method&gt;<br />
    &lt;Assignment&gt;local2 := new Microsoft.SharePoint.SPSite(local0).{Microsoft.SharePoint.SPSite}get_RootWeb()&lt;/Assignment&gt;<br />
    &lt;Line&gt;0&lt;/Line&gt;<br />
    &lt;Notes&gt;Constructor called for Microsoft.SharePoint.SPSite but not assigned. This type should be assigned and subsequently disposed&lt;/Notes&gt;<br />
  &lt;/Problem&gt;<br />
&lt;/ArrayOfProblem&gt;</span></td>
</tr>
</tbody>
</table>
<p> </p>
<p>You can Easily read XML files in PowerShell with a simple statement</p>
<pre class="brush: powershell; title: ; notranslate">$xmldata = 1(Get-Content c:\test\out.xml)</pre>
<p>Accessing the Elements is then just object notation</p>
<pre class="brush: powershell; title: ; notranslate">$xmldata.ArrayOfProblem.Problem</pre>
<p>Will return an array of problem items that can be accessed in a foreach $problem and with $problem.ID</p>
<p>So the full code to do this is</p>
<p><span id="more-556"></span></p>
<pre class="brush: powershell; title: ; notranslate"> cls
[void][System.Reflection.Assembly]::LoadWithPartialName(“Microsoft.TeamFoundation.Client”)
[void][System.Reflection.Assembly]::LoadWithPartialName(“Microsoft.TeamFoundation.WorkItemTracking.Client”)

[psobject] $tfs = [Microsoft.TeamFoundation.Client.TeamFoundationServerFactory]::GetServer(“http://binaryjam.com:8080/tfs/defaultcollection”)
$WorkItemStore=$tfs.TfsTeamProjectCollection.GetService([Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemStore])

$project=$WorkItemStore.Projects[&quot;MyProject&quot;]

$type=$project.WorkItemTypes[&quot;Task&quot;]

$xmldata = 1

(Get-Content c:\test\out.xml) foreach ($problem in $xmldata.ArrayOfProblem.Problem){ $item = new-object Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItem $type $item.Title = “This is an automated entry based on the output from an SPDisposeCheck” $item.AreaPath = “MyProject” $item.IterationPath = “MyProject\Iteration 2? $item.Description = “ID : ” + $problem.ID + ” Module : ” + $problem.Module + ” Method : ” + $problem.Method + ” Assignment : ” + $problem.Assignment + ” Line : ” + $problem.Line + ” Notes : ” + $problem.Notes + ” more : http://blogs.msdn.com/rogerla/archive/2008/02/12/sharepoint-2007-and-wss-3-0-dispose-patterns-by-example.aspx#” + $problem.ID $item.save() } 
</pre>
<p>You will want to test this on a TEST tfs project (something I recommend every team have else how are you going to figure out how it works)</p>
<div id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:2358da8d-01a2-41aa-84ce-4478b2cb6925" class="wlWriterSmartContent" style="margin: 0px; display: inline; padding: 0px;">Technorati Tags: <a rel="tag" href="http://technorati.com/tags/sharepoint">sharepoint</a>,<a rel="tag" href="http://technorati.com/tags/spdisposecheck">spdisposecheck</a>,<a rel="tag" href="http://technorati.com/tags/development">development</a>,<a rel="tag" href="http://technorati.com/tags/tfs">tfs</a></div>
]]></content:encoded>
			<wfw:commentRss>http://www.binaryjam.com/2011/05/27/creating-tfs-task-items-from-powershell-from-spdisposecheck-output/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating TFS task Items from Powershell &#8211; Using a list of files</title>
		<link>http://www.binaryjam.com/2011/05/27/creating-tfs-task-items-from-powershell-using-a-list-of-files/</link>
		<comments>http://www.binaryjam.com/2011/05/27/creating-tfs-task-items-from-powershell-using-a-list-of-files/#comments</comments>
		<pubDate>Fri, 27 May 2011 11:26:29 +0000</pubDate>
		<dc:creator>Binaryjam</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.binaryjam.com/2011/05/27/creating-tfs-task-items-from-powershell-using-a-list-of-files/</guid>
		<description><![CDATA[So you&#8217;ve been given a project to work on.&#160; Namely convert this project from this technology to that technology and your in luck because you have TFS. The pain in the backside bit is now I&#8217;ve you have got to enter all the tasks into TFS which in itself is going to take ages. Enter [...]]]></description>
			<content:encoded><![CDATA[<p>So you&#8217;ve been given a project to work on.&#160; Namely convert this project from this technology to that technology and your in luck because you have TFS.</p>
<p>The pain in the backside bit is now <strike>I&#8217;ve</strike> you have got to enter all the tasks into TFS which in itself is going to take ages. </p>
<p>Enter the wonderful world of Powershell !&#160; This is the kind of repetitive task that PowerShell is good at it can loop thru things and use the .NET object model, Easy!</p>
<p>So here is a code snippet that rips thru aspx pages and creates the TFS entries.</p>
<p> <span id="more-555"></span>
<p>It will use the Current Logged in User for the access and the &quot;assigned To&quot;</p>
<p>so if you need to change that, well I&#8217;ll let you figure that out.</p>
<p>You will need to need to change the TFS Url the ProjectName and possibly the WorkItemType (if you dont want tasks)</p>
<p>&#160;</p>
<table border="0" cellspacing="0" cellpadding="2" width="691">
<tbody>
<tr>
<td valign="top" width="689">
<p><font size="1">cls              <br />[void][System.Reflection.Assembly]::LoadWithPartialName(&quot;Microsoft.TeamFoundation.Client&quot;)               <br />[void][System.Reflection.Assembly]::LoadWithPartialName(&quot;Microsoft.TeamFoundation.WorkItemTracking.Client&quot;)               <br />cd &quot;D:\Dev\MyProject&quot; </font></p>
<p><font size="1">[psobject] $tfs = [Microsoft.TeamFoundation.Client.TeamFoundationServerFactory]::GetServer(&quot;</font><a href="http://tfs:8080/tfs/defaultcollection")" )?=")?"><font color="#000000" size="1">http://tfs:8080/tfs/defaultcollection&quot;)</font></a>             <br /><font size="1">$WorkItemStore=$tfs.TfsTeamProjectCollection.GetService([Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemStore]) </font></p>
<p><font size="1">$project=$WorkItemStore.Projects[&quot;MyProject&quot;] </font></p>
<p><font size="1">$type=$project.WorkItemTypes[&quot;Task&quot;] </font></p>
<p><font size="1">#I made this bit over complicated so that you can insert your own regex in here</font></p>
<p><font size="1">$files = Get-ChildItem . | where-object {$_.name -match &quot;^.*\.aspx$&quot;} </font></p>
<p><font size="1">foreach ($file in $files)              <br />{ </font></p>
<p><font size="1">&#160;&#160;&#160; $item = new-object Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItem $type </font></p>
<p><font size="1">&#160;&#160;&#160; $item.Title = &quot;Convert ASPX Page &#8211; &quot; + $file.name              <br />&#160;&#160;&#160; $item.AreaPath = &quot;MyProject&quot;               <br />&#160;&#160;&#160; $item.IterationPath = &quot;Iteration 4&quot;               <br />&#160;&#160;&#160; $item.save() </font></p>
<p><font size="1">}</font></p>
</td>
</tr>
</tbody>
</table>
<p>&#160;</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:81c847bf-2440-40e1-b852-13f77dba6525" class="wlWriterSmartContent">Technorati Tags: <a href="http://technorati.com/tags/powershell" rel="tag">powershell</a>,<a href="http://technorati.com/tags/tfs" rel="tag">tfs</a>,<a href="http://technorati.com/tags/development" rel="tag">development</a></div>
]]></content:encoded>
			<wfw:commentRss>http://www.binaryjam.com/2011/05/27/creating-tfs-task-items-from-powershell-using-a-list-of-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

