<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-7715120637497505141</id><updated>2024-11-02T05:34:00.195-04:00</updated><category term="Javascript"/><category term="JQuery"/><category term="SharePoint 2010"/><category term="Calendar"/><category term="Delegate Control"/><category term="SharePoint Designer"/><category term="SPServices"/><category term="SharePoint 2013"/><category term="list item attachments"/><category term="team site branding inheritance"/><category term="Add-PnPJavaScriptLink"/><category term="Calendar Overlay"/><category term="Color coded list"/><category term="Fiscal Quarter"/><category term="Fiscal Year"/><category term="Full Text Search"/><category term="FullCalendar"/><category term="Infopath"/><category term="List form"/><category term="Load balancing"/><category term="NLB"/><category term="People picker"/><category term="Right Ribbon"/><category term="Search"/><category term="SharePoint"/><category term="SharePoint 2016"/><category term="SharePoint online"/><category term="SharePoint server name"/><category term="Site Actions Menu"/><category term="color coded"/><category term="custom action"/><category term="embed image"/><category term="list view web part"/><category term="master page"/><category term="sharepoint pnp"/><category term="site collection provisioning"/><category term="site filtering"/><category term="spdactivities"/><category term="welcome menu"/><category term="workflow"/><title type='text'>Shirin&#39;s SharePoint Tips and Tricks</title><subtitle type='html'>Shirin Parsee&#39;s blog, devoted to useful SharePoint code, scripts and tips and tricks</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://dcsharepointchick.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7715120637497505141/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://dcsharepointchick.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>spar</name><uri>http://www.blogger.com/profile/05436274905022706601</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>21</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7715120637497505141.post-3493953563352562490</id><published>2019-04-11T15:24:00.001-04:00</published><updated>2019-04-11T15:33:32.952-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Add-PnPJavaScriptLink"/><category scheme="http://www.blogger.com/atom/ns#" term="custom action"/><category scheme="http://www.blogger.com/atom/ns#" term="master page"/><category scheme="http://www.blogger.com/atom/ns#" term="SharePoint 2010"/><category scheme="http://www.blogger.com/atom/ns#" term="SharePoint 2013"/><category scheme="http://www.blogger.com/atom/ns#" term="SharePoint 2016"/><category scheme="http://www.blogger.com/atom/ns#" term="sharepoint pnp"/><category scheme="http://www.blogger.com/atom/ns#" term="site collection provisioning"/><category scheme="http://www.blogger.com/atom/ns#" term="team site branding inheritance"/><title type='text'>SharePoint Team site Branding and Master Page Inheritance </title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
It&#39;s been over a year since I posted about this &lt;a href=&quot;https://dcsharepointchick.blogspot.com/2018/03/sharepoint-teamsite-branding-and-master.html&quot; target=&quot;_blank&quot;&gt;topic&lt;/a&gt;, but I wanted to share how I&#39;m now currently branding my SharePoint team sites (those that don&#39;t have publishing features turned on). This approach will work with 2013/2016 and possibly SharePoint online.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Side note&lt;/b&gt;: There&#39;s a lot of different approaches to do this. In the past you could use feature stapling. However, the new recommended approach is to use add-ins. My work environment is not currently set up to use SharePoint add-ins. My role is a developer and not an administrator, so I can&#39;t even set this up because there is a clear separation of duties. Also, we&#39;re in the very slow process of migrating to a new version, so any discussion of having this set up now is out of the question.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://dcsharepointchick.blogspot.com/2018/03/sharepoint-teamsite-branding-and-master.html&quot; target=&quot;_blank&quot;&gt;Instead of my previous approach&lt;/a&gt;, I decided I could script this out in a custom action. What&#39;s a custom action? You may recall custom actions in SharePoint designer. You could add these to the ribbon. You could also add custom actions with features and .NET code. That&#39;s exactly right! However, I&#39;m referring to using a custom action with a JavaScript file that is referenced in the site or entire site collection and is basically hidden in the site. There&#39;s no UI to add the custom action. It can however be added by Powershell&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://github.com/SharePoint/PnP-PowerShell/releases&quot; target=&quot;_blank&quot;&gt;SharePoint PNP powershell&lt;/a&gt; commands makes it easy to add these to the site collection.&lt;br /&gt;
&lt;br /&gt;
The idea here is to automatically set the master page as soon as a non-publishing site is created, or to have the option to inherit the look and feel from the site itself. There&#39;s no clear way to do either from the UI. With the JavaScript registered as a custom action on the site collection, any sub-site will run the JavaScript. The JavaScript will check to see if the site has just been created. If so, it will automatically update it with it&#39;s parent&#39;s master page, which you will see instantly change on the screen. Otherwise, it will exit out. If the team site was created a while ago but doesn&#39;t have the same branding as it&#39;s parent, users can go to Change the Look of the site from the gear icon. There, you will see a new red banner that allows you to inherit the branding of the parent.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjkm8r8ezfjpcrkrAsoE4VetB3rCLWAG3OZ4_tFUGaIXrPryfn6Sv85wX-4dgp-bE1FDZEMkY88eKWpxUcItD72_2z6qC-tS_E_uVfwpgCayY6AlLWyGSIInts0GX-dUHulgtaM2YkNUV8/s1600/banner.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;136&quot; data-original-width=&quot;683&quot; height=&quot;78&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjkm8r8ezfjpcrkrAsoE4VetB3rCLWAG3OZ4_tFUGaIXrPryfn6Sv85wX-4dgp-bE1FDZEMkY88eKWpxUcItD72_2z6qC-tS_E_uVfwpgCayY6AlLWyGSIInts0GX-dUHulgtaM2YkNUV8/s400/banner.jpg&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In my example, I grab the parent master page because I have a publishing site collection with team sites. You can change this example to explicitly state which master page you want to use.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The PNP commands are simple:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;Get the file from here&amp;nbsp;&lt;a href=&quot;https://gist.github.com/sparsee/0bb2218a2b42ba679d12b96ce7d645ae&quot;&gt;https://gist.github.com/sparsee/0bb2218a2b42ba679d12b96ce7d645ae&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;From the server, open the Powershell Prompt&lt;/li&gt;
&lt;li&gt;Connect to the site collection&lt;/li&gt;
&lt;ol&gt;
&lt;li&gt;You may get prompted for credentials&lt;/li&gt;
&lt;/ol&gt;
&lt;li&gt;Run the command to upload the javascript file from a folder on the server into the site collection&#39;s branding folder&lt;/li&gt;
&lt;li&gt;Run the command to register that javascript file as a custom action using the Add-PnPJavaScriptLink pnp command&lt;/li&gt;
&lt;li&gt;That&#39;s it! Create a team site in your site collection and voila!&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
$spSiteCollectionUrl = &quot;http://myweb/sites/testsitecollection&quot;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div&gt;
Write-Host &quot;Connecting to Site...&quot; -foregroundcolor black -backgroundcolor yellow&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
Connect-PnPOnline -Url $spSiteCollectionUrl&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
Write-Host &quot;Connection Established successfully&quot; -foregroundcolor black -backgroundcolor green&amp;nbsp;&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div&gt;
$Web = Get-PnPWeb&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;UploadFile &quot;\newbranding\scripts\CustomActions\CustomActionTeamSiteBranding.js&quot; &quot;_catalogs/masterpage/NewBranding/scripts/CustomActions&quot;&lt;br /&gt;
&lt;br /&gt;
$customActionJsLink = -join($Web.Url, &quot;/_catalogs/masterpage/NewBranding/scripts/CustomActions/CustomActionTeamSiteBranding.js&quot;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; Write-Host &#39;Adding custom action link... &#39; $customActionJsLink -foregroundcolor black -backgroundcolor yellow&lt;br /&gt;
&amp;nbsp; &amp;nbsp; Add-PnPJavaScriptLink -Name CustomActionTeamSiteBranding -Url $customActionJsLink -Scope Site&lt;br /&gt;
&amp;nbsp; &amp;nbsp; Write-Host &quot;Completed adding custom action&quot; -foregroundcolor black -backgroundcolor green&lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;&lt;b&gt;Note:&lt;/b&gt;&lt;/u&gt;&lt;br /&gt;
This strategy is part of the overall site provisioning. When I create new site collections, I have a much more involved script that adds site collection admins directly, turns on publishing features, adds all of the branding files (master pages, page layouts, css, etc), creates home pages with default web parts, and adds the custom action javascript files. I hope to share that script on this site very soon!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://dcsharepointchick.blogspot.com/feeds/3493953563352562490/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dcsharepointchick.blogspot.com/2019/04/sharepoint-team-site-branding-and.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7715120637497505141/posts/default/3493953563352562490'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7715120637497505141/posts/default/3493953563352562490'/><link rel='alternate' type='text/html' href='http://dcsharepointchick.blogspot.com/2019/04/sharepoint-team-site-branding-and.html' title='SharePoint Team site Branding and Master Page Inheritance '/><author><name>spar</name><uri>http://www.blogger.com/profile/05436274905022706601</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjkm8r8ezfjpcrkrAsoE4VetB3rCLWAG3OZ4_tFUGaIXrPryfn6Sv85wX-4dgp-bE1FDZEMkY88eKWpxUcItD72_2z6qC-tS_E_uVfwpgCayY6AlLWyGSIInts0GX-dUHulgtaM2YkNUV8/s72-c/banner.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7715120637497505141.post-3066386313738685090</id><published>2018-03-19T15:32:00.001-04:00</published><updated>2019-04-11T15:28:55.830-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="SharePoint 2010"/><category scheme="http://www.blogger.com/atom/ns#" term="SharePoint 2013"/><category scheme="http://www.blogger.com/atom/ns#" term="SharePoint online"/><category scheme="http://www.blogger.com/atom/ns#" term="team site branding inheritance"/><title type='text'>SharePoint TeamSite Branding and Master Page Inheritance Resolved</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;span style=&quot;background-color: yellow;&quot;&gt;UPDATE:&lt;/span&gt; &lt;a href=&quot;https://dcsharepointchick.blogspot.com/2019/04/sharepoint-team-site-branding-and.html&quot; target=&quot;_blank&quot;&gt;Check out this strategy I&#39;m taking now&amp;nbsp;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Out of the box, creating a team site will not inherit the master page of the site collection.&lt;br /&gt;
&lt;br /&gt;
There&#39;s a couple of ways to handle this:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;O&lt;span style=&quot;font-family: inherit;&quot;&gt;ccasionally go to the site collection settings, Look and Feel - &amp;gt;Master Page and &lt;/span&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;selecting, Specify a master page to be used by this site and all sites that inherit from it and check on&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&quot;Re&lt;/span&gt;set all subsites to inherit this site&#39;s master page setting&quot;&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;Drawback: This only impacts existing sites, but still doesn&#39;t handle any new team sites that are created&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;Going to the team site itself and then manually changing the master page at this location&amp;nbsp;/_layouts/ChangeSiteMasterPage.aspx&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;Drawback: Most end users wouldn&#39;t know how to do this and it&#39;s not accessible directly from the UI&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;Create a team site, update the master page manually, then save it as a site template&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;Drawback: this will not work if the root parent site is a publishing site or the team site has publishing features turned on&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;Remote provisioning&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;Read more here: https://docs.microsoft.com/en-us/sharepoint/dev/solution-guidance/branding-and-site-provisioning-solutions-for-sharepoint&lt;/li&gt;
&lt;li&gt;Drawback: A little learning curve&lt;/li&gt;
&lt;/ul&gt;
&lt;/ul&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;/ul&gt;
&lt;div&gt;
I thought about this for a while, and I realized the easiest way is to get some code in a content editor web part onto the teamsite that checks to see if the master page is set, and if not, it sets it.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
I put this in a team site, saved the site as a template, then hid the default team site template from the site collection settings.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;The code is found here:&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;a href=&quot;https://gist.github.com/sparsee/bbab4ff54695add4e91dfab7dc8a6a9e&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;https://gist.github.com/sparsee/bbab4ff54695add4e91dfab7dc8a6a9e&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://dcsharepointchick.blogspot.com/feeds/3066386313738685090/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dcsharepointchick.blogspot.com/2018/03/sharepoint-teamsite-branding-and-master.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7715120637497505141/posts/default/3066386313738685090'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7715120637497505141/posts/default/3066386313738685090'/><link rel='alternate' type='text/html' href='http://dcsharepointchick.blogspot.com/2018/03/sharepoint-teamsite-branding-and-master.html' title='SharePoint TeamSite Branding and Master Page Inheritance Resolved'/><author><name>spar</name><uri>http://www.blogger.com/profile/05436274905022706601</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7715120637497505141.post-8083297885818292328</id><published>2017-03-20T15:45:00.002-04:00</published><updated>2017-03-20T15:45:36.917-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="SharePoint 2010"/><title type='text'>SharePoint Upload.aspx page freezes when page loads</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Recently, I had an issue at a client site where the upload page in any document library would hang a little when opening in IE. There wasn&#39;t any issue in Chrome. This issue also wasn&#39;t occurring on all workstations, just a few. I knew it had to probably be an Office configuration, but group policy was preventing me from seeing any IE configurations. After diving into the source code of the upload.aspx page, I could see that the page was trying to load an ActiveX control, STSUpld.UploadCtl if the browser version was IE 5 and up. Upon investigation, the different workstations had different versions of this IE Add-on (from IE go to tools-&amp;gt;Manage add-ons).&lt;br /&gt;
&lt;br /&gt;
Chrome would skip the loading of the active x object. Therefore, after some head-banging, I decided to update the master page and add the following script to prevent creating the activex object. The script checks that the page is the upload.aspx and if it is, it sets browseris.ie5up to false to continue through the script. It&#39;s not a great fix, because it would have to be applied to all the master pages, however this would help appease users until the issue could be resolved by the IT team.&lt;br /&gt;
&lt;br /&gt;
&lt;table&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td class=&quot;line-content&quot;&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;&lt;table&gt;&lt;/table&gt;
&amp;lt;script type=&quot;text/javascript&quot;&amp;gt;&amp;nbsp;&lt;table&gt;&lt;/table&gt;
//added this script because for some users, the upload page would freeze. an activex control on the upload page is loaded for IE5 and up. we set this to be false here so that active x control is not created&lt;table&gt;&lt;/table&gt;
if( window.location.href.toLowerCase().indexOf(&quot;/_layouts/upload.aspx&quot;) &amp;gt;= 0 )&lt;table&gt;&lt;/table&gt;
{&lt;table&gt;&lt;/table&gt;
if (typeof browseris !== &#39;undefined&#39;) {&lt;table&gt;&lt;/table&gt;
//browseris.ie = false;&lt;table&gt;&lt;/table&gt;
browseris.ie5up = false;&lt;table&gt;&lt;/table&gt;
}&lt;table&gt;&lt;/table&gt;
}&lt;table&gt;&lt;/table&gt;
&amp;lt;/script&amp;gt;&lt;table&gt;&lt;/table&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://dcsharepointchick.blogspot.com/feeds/8083297885818292328/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dcsharepointchick.blogspot.com/2017/03/sharepoint-uploadaspx-page-freezes-when.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7715120637497505141/posts/default/8083297885818292328'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7715120637497505141/posts/default/8083297885818292328'/><link rel='alternate' type='text/html' href='http://dcsharepointchick.blogspot.com/2017/03/sharepoint-uploadaspx-page-freezes-when.html' title='SharePoint Upload.aspx page freezes when page loads'/><author><name>spar</name><uri>http://www.blogger.com/profile/05436274905022706601</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7715120637497505141.post-5667808445911784231</id><published>2016-12-19T09:25:00.000-05:00</published><updated>2016-12-19T09:26:43.099-05:00</updated><title type='text'>Print SharePoint html table</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
It&#39;s been a while since I&#39;ve posted anything, but I wanted to share a function that will take an html container or div control and print it to a new page. It will also grab the css files and output it to the head of the new page to maintain the styles when you print&lt;br /&gt;
&lt;br /&gt;
This is dependent on the jquery library, found here:&lt;br /&gt;
&amp;lt;script type=&quot;text/javascript&quot; src=&quot;https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
//This function will grab the html from the container var to display in a new window.&lt;br /&gt;
//It also loads the css files that are on the current page and appends it to the output that is displayed in a new window to maintain the styles&lt;br /&gt;
//Title: Specify the title of the page that you wish to name when the print page opens&lt;br /&gt;
//Container: pass in the name of the container you wish to print. Ex. $(&quot;$tableName&quot;)&lt;br /&gt;
function PrintPage(title, container)&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp;//declare the css files with the styles you wish to grab and keep in the in the head of the new window&lt;br /&gt;
&amp;nbsp;var m_siteUrl = _spPageContextInfo.webServerRelativeUrl; //IE11 in sp 2013 does not recognize L_Menu_BaseUrl&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;var curDate = new Date();&lt;br /&gt;
&amp;nbsp;var cssLink1 = m_siteUrl + &quot;/siteassets/css/tablesorter/style.css?v=&quot; + curDate.format(&quot;MM_dd_yyyy&quot;);&lt;br /&gt;
&amp;nbsp;var cssLink2 = m_siteUrl + &quot;/siteassets/css/My_Page_Reports.css?v=&quot; + curDate.format(&quot;MM_dd_yyyy&quot;);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;var divOutput = $(container).html();&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;//append the current date/time to the output window &amp;nbsp;&lt;br /&gt;
&amp;nbsp;var printDateString = curDate.format(&quot;MM/dd/yyyy hh:mm tt&quot;);&lt;br /&gt;
&amp;nbsp;printDateString = &quot;&amp;lt;div style=&#39;padding-bottom:10px;&#39;&amp;gt;&quot; + printDateString + &quot;&amp;lt;/div&amp;gt;&quot;;&lt;br /&gt;
&amp;nbsp;divOutput = printDateString + divOutput;&lt;br /&gt;
&amp;nbsp;&lt;br /&gt;
&amp;nbsp;var cssFile1 = $(&#39;&amp;lt;div&amp;gt;&amp;lt;/div&amp;gt;&#39;);&lt;br /&gt;
&amp;nbsp;var cssFile2 = $(&#39;&amp;lt;div&amp;gt;&amp;lt;/div&amp;gt;&#39;);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;//used for the callbacks&lt;br /&gt;
&amp;nbsp;var def1 = $.Deferred();&lt;br /&gt;
&amp;nbsp;var def2 = $.Deferred(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp;//loads the css files and grabs all of the css to input into style tags&lt;br /&gt;
&amp;nbsp;var cssFileText = &quot;&quot;;&lt;br /&gt;
&amp;nbsp;cssFile1.load( cssLink1, function() { cssFileText += &quot;&amp;lt;style&amp;gt;&quot; + cssFile1.html() + &quot;&amp;lt;/style&amp;gt;&quot;; def1.resolve()} );&lt;br /&gt;
&amp;nbsp;cssFile2.load( cssLink2, function() { cssFileText += &quot;&amp;lt;style&amp;gt;&quot; + cssFile2.html() + &quot;&amp;lt;/style&amp;gt;&quot;; def2.resolve()} );&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;//gets called asynchronously after the css files have been loaded&lt;br /&gt;
&amp;nbsp;$.when(def1, def2).done(function(){&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;//generate the html that will be displayed in the new page.&lt;br /&gt;
&amp;nbsp;//set the title of the new window&lt;br /&gt;
&amp;nbsp;//additionally, can put the class names you wish to hide on printing &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp;var html = &quot;&amp;lt;HTML&amp;gt;\n&quot; +&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &quot;&amp;lt;HEAD&amp;gt;\n\n&quot;+&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &quot;&amp;lt;Title&amp;gt;&quot; + title + &quot;&amp;lt;/Title&amp;gt;\n&quot; +&lt;br /&gt;
&amp;nbsp; &amp;nbsp; cssFileText + &quot;\n&quot; +&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &quot;&amp;lt;style&amp;gt;&quot;+&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;&quot;.hideOnPrint, .rowFilters {display:none}&quot;+&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &quot;&amp;lt;/style&amp;gt;\n&quot;+&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&quot;&amp;lt;/HEAD&amp;gt;\n&quot; +&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&quot;&amp;lt;BODY&amp;gt;\n&quot; + divOutput + &quot;\n&quot; +&quot;&amp;lt;/BODY&amp;gt;\n&quot; +&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&quot;&amp;lt;/HTML&amp;gt;&quot;;&lt;br /&gt;
&amp;nbsp;&lt;br /&gt;
&amp;nbsp;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;var printWP = window.open(&quot;&quot;,&quot;printWebPart&quot;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp;printWP.document.open();&lt;br /&gt;
&amp;nbsp; &amp;nbsp;//insert content&lt;br /&gt;
&amp;nbsp; &amp;nbsp;printWP.document.write(html);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp;printWP.document.close();&lt;br /&gt;
&amp;nbsp; &amp;nbsp;//open print dialog&lt;br /&gt;
&amp;nbsp; &amp;nbsp;printWP.print();&lt;br /&gt;
&amp;nbsp; }); &amp;nbsp; &lt;br /&gt;
}&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://dcsharepointchick.blogspot.com/feeds/5667808445911784231/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dcsharepointchick.blogspot.com/2016/12/print-sharepoint-html-table.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7715120637497505141/posts/default/5667808445911784231'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7715120637497505141/posts/default/5667808445911784231'/><link rel='alternate' type='text/html' href='http://dcsharepointchick.blogspot.com/2016/12/print-sharepoint-html-table.html' title='Print SharePoint html table'/><author><name>spar</name><uri>http://www.blogger.com/profile/05436274905022706601</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7715120637497505141.post-3689313808130408326</id><published>2013-09-24T16:23:00.004-04:00</published><updated>2013-09-24T16:23:59.011-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Infopath"/><category scheme="http://www.blogger.com/atom/ns#" term="JQuery"/><category scheme="http://www.blogger.com/atom/ns#" term="List form"/><category scheme="http://www.blogger.com/atom/ns#" term="People picker"/><title type='text'>Format SharePoint People Picker as Hyperlink on Infopath Display list form </title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
I wanted to display the people picker value in a list form as a hyperlink in SharePoint. By default, it was just a text field on the display form. In a normal SharePoint list form, this field can be modified to disable output escaping so that it formats as an html. I was totally unsure how to accomplish this, and pressed for time, I decided to write a script to format it as a hyperlink. If you know how to do this in InfoPath, please share!&lt;br /&gt;
&lt;br /&gt;
Place this script in a content editor webpart on the display list form:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-html&quot;&gt;&amp;lt;script type=&#39;text/javascript&#39; src=&#39;/js/jquery-1.7.2.min.js&#39;&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script type=&quot;text/javascript&quot;&amp;gt;

//make sure document is loaded first
$(document).ready(function() { 
&amp;nbsp;setTimeout(formatUserField,&#39;1000&#39;);
});

function formatUserField()
{
&amp;nbsp;$(&quot;span[ScriptClass=&#39;CustomControl&#39;]&quot;).each(function(){
&amp;nbsp;&amp;nbsp;var curValue = $(this).text();
&amp;nbsp;&amp;nbsp;var newhtml = &quot;&amp;lt;a href=&#39;javascript:void(0)&#39; onclick=&#39;PopUpEmail(\&quot;&quot; + curValue + &quot;\&quot;);return false;&#39;&amp;gt;&quot;+ curValue +&quot;&amp;lt;/a&amp;gt;&quot;;
&amp;nbsp;&amp;nbsp;$(this).html(newhtml);
&amp;nbsp;});
}

function PopUpEmail(username)
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; var p_recipient = username;
&amp;nbsp;&amp;nbsp;&amp;nbsp; var p_cc = &quot;&quot;;
&amp;nbsp;&amp;nbsp;&amp;nbsp; var p_subject =&amp;nbsp; &quot;&quot;;
&amp;nbsp;&amp;nbsp;&amp;nbsp; var p_body =&amp;nbsp; &quot;&quot;;
&amp;nbsp;&amp;nbsp;&amp;nbsp; var objO = new ActiveXObject(&#39;Outlook.Application&#39;);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; var objNS = objO.GetNameSpace(&#39;MAPI&#39;);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; var mItm = objO.CreateItem(0);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; mItm.Display();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; mItm.To = p_recipient;
&amp;nbsp;&amp;nbsp;&amp;nbsp; mItm.Cc = p_cc;
&amp;nbsp;&amp;nbsp;&amp;nbsp; mItm.Subject = p_subject;
&amp;nbsp;&amp;nbsp;&amp;nbsp; mItm.Body = p_body;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; mItm.GetInspector.WindowState = 2;
}

&amp;lt;/script&amp;gt;

&lt;style&gt;
b { color: blue }
u { color: &quot;umber&quot; }
&lt;/style&gt;&lt;/pre&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://dcsharepointchick.blogspot.com/feeds/3689313808130408326/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dcsharepointchick.blogspot.com/2013/09/format-sharepoint-people-picker-as.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7715120637497505141/posts/default/3689313808130408326'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7715120637497505141/posts/default/3689313808130408326'/><link rel='alternate' type='text/html' href='http://dcsharepointchick.blogspot.com/2013/09/format-sharepoint-people-picker-as.html' title='Format SharePoint People Picker as Hyperlink on Infopath Display list form '/><author><name>spar</name><uri>http://www.blogger.com/profile/05436274905022706601</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7715120637497505141.post-1440352583003046773</id><published>2013-09-10T12:07:00.001-04:00</published><updated>2013-09-10T12:07:24.994-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="embed image"/><category scheme="http://www.blogger.com/atom/ns#" term="SharePoint Designer"/><category scheme="http://www.blogger.com/atom/ns#" term="spdactivities"/><category scheme="http://www.blogger.com/atom/ns#" term="workflow"/><title type='text'>Embed image in a SharePoint outgoing email using SharePoint Designer workflow activities</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;If you need to embed an image into a SharePoint outgoing email:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Install&amp;nbsp;&lt;span style=&quot;color: #253340; line-height: 19.015625px;&quot;&gt;&lt;a href=&quot;http://spdactivities.codeplex.com/&quot;&gt;http://spdactivities.codeplex.com/&lt;/a&gt;&amp;nbsp;&lt;/span&gt;for 2007 OR&amp;nbsp;&lt;a href=&quot;http://spdactivities2010.codeplex.com/&quot;&gt;http://spdactivities2010.codeplex.com/&lt;/a&gt;&amp;nbsp;for 2010&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Open SharePoint Designer and create a workflow variable named emailBody&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;In the variable, add the following at the very beggining, replacing Myimage.jpg with the name of your image:&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&amp;lt;head&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&amp;lt;meta name=&quot;content-disposition&quot; content=&quot;inline; filename=Myimage.jpg&quot;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Format your email, and then to insert the image, create a div tag at the bottom of the email string:&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&amp;lt;div style=&quot;text-align: center;&quot;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&amp;lt;img src=&quot;Myimage.jpg&quot; alt=&quot;myimagelogo&quot; /&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Add the action: Send Email with List Item Attachments&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Attach the image in the activity, with the same name as used above (Myimage.jpg)&lt;/span&gt;&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;In mine, I always want to attach the same image in every outgoing email, so I uploaded an image to a SharePoint document library and I attached the image based on the specific title it contained&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;In the email body of the action, add the workflow variable: emailBody&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Save, publish and test it out!&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://dcsharepointchick.blogspot.com/feeds/1440352583003046773/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dcsharepointchick.blogspot.com/2013/09/embed-image-in-sharepoint-outgoing.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7715120637497505141/posts/default/1440352583003046773'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7715120637497505141/posts/default/1440352583003046773'/><link rel='alternate' type='text/html' href='http://dcsharepointchick.blogspot.com/2013/09/embed-image-in-sharepoint-outgoing.html' title='Embed image in a SharePoint outgoing email using SharePoint Designer workflow activities'/><author><name>spar</name><uri>http://www.blogger.com/profile/05436274905022706601</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7715120637497505141.post-5655558350922693239</id><published>2013-05-03T13:00:00.002-04:00</published><updated>2013-05-03T13:00:50.581-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="JQuery"/><category scheme="http://www.blogger.com/atom/ns#" term="list view web part"/><title type='text'>Filter SharePoint list with Partial Postback to page</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
The other day, I wanted to filter a list view web part, triggered from a drop down list on my page. I couldn&#39;t connect to a standard out of the box filter web part because the dropdown values&amp;nbsp;were populated with values&amp;nbsp;retrieved from a web service. Every time I select a new value from the drop down, I wanted to automatically filter the sharepoint list with that value, without doing a full postback and refreshing the page&amp;nbsp;(similar to the effect of when you filter a list from the list column options).&lt;br /&gt;
&lt;br /&gt;
To start things off:&lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;div style=&quot;text-align: left;&quot;&gt;
I created a document library and created a new column called &quot;DocType&quot; with a few choices:&lt;/div&gt;
&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;Letter&lt;/li&gt;
&lt;li&gt;Memo&lt;/li&gt;
&lt;li&gt;Email&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;&lt;div style=&quot;text-align: left;&quot;&gt;
I made sure the DocType column appeared on my default view (this will be the view I use to do my filtering later)&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;&lt;div style=&quot;text-align: left;&quot;&gt;
I uploaded&amp;nbsp;a few documents into my library, and provided the DocType for each&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;&lt;div style=&quot;text-align: left;&quot;&gt;
On my site page, I added the list view web part for this Document Library&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;&lt;div style=&quot;text-align: left;&quot;&gt;
From the AJAX Options under the list view web part settings:&lt;/div&gt;
&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;Check off Enable Asynchronous Update&lt;/li&gt;
&lt;li&gt;Show Manual Refresh Button&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;&lt;div style=&quot;text-align: left;&quot;&gt;
Using IE developer tools, find the element for the refresh icon with the id of ManualRefresh&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhpk4GRzJ5QEfyUCUr5kW_wReZi4dTaaMLWWdKpzq2HrM4XlmfJEAKuGKByFof_6BBuL38q9rPigF3AK4TGBQHR6BZ8TVzhRjpocQ5eMLZMJkQbyxwKgD-zV5ig6ZsY3S9HkPa1DM-lZcM/s1600/ManualrefreshIcon.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;122&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhpk4GRzJ5QEfyUCUr5kW_wReZi4dTaaMLWWdKpzq2HrM4XlmfJEAKuGKByFof_6BBuL38q9rPigF3AK4TGBQHR6BZ8TVzhRjpocQ5eMLZMJkQbyxwKgD-zV5ig6ZsY3S9HkPa1DM-lZcM/s400/ManualrefreshIcon.jpg&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
Copy the outer anchor tag&#39;s onclick event (this event triggers a partial post back to the page)&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjro2zDdxJWXuoh-ZVf_BlX6KU-UcQPfpa-aL3FqDOAqVYBeVSRNsfMUAs992iwCnBZxleGQQGFHqSwc2sVFhOcUBDrP6mkSm4g5PQKArWP-L4M0a5nBD4MPj2lZLorcem2w9cE2bdUxTQ/s1600/refresh.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;271&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjro2zDdxJWXuoh-ZVf_BlX6KU-UcQPfpa-aL3FqDOAqVYBeVSRNsfMUAs992iwCnBZxleGQQGFHqSwc2sVFhOcUBDrP6mkSm4g5PQKArWP-L4M0a5nBD4MPj2lZLorcem2w9cE2bdUxTQ/s640/refresh.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;Add a form web part to the same page&lt;/li&gt;
&lt;li&gt;Grab the ID in the __doPostBack call and replace it in this script, and put the script into the form web part and save. &lt;/li&gt;
&lt;/ul&gt;
&lt;pre class=&quot;prettyprint lang-html&quot;&gt;&amp;lt;div style=&quot;width:400px; height:20px; margin:0px auto; padding-bottom:20px;&amp;nbsp;font-family:Verdana,Arial,Helvetica,Sans-serif;font-size:10pt;&quot;&amp;gt;
&amp;nbsp;Select Doc Type: 
&amp;nbsp;&amp;lt;select id=&quot;ddlDocType&quot;&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;lt;option&amp;gt;&amp;lt;/option&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;lt;option&amp;gt;Letter&amp;lt;/option&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;lt;option&amp;gt;Memo&amp;lt;/option&amp;gt;
&amp;nbsp;&amp;lt;/select&amp;gt;
&amp;lt;/div&amp;gt;


&amp;lt;script type=&#39;text/javascript&#39; src=&#39;/assets/js/jquery-1.7.2.min.js&#39;&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script type=&quot;text/javascript&quot;&amp;gt; 

$(document).ready(function(){
&amp;nbsp;//on the dropdown change event, call FilterMyList
&amp;nbsp;$(&quot;#ddlDocType&quot;).change(function(){
&amp;nbsp;&amp;nbsp;FilterMyList();;
&amp;nbsp;});
});


function FilterMyList()
{
//get the selected value of the drop down
&amp;nbsp;var selectedDocType = $(&quot;#ddlDocType&quot;).val();
&amp;nbsp;if(selectedDocType == &quot;&quot; )
&amp;nbsp;{&amp;nbsp;
&amp;nbsp;//clears the filter
&amp;nbsp;&amp;nbsp;__doPostBack(&quot;ctl00$m$g_95403266_84ab_485e_be73_8857b5d90f63$ctl02&quot;, &quot;NotUTF8;__filter={DocType=&quot; + &quot;##dvt_all##&quot;&amp;nbsp; + &quot;}&quot;);
&amp;nbsp;&amp;nbsp;return;
&amp;nbsp;}
&amp;nbsp;//filters the list on the selected docType
&amp;nbsp;__doPostBack(&quot;ctl00$m$g_95403266_84ab_485e_be73_8857b5d90f63$ctl02&quot;, &quot;NotUTF8;__filter={DocType=&quot; + selectedDocType + &quot;}&quot;);
}&amp;nbsp; 
&amp;lt;/script&amp;gt;


&lt;style&gt;
b { color: blue }
u { color: &quot;umber&quot; }
&lt;/style&gt;&lt;/pre&gt;
Now, when you select a value from the dropdown, it should automatically filter the list without a full postback&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_0TzwnnV5tl-4tQ0m7CcoGaExJTulZQyLktmu3x1pV-nA4JNU7_Lqz0Qjorkp2DH59xALJpettZSFBoHnhPFbMgM0L7t-oGkcYmq2h75cP_jmGtyD2hb5xG78V9n5q3ahyphenhyphenhHFFnUW2OE/s1600/filteredResults.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;190&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_0TzwnnV5tl-4tQ0m7CcoGaExJTulZQyLktmu3x1pV-nA4JNU7_Lqz0Qjorkp2DH59xALJpettZSFBoHnhPFbMgM0L7t-oGkcYmq2h75cP_jmGtyD2hb5xG78V9n5q3ahyphenhyphenhHFFnUW2OE/s400/filteredResults.jpg&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&amp;nbsp;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://dcsharepointchick.blogspot.com/feeds/5655558350922693239/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dcsharepointchick.blogspot.com/2013/05/filter-sharepoint-list-with-partial-postback.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7715120637497505141/posts/default/5655558350922693239'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7715120637497505141/posts/default/5655558350922693239'/><link rel='alternate' type='text/html' href='http://dcsharepointchick.blogspot.com/2013/05/filter-sharepoint-list-with-partial-postback.html' title='Filter SharePoint list with Partial Postback to page'/><author><name>spar</name><uri>http://www.blogger.com/profile/05436274905022706601</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhpk4GRzJ5QEfyUCUr5kW_wReZi4dTaaMLWWdKpzq2HrM4XlmfJEAKuGKByFof_6BBuL38q9rPigF3AK4TGBQHR6BZ8TVzhRjpocQ5eMLZMJkQbyxwKgD-zV5ig6ZsY3S9HkPa1DM-lZcM/s72-c/ManualrefreshIcon.jpg" height="72" width="72"/><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7715120637497505141.post-2349734660988470593</id><published>2013-05-01T16:14:00.001-04:00</published><updated>2013-05-01T16:14:43.825-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="SharePoint"/><category scheme="http://www.blogger.com/atom/ns#" term="Site Actions Menu"/><title type='text'>SharePoint Site Actions Menu: Hide Sync to Workspace and Edit in SharePoint Designer</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
In my environment, I do not want to show users the Site Actions menu options that allow them&amp;nbsp;to sync to workspace or click on Edit in SharePoint Designer.&lt;br /&gt;
&lt;br /&gt;
I created&amp;nbsp;this script that would iterate the menu options and hide the ones I didnt want available&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-html&quot;&gt;ExecuteOrDelayUntilScriptLoaded(HideSiteActionMenuItems, &quot;SP.Ribbon.js&quot;);


function HideSiteActionMenuItems()
{
&amp;nbsp;var menuItems = document.getElementsByTagName(&quot;ie:menuitem&quot;);
&amp;nbsp;if( menuItems != null )
&amp;nbsp;{
&amp;nbsp;&amp;nbsp;for( var i = 0; i &amp;lt; menuItems.length; i++ )
&amp;nbsp;&amp;nbsp;{
&amp;nbsp;&amp;nbsp;&amp;nbsp;var keyId = menuItems[i].id;
&amp;nbsp;&amp;nbsp;&amp;nbsp;if(keyId.endsWith(&quot;MenuItem_TakeOffline&quot;))//Hide Sync to SharePoint Workspace
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;menuItems[keyId ].hidden = true;
&amp;nbsp;&amp;nbsp;&amp;nbsp;else if( keyId.endsWith(&quot;MenuItem_EditSite&quot;)) //Hide Edit in SharePoint Designer
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;menuItems[keyId].hidden = true;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;}
&amp;nbsp;}
}

&amp;nbsp;


&lt;style&gt;
b { color: blue }
u { color: &quot;umber&quot; }
&lt;/style&gt;
&lt;/pre&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://dcsharepointchick.blogspot.com/feeds/2349734660988470593/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dcsharepointchick.blogspot.com/2013/05/sharepoint-site-actions-menu-hide-sync.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7715120637497505141/posts/default/2349734660988470593'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7715120637497505141/posts/default/2349734660988470593'/><link rel='alternate' type='text/html' href='http://dcsharepointchick.blogspot.com/2013/05/sharepoint-site-actions-menu-hide-sync.html' title='SharePoint Site Actions Menu: Hide Sync to Workspace and Edit in SharePoint Designer'/><author><name>spar</name><uri>http://www.blogger.com/profile/05436274905022706601</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7715120637497505141.post-9056237660161841282</id><published>2013-05-01T15:57:00.001-04:00</published><updated>2013-05-01T15:59:00.167-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Calendar"/><title type='text'>SharePoint Calendar: Expand all events on load</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
This is my approach to expand all calendar events on load,&amp;nbsp;but if you have a better way, please share!&lt;br /&gt;
&lt;br /&gt;
On the calendar page, add a reference to jQuery and also place a style tag to hide the &quot;expand/collapse&quot; links on load:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-html&quot;&gt;&amp;lt;style&amp;gt;
&amp;nbsp;.ms-cal-nav{display:none;}
&amp;lt;/style&amp;gt;

&lt;/pre&gt;
&lt;br /&gt;
Hook into the existing SharePoint calendar load function:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-html&quot;&gt;_spBodyOnLoadFunctionNames.push(&#39;changeCalendarEventLinkIntercept&#39;);
&lt;/pre&gt;
&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-html&quot;&gt;function changeCalendarEventLinkIntercept()
{
&amp;nbsp; var OldCalendarNotify4a = SP.UI.ApplicationPages.CalendarNotify.$4b;
&amp;nbsp; SP.UI.ApplicationPages.CalendarNotify.$4b = function () 
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OldCalendarNotify4a();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; changeCalendarEventLinks();
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
}

&lt;style&gt;
b { color: blue }
u { color: &quot;umber&quot; }
&lt;/style&gt;
&lt;/pre&gt;
In the function call, find all anchor tags with the attribute evtid marked as &#39;expand_collapse&#39; and click on the hyperlink:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-html&quot;&gt;function changeCalendarEventLinks()
{
//expand all
&amp;nbsp;$(&quot;a[evtid=&#39;expand_collapse&#39;]&quot;).each(function(){
&amp;nbsp;&amp;nbsp;$(this)[0].click();
&amp;nbsp;});
}
&lt;style&gt;
b { color: blue }
u { color: &quot;umber&quot; }
&lt;/style&gt;
&lt;/pre&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://dcsharepointchick.blogspot.com/feeds/9056237660161841282/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dcsharepointchick.blogspot.com/2013/05/sharepoint-calendar-expand-all-events.html#comment-form' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7715120637497505141/posts/default/9056237660161841282'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7715120637497505141/posts/default/9056237660161841282'/><link rel='alternate' type='text/html' href='http://dcsharepointchick.blogspot.com/2013/05/sharepoint-calendar-expand-all-events.html' title='SharePoint Calendar: Expand all events on load'/><author><name>spar</name><uri>http://www.blogger.com/profile/05436274905022706601</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7715120637497505141.post-4313554537229490497</id><published>2013-05-01T15:35:00.000-04:00</published><updated>2013-05-01T15:44:24.916-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Calendar"/><category scheme="http://www.blogger.com/atom/ns#" term="Calendar Overlay"/><category scheme="http://www.blogger.com/atom/ns#" term="color coded"/><category scheme="http://www.blogger.com/atom/ns#" term="JQuery"/><title type='text'>SharePoint Calendar Overlay - Color code documents and display direct links to document library</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
I wanted to have a color coded view of documents in a SharePoint calendar, that would be populated from a document library. Also, the link on each item in the calendar would point directly to the document itself. We will also want to make sure that all documents for that date are expanded by default. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
End Result: (on hover, you&#39;ll see that the hyperlink has changed to the direct link to the document)&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgiEr3xiGKCFx78JzfY0dwhkC6tfC1GUl709dHtPzGnQfszx93EDmiyZkGbgDjy9rijrrSviMOT-UQexa1KXJPxteeZvpw1TEgyVAL0ibTzT6egBALVJ79FI4Dn7iiR6yd-7xxdKG_OGvI/s1600/Result.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;336&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgiEr3xiGKCFx78JzfY0dwhkC6tfC1GUl709dHtPzGnQfszx93EDmiyZkGbgDjy9rijrrSviMOT-UQexa1KXJPxteeZvpw1TEgyVAL0ibTzT6egBALVJ79FI4Dn7iiR6yd-7xxdKG_OGvI/s640/Result.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;In a document library, create a column that you want to categorize your documents. I chose to create a choice field called &quot;Document Type&quot; and gave it 3 choices:&lt;/li&gt;
&lt;ol&gt;
&lt;li&gt;RFP&lt;/li&gt;
&lt;li&gt;Proposal&lt;/li&gt;
&lt;li&gt;Contract&lt;/li&gt;
&lt;/ol&gt;
&lt;li&gt;In the same library, create a date column that you will use to show the documents in&amp;nbsp;a calendar. I chose to create a date field called &quot;Due Date&quot;&lt;/li&gt;
&lt;li&gt;Upload your documents, and provide the Document Type and the Due Date for each.&lt;/li&gt;
&lt;/ol&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiPrx7tO7dFVps6QWbKZ4G6zaYjmvxQ0HNbU0CGvG8ALqe035ci6shhs0zqVUicFLNGzriuEzpX9OwD6oR7TFh_J251XhIZtWgTCTq6Pd1hua-ghPTAriilHaGecizGuU2WrPuxcv1EP6w/s1600/SharedDocuments.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;132&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiPrx7tO7dFVps6QWbKZ4G6zaYjmvxQ0HNbU0CGvG8ALqe035ci6shhs0zqVUicFLNGzriuEzpX9OwD6oR7TFh_J251XhIZtWgTCTq6Pd1hua-ghPTAriilHaGecizGuU2WrPuxcv1EP6w/s640/SharedDocuments.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;In the libray, create a Calendar&amp;nbsp;view for each particular Document Type&lt;/li&gt;
&lt;ol&gt;
&lt;li&gt;For the name of the view, input the document type&lt;/li&gt;
&lt;li&gt;For the Begin and End date, select the Due Date field&lt;/li&gt;
&lt;li&gt;For the month view, week view and day view titles, select the Document Type field from the drop&amp;nbsp;down.&lt;/li&gt;
&lt;li&gt;Filter this view on the&amp;nbsp;desired Document Type&lt;/li&gt;
&lt;/ol&gt;
&lt;/ol&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiKLKFfwbL9SCk1tvJdTOnk4n-KIjm3KGz3DDYWJyCIm5nQS4qFy-qah86Ra3jfMziip_UzMctpKNRvKWY6j2UM8xAw6hUkJyTvKpcglvV5jVSdBO8ovYXaawOg3f96YQebqiT_9C-l4WA/s1600/ShareDocumentsDocTypeView.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;640&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiKLKFfwbL9SCk1tvJdTOnk4n-KIjm3KGz3DDYWJyCIm5nQS4qFy-qah86Ra3jfMziip_UzMctpKNRvKWY6j2UM8xAw6hUkJyTvKpcglvV5jVSdBO8ovYXaawOg3f96YQebqiT_9C-l4WA/s640/ShareDocumentsDocTypeView.jpg&quot; width=&quot;464&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;Now that all the views have been created, go to the Calendar&amp;nbsp;(a team site should already have one, if it doesn&#39;t, create&amp;nbsp;one). &lt;/li&gt;
&lt;li&gt;On the Calendar,&amp;nbsp;select the Calendar tab&amp;nbsp;from the&amp;nbsp;ribbon and click on the Calendars Overlay&lt;/li&gt;
&lt;li&gt;From there, click New Calendar&lt;/li&gt;
&lt;ol&gt;
&lt;li&gt;Give the calendar the name of the Document Type&lt;/li&gt;
&lt;li&gt;Select a color&lt;/li&gt;
&lt;li&gt;From the list drop down, select the document library that you configured earlier&lt;/li&gt;
&lt;li&gt;Select the Calendar view corresponding to the Document Type&lt;/li&gt;
&lt;li&gt;Repeat for each document type&lt;/li&gt;
&lt;/ol&gt;
&lt;/ol&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhdy80K8SutMXbA3mU5pLTolsCzMfC2e2LHi8FH9czVMKdREYBedmCTMZU-Mhg85zYmw4OijqfzPeXPPnM-zI_DDWAug7ctTAZqmkkRWheE0UDAKuxefUa6zJsoVvai_u0afAAtd7fBXvc/s1600/CalendarOverlay.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;296&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhdy80K8SutMXbA3mU5pLTolsCzMfC2e2LHi8FH9czVMKdREYBedmCTMZU-Mhg85zYmw4OijqfzPeXPPnM-zI_DDWAug7ctTAZqmkkRWheE0UDAKuxefUa6zJsoVvai_u0afAAtd7fBXvc/s640/CalendarOverlay.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Now all the documents will appear on the calendar, color coded based on Document&amp;nbsp;Type and displayed based on Due Date&lt;br /&gt;
&lt;br /&gt;
Next up:&amp;nbsp;We will need to create a script, that we will use to override the CalendarNotify so that we can manipulate the hyperlinks on our Calendar to point directly to the document, instead of the list form&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;Create a javascript file and store it in your assets library&lt;/li&gt;
&lt;ol&gt;
&lt;li&gt;Add a reference to jQuery and SPServices&lt;/li&gt;
&lt;/ol&gt;
&lt;/ol&gt;
Add the following script &lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-html&quot;&gt;&amp;lt;style&amp;gt;

/* hide the collapse/expand on load (we will make it expand in script) */
.ms-cal-nav{display:none;}

/*hide the time */
.ms-acal-time {
&amp;nbsp;DISPLAY: none
}

.ms-acal-sdiv {
&amp;nbsp;MARGIN-LEFT: -58px
}

.ms-acal-sdiv A {
&amp;nbsp;POSITION: absolute; WIDTH: 100%; LEFT: 0px
}

.ms-acal-title {
&amp;nbsp;HEIGHT: 35px; PADDING-TOP: 0px
}

TABLE.ms-acal-vcont TBODY TR TD A {

&amp;nbsp;DISPLAY: none !important

}


&amp;lt;/style&amp;gt;

&amp;lt;script type=&#39;text/javascript&#39; src=&#39;/assets/js/jquery-1.7.2.min.js&#39;&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script type=&#39;text/javascript&#39; src=&#39;/assets/js/jquery.SPServices-0.7.1a.min.js&#39;&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script type=&quot;text/javascript&quot;&amp;gt;



// load our function to the delayed load list
_spBodyOnLoadFunctionNames.push(&#39;changeCalendarEventLinkIntercept&#39;);


// hook into the existing SharePoint calendar load function
function changeCalendarEventLinkIntercept()

{
&amp;nbsp; var OldCalendarNotify4a = SP.UI.ApplicationPages.CalendarNotify.$4b;

&amp;nbsp; SP.UI.ApplicationPages.CalendarNotify.$4b = function () 
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OldCalendarNotify4a();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; changeCalendarEventLinks();
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
}

var thisSite = L_Menu_BaseUrl; //defined in SharePoint pages

function changeCalendarEventLinks()
{

&amp;nbsp;//expand all in the day
&amp;nbsp;$(&quot;a[evtid=&#39;expand_collapse&#39;]&quot;).each(function(){
&amp;nbsp;&amp;nbsp;$(this)[0].click();
&amp;nbsp;});

&amp;nbsp;$(&quot;.ms-acal-sdiv&quot;).each(function(){
&amp;nbsp;&amp;nbsp;var aLink = $(this).find(&quot;a&quot;);
&amp;nbsp;&amp;nbsp;var href = aLink.attr(&quot;href&quot;);
&amp;nbsp;&amp;nbsp;var linkSubs = href.split(&quot;ID=&quot;);
&amp;nbsp;&amp;nbsp;var itemId = linkSubs[1];
&amp;nbsp;&amp;nbsp;var listName = linkSubs[0].replace(thisSite +&quot;/&quot;,&quot;&quot;);
&amp;nbsp;&amp;nbsp;listName = listName.replace(&quot;/Forms/DispForm.aspx?&quot;,&quot;&quot;);
&amp;nbsp;&amp;nbsp;GetListData(listName, itemId, aLink);

&amp;nbsp;});

&amp;nbsp;//necessary if date has more than 1 document
&amp;nbsp;$(&quot;.ms-acal-mdiv&quot;).each(function(){
&amp;nbsp;&amp;nbsp;var aLink = $(this).find(&quot;a&quot;);
&amp;nbsp;&amp;nbsp;var href = aLink.attr(&quot;href&quot;);
&amp;nbsp;&amp;nbsp;var linkSubs = href.split(&quot;ID=&quot;);
&amp;nbsp;&amp;nbsp;var itemId = linkSubs[1];
&amp;nbsp;&amp;nbsp;var listName = linkSubs[0].replace(thisSite +&quot;/&quot;,&quot;&quot;);
&amp;nbsp;&amp;nbsp;listName = listName.replace(&quot;/Forms/DispForm.aspx?&quot;,&quot;&quot;);
&amp;nbsp;&amp;nbsp;GetListData(listName, itemId, aLink);

&amp;nbsp;});

&amp;nbsp;$(&#39;td[evtid=day]&#39;).removeAttr(&#39;evtid&#39;);
&amp;nbsp;$(&#39;th[evtid=week]&#39;).removeAttr(&#39;evtid&#39;);
}



//go out and get the file name of the document, so that the link to the calendar will be a direct link to the document

function GetListData(listName, itemId, aLink){

&amp;nbsp;var linkRef = &quot;&quot;;
&amp;nbsp;var camlFields = &quot;&amp;lt;ViewFields&amp;gt;&amp;lt;FieldRef Name=&#39;ID&#39;/&amp;gt;&amp;lt;FieldRef Name=&#39;FileLeafRef&#39;/&amp;gt;&amp;lt;/ViewFields&amp;gt;&quot;;
&amp;nbsp;var camlQuery = &quot;&amp;lt;Query&amp;gt;&amp;lt;Where&amp;gt;&amp;lt;Eq&amp;gt;&amp;lt;FieldRef Name=&#39;ID&#39;/&amp;gt;&amp;lt;Value Type=&#39;Text&#39;&amp;gt;&quot; + itemId + &quot;&amp;lt;/Value&amp;gt;&amp;lt;/Eq&amp;gt;&amp;lt;/Where&amp;gt;&amp;lt;OrderBy&amp;gt;&amp;lt;FieldRef Name=&#39;ID&#39;/&amp;gt;&amp;lt;/OrderBy&amp;gt;&amp;lt;/Query&amp;gt;&quot;;
&amp;nbsp;var items_Returned = null;

&amp;nbsp;$().SPServices({

&amp;nbsp;&amp;nbsp;operation: &quot;GetListItems&quot;,
&amp;nbsp;&amp;nbsp;async: true, //make asynchronous so it doesn&#39;t lock up page
&amp;nbsp;&amp;nbsp;listName: listName,
&amp;nbsp;&amp;nbsp;listName: listName,
&amp;nbsp;&amp;nbsp;CAMLQuery: camlQuery,
&amp;nbsp;&amp;nbsp;CAMLViewFields: camlFields, 
&amp;nbsp;&amp;nbsp;CAMLRowLimit: 1, 
&amp;nbsp;&amp;nbsp;completefunc: function (xData, Status){

&amp;nbsp;&amp;nbsp;&amp;nbsp;items_Returned = xData;
&amp;nbsp;&amp;nbsp;&amp;nbsp;//alert(xData.responseText);

&amp;nbsp;&amp;nbsp;&amp;nbsp;var rows_Item = items_Returned.responseXML.getElementsByTagName(&#39;z:row&#39;);

&amp;nbsp;&amp;nbsp;&amp;nbsp;if(rows_Item.length == 0 )
&amp;nbsp;&amp;nbsp;&amp;nbsp;{
&amp;nbsp;//for chrome
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;rows_Item = items_Returned.responseXML.getElementsByTagName(&#39;row&#39;);
&amp;nbsp;&amp;nbsp;&amp;nbsp;}

&amp;nbsp;&amp;nbsp;&amp;nbsp;for (var i = 0; i &amp;lt; rows_Item.length; i++)&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;linkRef = rows_Item[i].getAttribute(&#39;ows_FileLeafRef&#39;);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;linkRef = linkRef.split(&quot;;#&quot;)[1];
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;var newlinkRef = thisSite + &quot;/&quot; + listName + &quot;/&quot; + linkRef;

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;aLink.attr(&quot;href&quot;, newlinkRef).attr(&quot;title&quot;, aLink.text());
&amp;nbsp;&amp;nbsp;&amp;nbsp;}
&amp;nbsp;&amp;nbsp;}
&amp;nbsp;});
}

&amp;lt;/script&amp;gt;


&lt;style&gt;
b { color: blue }
u { color: &quot;umber&quot; }
&lt;/style&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Next, we will&amp;nbsp;create page that we will used to modify the rendering of the calendar and open a direct link to the document&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;Create a page, and drop the Calendar list view web part (make sure to select the view for the Calendar you just created)&lt;/li&gt;
&lt;li&gt;Add a content editor web part to the page, and specify the link to a javascript file, which we just created&lt;/li&gt;
&lt;/ol&gt;
Enjoy!&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://dcsharepointchick.blogspot.com/feeds/4313554537229490497/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dcsharepointchick.blogspot.com/2013/05/sharepoint-calendar-overlay-color-code.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7715120637497505141/posts/default/4313554537229490497'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7715120637497505141/posts/default/4313554537229490497'/><link rel='alternate' type='text/html' href='http://dcsharepointchick.blogspot.com/2013/05/sharepoint-calendar-overlay-color-code.html' title='SharePoint Calendar Overlay - Color code documents and display direct links to document library'/><author><name>spar</name><uri>http://www.blogger.com/profile/05436274905022706601</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgiEr3xiGKCFx78JzfY0dwhkC6tfC1GUl709dHtPzGnQfszx93EDmiyZkGbgDjy9rijrrSviMOT-UQexa1KXJPxteeZvpw1TEgyVAL0ibTzT6egBALVJ79FI4Dn7iiR6yd-7xxdKG_OGvI/s72-c/Result.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7715120637497505141.post-736155034306581909</id><published>2013-01-22T14:58:00.001-05:00</published><updated>2013-02-01T08:01:49.244-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Delegate Control"/><category scheme="http://www.blogger.com/atom/ns#" term="Load balancing"/><category scheme="http://www.blogger.com/atom/ns#" term="NLB"/><category scheme="http://www.blogger.com/atom/ns#" term="SharePoint 2010"/><category scheme="http://www.blogger.com/atom/ns#" term="SharePoint server name"/><title type='text'>Determine which SharePoint Web Front End Server you are hitting</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Often, we need to identify which&amp;nbsp;WFE server on SharePoint&amp;nbsp;we are hitting&amp;nbsp;when the farm has load balancing. &lt;br /&gt;
&lt;br /&gt;
I decided to create a very simple&amp;nbsp;feature that would display the server name&amp;nbsp;by overriding the GlobalNavigation delegate control&amp;nbsp;of&amp;nbsp;each page that was being accessed across every site collection and sub sites in a web application. &lt;br /&gt;
&lt;br /&gt;
When accessing any page, you will see the server name similar to below:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://sites.google.com/site/dcsharepointchick/home/servername/ServerName.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;206&quot; src=&quot;https://sites.google.com/site/dcsharepointchick/home/servername/ServerName.jpg&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
First, I created the user control, and added one simple label:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-html&quot;&gt;&amp;lt;asp:Label ID=&quot;lblServerName&quot; runat=&quot;server&quot; BackColor=&quot;Green&quot; ForeColor=&quot;White&quot;&amp;gt;&amp;lt;/asp:Label&amp;gt;

&lt;style&gt;
b { color: blue }
u { color: &quot;umber&quot; }
&lt;/style&gt;&lt;/pre&gt;
In the code behind, I put code to check whether the current user is a farm administrator, or if&amp;nbsp;the query parameter, &quot;showserver&quot; has been passed into the url. If either are true,&amp;nbsp;then I display the name of the sharepoint server on the label:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-html&quot;&gt;&amp;nbsp;protected void Page_Load(object sender, EventArgs e)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (IsFarmAdmin() || ServerParamIsSet())
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.lblServerName.Width = new Unit(&quot;100%&quot;);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.lblServerName.Text = string.Format(&quot;{0}&quot;, Page.Server.MachineName);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; catch { }
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }


&lt;/pre&gt;
&lt;br /&gt;
Next, I added an Elements manifest,&amp;nbsp;and specified the path to where the control template will be deployed to on the server, a sequence number lower than 100, and specified it to place the user control in the GlobalNavigation delegate control placeholder.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-html&quot;&gt;&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&amp;gt;
&amp;lt;Elements xmlns=&quot;&lt;a href=&quot;http://schemas.microsoft.com/sharepoint/&quot;&gt;http://schemas.microsoft.com/sharepoint/&lt;/a&gt;&quot;&amp;gt;
&amp;nbsp; &amp;lt;Control Id=&quot;GlobalNavigation&quot; Sequence=&quot;90&quot; ControlSrc=&quot;~/_ControlTemplates/SPServerName/SPServerName.ascx&quot; /&amp;gt;
&amp;lt;/Elements&amp;gt;
&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
Finally, I created a feature and set it to deploy to the web application. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;&lt;span style=&quot;background-color: white; color: purple;&quot;&gt;Installation instructions:&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;
1.&amp;nbsp;Download the wsp I uploaded&amp;nbsp;to&amp;nbsp;&lt;a href=&quot;http://spservername.codeplex.com/&quot; target=&quot;_blank&quot;&gt;http://spservername.codeplex.com/&lt;/a&gt; &lt;br /&gt;
2. Deploy the solution to your farm&lt;br /&gt;
3. Go to the web application features, and enable the SPServerName feature&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;&lt;span style=&quot;color: red;&quot;&gt;Notes&lt;/span&gt;&lt;/strong&gt;:&lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;color: black;&quot;&gt;There are no changes made to any master page and the feature can easily be turned on and off&lt;span style=&quot;color: red;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: black;&quot;&gt;By default, Farm administrators will always see the server&amp;nbsp;name at the top of the page. &lt;/span&gt;&lt;/li&gt;
&lt;span style=&quot;color: black;&quot;&gt;
&lt;/span&gt;
&lt;li&gt;&lt;span style=&quot;color: black;&quot;&gt;Non-farm administrators can also display the server name if they pass in the query parameter &quot;&lt;strong&gt;showserver=1&lt;/strong&gt;&quot;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
Ex:&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://myportal.com/siteabc?showserver=1&quot;&gt;http://myportal.com/siteabc?showserver=1&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://dcsharepointchick.blogspot.com/feeds/736155034306581909/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dcsharepointchick.blogspot.com/2013/01/show-sharepoint-wfe-server-name-on-all.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7715120637497505141/posts/default/736155034306581909'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7715120637497505141/posts/default/736155034306581909'/><link rel='alternate' type='text/html' href='http://dcsharepointchick.blogspot.com/2013/01/show-sharepoint-wfe-server-name-on-all.html' title='Determine which SharePoint Web Front End Server you are hitting'/><author><name>spar</name><uri>http://www.blogger.com/profile/05436274905022706601</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7715120637497505141.post-7359936601411975433</id><published>2012-10-15T11:38:00.000-04:00</published><updated>2013-05-10T10:17:25.765-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Javascript"/><category scheme="http://www.blogger.com/atom/ns#" term="Right Ribbon"/><category scheme="http://www.blogger.com/atom/ns#" term="welcome menu"/><title type='text'>JavaScript to add a global link next to Welcome menu in SharePoint 2010</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Similarly to my &lt;a href=&quot;http://dcsharepointchick.blogspot.com/2012/10/javascript-add-link-near-site-actions-menu-sharepoint-2010.html&quot; target=&quot;_blank&quot;&gt;post on adding a link next to the Site Actions menu in the Left Ribbon&lt;/a&gt;, you can add a link on the right ribbon on SharePoint 2010 pages, next to the Welcome menu. &lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://sites.google.com/site/dcsharepointchick/home/global-link-next-to-site-actions-menu/welcomemenu.JPG?attredirects=0&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; nea=&quot;true&quot; src=&quot;https://sites.google.com/site/dcsharepointchick/home/global-link-next-to-site-actions-menu/welcomemenu.JPG?attredirects=0&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;pre class=&quot;prettyprint lang-html&quot;&gt;ExecuteOrDelayUntilScriptLoaded(ExecuteDefaultLoad, &quot;sp.js&quot;);

var _rightRibbonContainer = null;

function ExecuteDefaultLoad()
{

 var isWikiEdit = false;
 if ( document.forms[MSOWebPartPageFormName]._wikiPageMode != null )
 {
  if( document.forms[MSOWebPartPageFormName]._wikiPageMode.value == &quot;Edit&quot; )
    {
     isWikiEdit = true;
    }
  }

 var inDesignMode = document.forms[MSOWebPartPageFormName].MSOLayout_InDesignMode.value;
 if (inDesignMode == &quot;1&quot; || isWikiEdit) 
 {  // page is in edit mode 
 } 
 else 
 {  
  LoadRightRibbon(); 
 } 
}

function LoadRightRibbon()
{
 
 var ribbonContainerRowRight = document.getElementById(&quot;RibbonContainer-TabRowRight&quot;);

 if( ribbonContainerRowRight != null )
 {
  if( ribbonContainerRowRight.children != null &amp;amp;&amp;amp; ribbonContainerRowRight.children[2] != null )
  {
   if( ribbonContainerRowRight.children[2].children != null )
   {
    _rightRibbonContainer = document.getElementById(&quot;RibbonContainer-TabRowRight&quot;).children[2].children[0];

    if( _rightRibbonContainer != null )
    {     
     AddHelloLink();
    }
   }
  }
 }
}


function AddHelloLink()
{
 if( _rightRibbonContainer != null )
 {

  var newSpan = document.createElement(&quot;span&quot;);
  newSpan.innerHTML = &#39;&amp;lt;a class=&quot;ms-menu-a&quot; style=&quot;cursor:pointer;white-space:nowrap;&quot;    href=&quot;javascript:;&quot; title=&quot;Hello!&quot; onclick=&quot;window.location=\&#39;/sites/test123\&#39;;return false;&quot;&amp;gt;&amp;lt;span&amp;gt;&amp;lt;font color=\&#39;#8ce352\&#39;&amp;gt;&amp;lt;b&amp;gt;&amp;lt;i&amp;gt;Hello World!&amp;lt;/i&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&#39;;
  newSpan.className = &#39;ms-SPLink ms-SpLinkButtonInActive ms-welcomeMenu&#39;;
  
  newSpan.onmouseover= function() {  this.className = &quot;ms-SPLink ms-SpLinkButtonActive ms-welcomeMenu&quot;}; 
  newSpan.onmouseout= function() {  this.className = &quot;ms-SPLink ms-SpLinkButtonInActive ms-welcomeMenu&quot;}; 
  

  _rightRibbonContainer.insertBefore(newSpan, _rightRibbonContainer.children[0]);
 }
}
&lt;style&gt;
b { color: blue }
u { color: &quot;umber&quot; }
&lt;/style&gt;&lt;/pre&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://dcsharepointchick.blogspot.com/feeds/7359936601411975433/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dcsharepointchick.blogspot.com/2012/10/javascript-add-link-near-welcome-menu-sharepoint-2010.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7715120637497505141/posts/default/7359936601411975433'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7715120637497505141/posts/default/7359936601411975433'/><link rel='alternate' type='text/html' href='http://dcsharepointchick.blogspot.com/2012/10/javascript-add-link-near-welcome-menu-sharepoint-2010.html' title='JavaScript to add a global link next to Welcome menu in SharePoint 2010'/><author><name>spar</name><uri>http://www.blogger.com/profile/05436274905022706601</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7715120637497505141.post-8820366099505958135</id><published>2012-10-15T10:31:00.001-04:00</published><updated>2012-10-15T11:43:05.545-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Delegate Control"/><category scheme="http://www.blogger.com/atom/ns#" term="Javascript"/><title type='text'>How to create a SharePoint Delegate Control that injects JavaScript to all SharePoint pages</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Times New Roman&#39;,&#39;serif&#39;; font-size: 12pt; mso-fareast-font-family: &#39;Times New Roman&#39;;&quot;&gt;Recently, I needed a way to insert some JavaScript files into all pages in all of the SharePoint site collections and sites under an entire web application. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Times New Roman&#39;,&#39;serif&#39;; font-size: 12pt; mso-fareast-font-family: &#39;Times New Roman&#39;;&quot;&gt;The thought of changing all the master pages in every site collection seemed not only tedious, but unmanageable. Every time a new site collection is created, we would have to remember to modify the master pages. Also, if a site collection owner decided to use their own master pages, we would have no way of maintaining those either. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Times New Roman&#39;,&#39;serif&#39;; font-size: 12pt; mso-fareast-font-family: &#39;Times New Roman&#39;;&quot;&gt;So, after banging my head trying to come up with a better solution, I stumbled upon the delegate control!&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Times New Roman&#39;,&#39;serif&#39;; font-size: 12pt; mso-fareast-font-family: &#39;Times New Roman&#39;;&quot;&gt;A detailed description of how it works and what it does can be found here:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Times New Roman&#39;,&#39;serif&#39;; font-size: 12pt; mso-fareast-font-family: &#39;Times New Roman&#39;;&quot;&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ms463169.aspx&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;http://msdn.microsoft.com/en-us/library/ms463169.aspx&lt;/span&gt;&lt;/a&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Times New Roman&#39;,&#39;serif&#39;; font-size: 12pt; mso-fareast-font-family: &#39;Times New Roman&#39;;&quot;&gt;The beauty of the delegate control is that you can basically overwrite anything&amp;nbsp;in the master page. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Times New Roman&#39;,&#39;serif&#39;; font-size: 12pt; mso-fareast-font-family: &#39;Times New Roman&#39;;&quot;&gt;I wanted to add a simple JavaScript file to all of the pages in the master page. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Times New Roman&#39;,&#39;serif&#39;; font-size: 12pt; mso-fareast-font-family: &#39;Times New Roman&#39;;&quot;&gt;So I started by following the example below. I modified this code in step 12 from the hardcoded script to instead read from a JavaScript file that is located in my layouts folder.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;protected&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;override&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt; CreateChildControls()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;base&lt;/span&gt;.CreateChildControls();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;string&lt;/span&gt; srcScript = &lt;span style=&quot;color: #a31515;&quot;&gt;&quot;/_layouts/Company/CompanyScript.js&quot;&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;this&lt;/span&gt;.Controls.Add(&lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: #2b91af;&quot;&gt;ScriptLink&lt;/span&gt;() { Name = srcScript, Language = &lt;span style=&quot;color: #a31515;&quot;&gt;&quot;javascript&quot;&lt;/span&gt;, Localizable = &lt;span style=&quot;color: blue;&quot;&gt;false&lt;/span&gt; });&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Times New Roman&#39;,&#39;serif&#39;; font-size: 12pt; mso-fareast-font-family: &#39;Times New Roman&#39;;&quot;&gt;The step by step process can also be found here as well: &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ms470880.aspx&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;http://msdn.microsoft.com/en-us/library/ms470880.aspx&lt;/span&gt;&lt;/a&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Times New Roman&#39;,&#39;serif&#39;; font-size: 12pt; mso-fareast-font-family: &#39;Times New Roman&#39;;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;Step by step process to creating a delegate control:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 10pt 1.25in; mso-list: l1 level1 lfo1; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list 78.0pt; text-indent: -0.25in;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;font-family: &#39;Times New Roman&#39;,&#39;serif&#39;; font-size: 12pt; mso-fareast-font-family: &#39;Times New Roman&#39;;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;1.&lt;span style=&quot;font: 7pt &#39;Times New Roman&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Times New Roman&#39;,&#39;serif&#39;; font-size: 12pt; mso-fareast-font-family: &#39;Times New Roman&#39;;&quot;&gt;Start SharePoint development tools in Microsoft Visual Studio 2010.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 10pt 1.25in; mso-list: l1 level1 lfo1; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in; text-indent: -0.25in;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;font-family: &#39;Times New Roman&#39;,&#39;serif&#39;; font-size: 12pt; mso-fareast-font-family: &#39;Times New Roman&#39;;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;2.&lt;span style=&quot;font: 7pt &#39;Times New Roman&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Times New Roman&#39;,&#39;serif&#39;; font-size: 12pt; mso-fareast-font-family: &#39;Times New Roman&#39;;&quot;&gt;On the &lt;b&gt;File&lt;/b&gt; menu, point to &lt;b&gt;New&lt;/b&gt;, and then click &lt;b&gt;Project&lt;/b&gt;.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 10pt 1.25in; mso-list: l1 level1 lfo1; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in; text-indent: -0.25in;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;font-family: &#39;Times New Roman&#39;,&#39;serif&#39;; font-size: 12pt; mso-fareast-font-family: &#39;Times New Roman&#39;;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;3.&lt;span style=&quot;font: 7pt &#39;Times New Roman&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Times New Roman&#39;,&#39;serif&#39;; font-size: 12pt; mso-fareast-font-family: &#39;Times New Roman&#39;;&quot;&gt;In &lt;b&gt;Project Types&lt;/b&gt;, under &lt;b&gt;Visual Basic&lt;/b&gt; or &lt;b&gt;C#&lt;/b&gt;, select &lt;b&gt;Empty SharePoint Project&lt;/b&gt;.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 10pt 1.25in; mso-list: l1 level1 lfo1; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in; text-indent: -0.25in;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;font-family: &#39;Times New Roman&#39;,&#39;serif&#39;; font-size: 12pt; mso-fareast-font-family: &#39;Times New Roman&#39;;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;4.&lt;span style=&quot;font: 7pt &#39;Times New Roman&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Times New Roman&#39;,&#39;serif&#39;; font-size: 12pt; mso-fareast-font-family: &#39;Times New Roman&#39;;&quot;&gt;Type &lt;b&gt;EcmaScriptDelegate&lt;/b&gt; as the project name. Click &lt;b&gt;OK&lt;/b&gt;.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 10pt 1.25in; mso-list: l1 level1 lfo1; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in; text-indent: -0.25in;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;font-family: &#39;Times New Roman&#39;,&#39;serif&#39;; font-size: 12pt; mso-fareast-font-family: &#39;Times New Roman&#39;;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;5.&lt;span style=&quot;font: 7pt &#39;Times New Roman&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Times New Roman&#39;,&#39;serif&#39;; font-size: 12pt; mso-fareast-font-family: &#39;Times New Roman&#39;;&quot;&gt;In the &lt;b&gt;SharePoint Customization Wizard&lt;/b&gt;, choose &lt;b&gt;Deploy as a farm solution&lt;/b&gt;. Click &lt;b&gt;Finish&lt;/b&gt;.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 10pt 1.25in; mso-list: l1 level1 lfo1; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in; text-indent: -0.25in;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;font-family: &#39;Times New Roman&#39;,&#39;serif&#39;; font-size: 12pt; mso-fareast-font-family: &#39;Times New Roman&#39;;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;6.&lt;span style=&quot;font: 7pt &#39;Times New Roman&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Times New Roman&#39;,&#39;serif&#39;; font-size: 12pt; mso-fareast-font-family: &#39;Times New Roman&#39;;&quot;&gt;In the &lt;b&gt;Solution Explorer&lt;/b&gt;, right-click the &lt;b&gt;EcmaScriptDelegate&lt;/b&gt; project. Select &lt;b&gt;Add&lt;/b&gt; and then &lt;b&gt;New Item&lt;/b&gt;.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 10pt 1.25in; mso-list: l1 level1 lfo1; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in; text-indent: -0.25in;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;font-family: &#39;Times New Roman&#39;,&#39;serif&#39;; font-size: 12pt; mso-fareast-font-family: &#39;Times New Roman&#39;;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;7.&lt;span style=&quot;font: 7pt &#39;Times New Roman&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Times New Roman&#39;,&#39;serif&#39;; font-size: 12pt; mso-fareast-font-family: &#39;Times New Roman&#39;;&quot;&gt;In the &lt;b&gt;Add New Item&lt;/b&gt; dialog box, click the &lt;b&gt;Code&lt;/b&gt; group and choose the &lt;b&gt;Class&lt;/b&gt; template. Type &lt;b&gt;EcmaScriptDelegateControl&lt;/b&gt; as the &lt;b&gt;Name&lt;/b&gt; and then click &lt;b&gt;Add&lt;/b&gt;.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 10pt 1.25in; mso-list: l1 level1 lfo1; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in; text-indent: -0.25in;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;font-family: &#39;Times New Roman&#39;,&#39;serif&#39;; font-size: 12pt; mso-fareast-font-family: &#39;Times New Roman&#39;;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;8.&lt;span style=&quot;font: 7pt &#39;Times New Roman&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Times New Roman&#39;,&#39;serif&#39;; font-size: 12pt; mso-fareast-font-family: &#39;Times New Roman&#39;;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;Next, you must add a reference to &lt;/span&gt;&lt;a href=&quot;http://msdn2.microsoft.com/EN-US/library/w7f1y429&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;System.Web&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: black;&quot;&gt;. In the &lt;b&gt;Solution Explorer&lt;/b&gt;, right-click the &lt;b&gt;References&lt;/b&gt; folder and select &lt;b&gt;Add Reference&lt;/b&gt;. In the &lt;b&gt;Add Reference&lt;/b&gt; dialog, click the &lt;b&gt;.NET&lt;/b&gt; tab and find &lt;b&gt;System.Web&lt;/b&gt; in the list. Click &lt;b&gt;OK&lt;/b&gt;.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 12pt 1.25in; mso-list: l1 level1 lfo1; mso-margin-top-alt: auto; tab-stops: list .5in; text-indent: -0.25in;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;font-family: &#39;Times New Roman&#39;,&#39;serif&#39;; font-size: 12pt; mso-fareast-font-family: &#39;Times New Roman&#39;;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;9.&lt;span style=&quot;font: 7pt &#39;Times New Roman&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Times New Roman&#39;,&#39;serif&#39;; font-size: 12pt; mso-fareast-font-family: &#39;Times New Roman&#39;;&quot;&gt;In the EcmaScriptDelegateControl file that is displayed, add the following using statement.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt 1.25in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt; mso-fareast-font-family: &#39;Times New Roman&#39;;&quot;&gt;using&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt; mso-fareast-font-family: &#39;Times New Roman&#39;;&quot;&gt; System.Web.UI.WebControls;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 10pt 1.25in; mso-list: l1 level1 lfo1; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in; text-indent: -0.25in;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;font-family: &#39;Times New Roman&#39;,&#39;serif&#39;; font-size: 12pt; mso-fareast-font-family: &#39;Times New Roman&#39;;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;10.&lt;span style=&quot;font: 7pt &#39;Times New Roman&#39;;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Times New Roman&#39;,&#39;serif&#39;; font-size: 12pt; mso-fareast-font-family: &#39;Times New Roman&#39;;&quot;&gt;Change the base class of &lt;b&gt;EcmaScriptDelegateControl&lt;/b&gt; to &lt;a href=&quot;http://msdn2.microsoft.com/EN-US/library/k1x24e42&quot;&gt;WebControl&lt;/a&gt; by modifying the following line.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt 87.8pt; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt; mso-fareast-font-family: &#39;Times New Roman&#39;;&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt; mso-fareast-font-family: &#39;Times New Roman&#39;;&quot;&gt; EcmaScriptDelegateControl : WebControl&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt 87.8pt; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt 78pt; mso-add-space: auto; mso-list: l1 level1 lfo1; tab-stops: list .5in; text-indent: -0.25in;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;font-family: &#39;Times New Roman&#39;,&#39;serif&#39;; font-size: 12pt; mso-fareast-font-family: &#39;Times New Roman&#39;;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;11.&lt;span style=&quot;font: 7pt &#39;Times New Roman&#39;;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Times New Roman&#39;,&#39;serif&#39;; font-size: 12pt; mso-fareast-font-family: &#39;Times New Roman&#39;;&quot;&gt;Override the &lt;b&gt;OnLoad&lt;/b&gt; method by adding the following code.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt 87.8pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt 87.8pt; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt; mso-fareast-font-family: &#39;Times New Roman&#39;;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;protected override void OnLoad(EventArgs e)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt 87.8pt; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt; mso-fareast-font-family: &#39;Times New Roman&#39;;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt 87.8pt; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt; mso-fareast-font-family: &#39;Times New Roman&#39;;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;base.OnLoad(e);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt 87.8pt; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;; font-size: 10pt; mso-fareast-font-family: &#39;Times New Roman&#39;;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt 42pt; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraph&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt 78pt; mso-add-space: auto; mso-list: l1 level1 lfo1; tab-stops: list .5in left 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt; text-indent: -0.25in;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;font-family: &#39;Times New Roman&#39;,&#39;serif&#39;; font-size: 12pt; mso-fareast-font-family: &#39;Times New Roman&#39;;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;12.&lt;span style=&quot;font: 7pt &#39;Times New Roman&#39;;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Times New Roman&#39;,&#39;serif&#39;; font-size: 12pt; mso-fareast-font-family: &#39;Times New Roman&#39;;&quot;&gt;Inside the &lt;b&gt;OnLoad&lt;/b&gt; method, add the following code to put JavaScript on the page.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt 78pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt 78pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;font-family: &#39;Times New Roman&#39;,&#39;serif&#39;; font-size: 12pt; mso-fareast-font-family: &#39;Times New Roman&#39;;&quot;&gt;string&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Times New Roman&#39;,&#39;serif&#39;; font-size: 12pt; mso-fareast-font-family: &#39;Times New Roman&#39;;&quot;&gt; helloAlert = &quot;alert(&#39;Hello, world!&#39;);&quot;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt 78pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;font-family: &#39;Times New Roman&#39;,&#39;serif&#39;; font-size: 12pt; mso-fareast-font-family: &#39;Times New Roman&#39;;&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Times New Roman&#39;,&#39;serif&#39;; font-size: 12pt; mso-fareast-font-family: &#39;Times New Roman&#39;;&quot;&gt;.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), &quot;popup&quot;, helloAlert, true);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt 78pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt 42pt;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Times New Roman&#39;,&#39;serif&#39;; font-size: 12pt; mso-fareast-font-family: &#39;Times New Roman&#39;;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;Now, you have built the delegate control for the project. Next, you will create the Feature to deploy the control.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 10pt 42pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; mso-outline-level: 3;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: &#39;Times New Roman&#39;,&#39;serif&#39;; font-size: 13.5pt; mso-fareast-font-family: &#39;Times New Roman&#39;;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;To create a Feature to deploy the control&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 10pt 1.25in; mso-list: l2 level1 lfo2; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in; text-indent: -0.25in;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;font-family: &#39;Times New Roman&#39;,&#39;serif&#39;; font-size: 12pt; mso-fareast-font-family: &#39;Times New Roman&#39;;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;1.&lt;span style=&quot;font: 7pt &#39;Times New Roman&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Times New Roman&#39;,&#39;serif&#39;; font-size: 12pt; mso-fareast-font-family: &#39;Times New Roman&#39;;&quot;&gt;In the &lt;b&gt;Solution Explorer&lt;/b&gt;, right-click the &lt;b&gt;EcmaScriptDelegate&lt;/b&gt; project and select &lt;b&gt;Add&lt;/b&gt; and then &lt;b&gt;New Item&lt;/b&gt;.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 10pt 1.25in; mso-list: l2 level1 lfo2; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in; text-indent: -0.25in;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;font-family: &#39;Times New Roman&#39;,&#39;serif&#39;; font-size: 12pt; mso-fareast-font-family: &#39;Times New Roman&#39;;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;2.&lt;span style=&quot;font: 7pt &#39;Times New Roman&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Times New Roman&#39;,&#39;serif&#39;; font-size: 12pt; mso-fareast-font-family: &#39;Times New Roman&#39;;&quot;&gt;In the &lt;b&gt;Add New Item&lt;/b&gt; dialog box, choose the &lt;b&gt;Empty Element&lt;/b&gt; template and type &lt;b&gt;EcmaScriptDelegateFeature&lt;/b&gt; as the &lt;b&gt;Name&lt;/b&gt;. Click &lt;b&gt;Add&lt;/b&gt;.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 10pt 1.25in; mso-list: l2 level1 lfo2; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in; text-indent: -0.25in;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;font-family: &#39;Times New Roman&#39;,&#39;serif&#39;; font-size: 12pt; mso-fareast-font-family: &#39;Times New Roman&#39;;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;3.&lt;span style=&quot;font: 7pt &#39;Times New Roman&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Times New Roman&#39;,&#39;serif&#39;; font-size: 12pt; mso-fareast-font-family: &#39;Times New Roman&#39;;&quot;&gt;Insert the following XML inside the &lt;b&gt;Elements&lt;/b&gt; element. The &lt;b&gt;Id&lt;/b&gt; attribute identifies the delegate where the control is rendered. The &lt;b&gt;ControlAssembly&lt;/b&gt; and &lt;b&gt;ControlClass&lt;/b&gt; attributes are unique to your control. For more information about how to find the full assembly name, see &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ee539422.aspx&quot;&gt;How to: Create a Tool to Get the Full Name of an Assembly&lt;/a&gt;.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Times New Roman&#39;,&#39;serif&#39;; font-size: 12pt; mso-fareast-font-family: &#39;Times New Roman&#39;;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;The most flexible thing about the delegate control is that it can be defined at the 4 scopes: &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpFirst&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt 1in; mso-add-space: auto; mso-list: l0 level1 lfo3; text-indent: -0.25in;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;font-family: Symbol; font-size: 12pt; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;·&lt;span style=&quot;font: 7pt &#39;Times New Roman&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: &#39;Times New Roman&#39;,&#39;serif&#39;; font-size: 12pt; mso-fareast-font-family: &#39;Times New Roman&#39;;&quot;&gt;Web&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Times New Roman&#39;,&#39;serif&#39;; font-size: 12pt; mso-fareast-font-family: &#39;Times New Roman&#39;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt 1in; mso-add-space: auto; mso-list: l0 level1 lfo3; text-indent: -0.25in;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;font-family: Symbol; font-size: 12pt; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;·&lt;span style=&quot;font: 7pt &#39;Times New Roman&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: &#39;Times New Roman&#39;,&#39;serif&#39;; font-size: 12pt; mso-fareast-font-family: &#39;Times New Roman&#39;;&quot;&gt;Site collection&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Times New Roman&#39;,&#39;serif&#39;; font-size: 12pt; mso-fareast-font-family: &#39;Times New Roman&#39;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt 1in; mso-add-space: auto; mso-list: l0 level1 lfo3; text-indent: -0.25in;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;font-family: Symbol; font-size: 12pt; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;·&lt;span style=&quot;font: 7pt &#39;Times New Roman&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: &#39;Times New Roman&#39;,&#39;serif&#39;; font-size: 12pt; mso-fareast-font-family: &#39;Times New Roman&#39;;&quot;&gt;Web application&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Times New Roman&#39;,&#39;serif&#39;; font-size: 12pt; mso-fareast-font-family: &#39;Times New Roman&#39;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpLast&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt 1in; mso-add-space: auto; mso-list: l0 level1 lfo3; text-indent: -0.25in;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;font-family: Symbol; font-size: 12pt; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;·&lt;span style=&quot;font: 7pt &#39;Times New Roman&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;b style=&quot;mso-bidi-font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: &#39;Times New Roman&#39;,&#39;serif&#39;; font-size: 12pt; mso-fareast-font-family: &#39;Times New Roman&#39;;&quot;&gt;Farm&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Times New Roman&#39;,&#39;serif&#39;; font-size: 12pt; mso-fareast-font-family: &#39;Times New Roman&#39;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Times New Roman&#39;,&#39;serif&#39;; font-size: 12pt; mso-fareast-font-family: &#39;Times New Roman&#39;;&quot;&gt;Thus, I can set the feature of this scope to activate at any level, and have it immediately show up in ALL of my pages. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 6pt;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Times New Roman&#39;,&#39;serif&#39;; font-size: 12pt; mso-fareast-font-family: &#39;Times New Roman&#39;;&quot;&gt;The best part is, when you deactivate the feature, it is completely gone and has no impact! No messing with the master page!&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 10pt;&quot;&gt;
&lt;br /&gt;
Now, we can&amp;nbsp;use this delegate control to &lt;a href=&quot;http://dcsharepointchick.blogspot.com/2012/10/javascript-add-link-near-site-actions-menu-sharepoint-2010.html&quot; target=&quot;_blank&quot;&gt;add a global link on all pages in every site collection under&amp;nbsp;a web application to return users to the home page&lt;/a&gt;. &amp;nbsp;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://dcsharepointchick.blogspot.com/feeds/8820366099505958135/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dcsharepointchick.blogspot.com/2012/10/how-to-create-sharepoint-delegate.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7715120637497505141/posts/default/8820366099505958135'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7715120637497505141/posts/default/8820366099505958135'/><link rel='alternate' type='text/html' href='http://dcsharepointchick.blogspot.com/2012/10/how-to-create-sharepoint-delegate.html' title='How to create a SharePoint Delegate Control that injects JavaScript to all SharePoint pages'/><author><name>spar</name><uri>http://www.blogger.com/profile/05436274905022706601</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7715120637497505141.post-584899425811551952</id><published>2012-10-15T10:13:00.003-04:00</published><updated>2012-10-19T16:25:55.772-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Delegate Control"/><category scheme="http://www.blogger.com/atom/ns#" term="Javascript"/><title type='text'>JavaScript to add a global link near Site Actions menu in SharePoint 2010</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
The goal is to&amp;nbsp;add&amp;nbsp;a link next to the&amp;nbsp;Site Actions menu that would always lead back to&amp;nbsp;the portal home, similar to below. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://sites.google.com/site/dcsharepointchick/home/global-link-next-to-site-actions-menu/sharepointportalhome.JPG?attredirects=0&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; nea=&quot;true&quot; src=&quot;https://sites.google.com/site/dcsharepointchick/home/global-link-next-to-site-actions-menu/sharepointportalhome.JPG?attredirects=0&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
Using IE Developer Tools, I was able to determine the location&amp;nbsp;where I wanted to place my link was inside of the RibbonContainer-TabRowLeft element. &lt;br /&gt;
&lt;br /&gt;
You can modify the master page and inject the following javascript to achieve this:&lt;br /&gt;
&lt;br /&gt;
Read my following &lt;a href=&quot;http://dcsharepointchick.blogspot.com/2012/10/how-to-create-sharepoint-delegate.html&quot; target=&quot;_blank&quot;&gt;&lt;strong&gt;post&lt;/strong&gt;&lt;/a&gt; to see how to make this work on all site collections across a web application by using a delegate control!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-html&quot;&gt;ExecuteOrDelayUntilScriptLoaded(ExecuteDefaultLoad, &quot;sp.js&quot;);

function ExecuteDefaultLoad()
{

 var isWikiEdit = false;
 if ( document.forms[MSOWebPartPageFormName]._wikiPageMode != null )
 {
  if( document.forms[MSOWebPartPageFormName]._wikiPageMode.value == &quot;Edit&quot; )
    {
     isWikiEdit = true;
    }
  }

 var inDesignMode = document.forms[MSOWebPartPageFormName].MSOLayout_InDesignMode.value;
 if (inDesignMode == &quot;1&quot; || isWikiEdit) 
 {  
  // this page is currently in edit mode 
 } 
 else 
 {  
  AddHomeLink();
 } 
}


function AddHomeLink()
{
 var ribbonContainerRowLeft = document.getElementById(&quot;RibbonContainer-TabRowLeft&quot;);
 if( ribbonContainerRowLeft != null )
 {
  if( ribbonContainerRowLeft.children != null &amp;amp;&amp;amp; ribbonContainerRowLeft.children[0] != null )
  {  
  var newSpan = document.createElement(&quot;span&quot;);
  newSpan.innerHTML=&#39;&amp;lt;a class=&quot;ms-menu-a&quot; style=&quot;cursor:pointer;white-space:nowrap;&quot;    href=&quot;javascript:;&quot; title=&quot;SharePoint Portal Home&quot; onclick=&quot;window.location=\&#39;/\&#39;;return false;&quot;&amp;gt;&amp;lt;img src=&quot;/_layouts/images/hhome.png&quot;  border=&quot;0px&quot;/&amp;gt;&amp;lt;/a&amp;gt;&#39;;
  newSpan.className = &#39;ms-SPLink ms-SpLinkButtonInActive ms-welcomeMenu&#39;;
  newSpan.onmouseover= function() {  this.className = &quot;ms-SPLink ms-SpLinkButtonActive ms-welcomeMenu&quot;}; 
  newSpan.onmouseout= function() {  this.className = &quot;ms-SPLink ms-SpLinkButtonInActive ms-welcomeMenu&quot;}; 
  ribbonContainerRowLeft.insertBefore(newSpan, ribbonContainerRowLeft.children[0]);
  }
 }
}


&lt;style&gt;
b { color: blue }
u { color: &quot;umber&quot; }
&lt;/style&gt;&lt;/pre&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://dcsharepointchick.blogspot.com/feeds/584899425811551952/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dcsharepointchick.blogspot.com/2012/10/javascript-add-link-near-site-actions-menu-sharepoint-2010.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7715120637497505141/posts/default/584899425811551952'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7715120637497505141/posts/default/584899425811551952'/><link rel='alternate' type='text/html' href='http://dcsharepointchick.blogspot.com/2012/10/javascript-add-link-near-site-actions-menu-sharepoint-2010.html' title='JavaScript to add a global link near Site Actions menu in SharePoint 2010'/><author><name>spar</name><uri>http://www.blogger.com/profile/05436274905022706601</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7715120637497505141.post-7865159250845708723</id><published>2012-08-15T14:19:00.001-04:00</published><updated>2012-08-30T12:03:24.817-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Search"/><category scheme="http://www.blogger.com/atom/ns#" term="site filtering"/><title type='text'>Show All Sites I Have Access to in SharePoint with Filtering using JQuery and Javascript</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Suppose you want your users to see all the SharePoint sites that they have access to on one page, instead of having to drill down to each subsite to find their content. Instead of creating a site directory, I want to show them all the sites that they can access and allow them to filter based on the site name, site path and site description. &lt;br /&gt;
&lt;br /&gt;
Laura Rogers has a blog post that goes through a step by step process of using the Search Core Results web part, which can be found here: &lt;a href=&quot;http://sharepoint911.com/blogs/laura/Lists/Posts/Post.aspx?ID=90&quot;&gt;http://sharepoint911.com/blogs/laura/Lists/Posts/Post.aspx?ID=90 &lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
However, I want to do this by using some scripting. By default, it will show all the sites the&amp;nbsp;current user has access to&amp;nbsp;(with a scroll bar on the right hand side if it is an extensive list). The search textbox will automatically&amp;nbsp;filter the entire set of sites (with no post backs) on the site title, path and description.&amp;nbsp;The end result will be similar to below:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://sites.google.com/site/dcsharepointchick/home/sitesihaveaccessto/mySitesIhaveaccessto.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; mda=&quot;true&quot; src=&quot;https://sites.google.com/site/dcsharepointchick/home/sitesihaveaccessto/mySitesIhaveaccessto.JPG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
First, we will want to use the SharePoint search service and get all the sites and webs using jquery/ajax. The query we will&amp;nbsp;use gets only the indexed items that are of contentclass type &quot;STS_SITE&quot; or &quot;STS_WEB:&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;color: #134f5c;&quot;&gt;SELECT Title, Rank, Size, Description, Path FROM Scope() WHERE &quot;scope&quot; = &#39;All Sites&#39; AND (contentclass = &#39;STS_Site&#39; OR contentclass = &#39;STS_Web&#39;) ORDER BY &quot;Rank&quot; DESC&quot;&lt;/span&gt;&lt;/blockquote&gt;
Next, we will call the query using the search service, where the url being passed in is the url to the search.asmx path. &lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #134f5c;&quot;&gt;&amp;nbsp;$.ajax({&amp;nbsp; &lt;br /&gt;url: &quot;http://mydomain/_vti_bin/search.asmx&quot; ,&amp;nbsp;&amp;nbsp; &lt;br /&gt;type: &quot;POST&quot;,&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;dataType: &quot;xml&quot;,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;data: soapEnv,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;async:true,&lt;br /&gt;complete: processResult,&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;contentType: &quot;text/xml; charset=\&quot;utf-8\&quot;&quot;&lt;br /&gt;&amp;nbsp;});&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/blockquote&gt;
The processResult function will be&amp;nbsp;executed to&amp;nbsp;iterate through the results and create our table once the ajax call has been made. &lt;br /&gt;
&lt;br /&gt;
Finally, we will use the dataTable js plugin to allow scrolling and filtering on the sites list&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;color: #134f5c;&quot;&gt;$(&#39;#mySitesTable&#39;).dataTable( {&lt;br /&gt;&quot;sScrollY&quot;: &quot;300px&quot;,&lt;br /&gt;&quot;bPaginate&quot;: false,&lt;br /&gt;&quot;bSort&quot;: false&lt;br /&gt;} );&lt;/span&gt;&lt;/blockquote&gt;
&lt;br /&gt;
Simply add this script to a SharePoint page and reference the&amp;nbsp;jquery library, which you can grab from &lt;a href=&quot;http://docs.jquery.com/Downloading_jQuery&quot;&gt;http://docs.jquery.com/Downloading_jQuery&lt;/a&gt;&amp;nbsp;and the&amp;nbsp;jquery.dataTables.min.js, which you can download from &lt;a href=&quot;http://datatables.net/&quot;&gt;http://datatables.net/&lt;/a&gt;:&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;display: inline-block; width: 40em;&quot;&gt;
&lt;pre class=&quot;prettyprint lang-html&quot;&gt;&amp;lt;div id=&quot;errorMsg&quot;&amp;gt;&amp;lt;/div&amp;gt;
&amp;lt;div id=&quot;showQueryResults&quot; style=&quot;display: none&quot;&amp;gt;false&amp;lt;/div&amp;gt;
&amp;lt;div id=&quot;searchResults&quot;&amp;gt;&amp;lt;/div&amp;gt;
&amp;lt;div id=&quot;testoutput&quot; style=&quot;display: none&quot;&amp;gt;&amp;lt;/div&amp;gt;

&amp;lt;script src=&quot;/assets/js/jquery/jquery-1.7.2.min.js&quot; type=&quot;text/javascript&quot;&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script src=&quot;/assets/js/jquery/plugins/dataTables/jquery.dataTables.min.js&quot; type=&quot;text/javascript&quot;&amp;gt;&amp;lt;/script&amp;gt;

&amp;lt;style&amp;gt;
 div.table_Wrapper { border:10px solid blue; }
 .dataTables_filter 
 {
  width: 50%;
  float: right;
  text-align: right;
 }
 .dataTables_info
 {
  width: 100%;
  font-weight:bold;
  float: left;
  border: 2px solid #ddd;
  background-color: Gainsboro;
  color: #999;
  text-align: right;

 }
 
&amp;lt;/style&amp;gt;


&amp;lt;script type=&quot;text/javascript&quot;&amp;gt;

var searchURL = &quot;http://mydomain/_vti_bin/search.asmx&quot;;
var arraySearchResults = new Array();
var arrayListToSearch = new Array();
var displayQueryResults = false;
var searchCap = 5000;
 
//used to display the output of the query; 
//if you would like to see the query result, make set the innerHTML of showQueryResults to true
if( document.getElementById(&quot;showQueryResults&quot;).innerHTML == &quot;true&quot;)
{
 displayQueryResults = true;       
}

RunSearch(); 

   
function RunSearch()
{
 arraySearchResults = new Array();
 

 var myQuery = &quot;&amp;lt;QueryPacket xmlns=&#39;urn:Microsoft.Search.Query&#39; Revision=&#39;1000&#39;&amp;gt;&quot;;
 myQuery += &quot;&amp;lt;Query&amp;gt;&quot;; 
 myQuery += &quot;&amp;lt;SupportedFormats&amp;gt;&amp;lt;Format&amp;gt;urn:Microsoft.Search.Response.Document.Document&amp;lt;/Format&amp;gt;&amp;lt;/SupportedFormats&amp;gt;&quot;;  
 myQuery += &quot;&amp;lt;Range&amp;gt;&amp;lt;Count&amp;gt;&quot; + searchCap + &quot;&amp;lt;/Count&amp;gt;&amp;lt;/Range&amp;gt;&quot;;  
 myQuery += &quot;&amp;lt;Context&amp;gt;&quot;;
 myQuery += &quot;&amp;lt;QueryText language=&#39;en-US&#39; type=&#39;MSSQLFT&#39;&amp;gt;&quot;;
 myQuery += &quot;SELECT Title, Rank, Description, Path FROM Scope() WHERE \&quot;scope\&quot; = &#39;All Sites&#39; AND (contentclass = &#39;STS_Site&#39; OR contentclass = &#39;STS_Web&#39;) ORDER BY \&quot;Rank\&quot; DESC&quot;;
 myQuery += &quot;&amp;lt;/QueryText&amp;gt;&quot;;
 myQuery += &quot;&amp;lt;/Context&amp;gt;&quot;; 
 myQuery += &quot;&amp;lt;/Query&amp;gt;&quot;;
 myQuery += &quot;&amp;lt;/QueryPacket&amp;gt;&quot;;   

  
 var soapEnv = &quot;&amp;lt;?xml version=\&quot;1.0\&quot;?&amp;gt;&quot;+
 &quot;&amp;lt;soap:Envelope xmlns:xsi=&#39;http://www.w3.org/2001/XMLSchema-instance&#39; xmlns:xsd=&#39;http://www.w3.org/2001/XMLSchema&#39; xmlns:soap=&#39;http://schemas.xmlsoap.org/soap/envelope/&#39;&amp;gt;&quot; + 
 &quot;&amp;lt;soap:Body&amp;gt;&quot; +
 &quot;&amp;lt;Query xmlns=&#39;urn:Microsoft.Search&#39;&amp;gt;&quot;+
 &quot;&amp;lt;queryXml&amp;gt;&quot; + escapeHTML(myQuery) + &quot;&amp;lt;/queryXml&amp;gt;&quot;+   
 &quot;&amp;lt;/Query&amp;gt;&quot;+    
 &quot;&amp;lt;/soap:Body&amp;gt;&quot;+ 
 &quot;&amp;lt;/soap:Envelope&amp;gt;&quot;;


 $.ajax({  
  url: searchURL,   
  type: &quot;POST&quot;,    
  dataType: &quot;xml&quot;,        
  data: soapEnv,       
  async:true,

  complete: processResult,    
  contentType: &quot;text/xml; charset=\&quot;utf-8\&quot;&quot;

 });         
 }
 
  

function processResult(xData, Status)
{
 if (Status == &quot;error&quot;) 
 {
  DisplayErrorMesssage(Status, xData);
  return;
 }

// alert($(xData.responseXML).text());
 
   var queryResult = $(xData.responseXML).find(&quot;QueryResult&quot;).text();
   $(&quot;#testoutput&quot;).text(queryResult);
 
   if( displayQueryResults )
   {
       document.getElementById(&quot;testoutput&quot;).style.display = &quot;&quot;;
   }
   else
   {
       document.getElementById(&quot;testoutput&quot;).style.display = &quot;none&quot;;
   }
 
   $(xData.responseXML).find(&quot;QueryResult&quot;).each(function() {  
    var xml = $(&quot;&amp;lt;xml&amp;gt;&quot; + $(this).text() + &quot;&amp;lt;/xml&amp;gt;&quot;);  
    xml.find(&quot;Document&quot;).each(function() 
    {  
  var curPath = $(&quot;Action&amp;gt;LinkUrl&quot;, $(this)).text();  
  curPath = curPath.toLowerCase();

  var curTitle = &quot;&quot;;  
  var curDesc = &quot;&quot;;
 
 
  $(this).find(&quot;Property&quot;).each(function() 
  {  
   if ($(&quot;Name&quot;, $(this)).text() == &quot;TITLE&quot;) 
   {  
    curTitle = $(&quot;Value&quot;, $(this)).text(); 
   }  
   if ($(&quot;Name&quot;, $(this)).text() == &quot;DESCRIPTION&quot;) 
   {  
    curDesc = $(&quot;Value&quot;, $(this)).text(); 
   }  
  });  
  
  arraySearchResults.push([curTitle, curPath, curDesc]);
    
    });  

  });
 
 PrintOutput();
}
 
 

function PrintOutput()
{ 
 arraySearchResults.sort(sortSearchResults);

 var output = &quot;&quot;;

 output += &#39;&amp;lt;table id=&quot;mySitesTable&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; border=&quot;0&quot; class=&quot;display&quot;&amp;gt;&#39;;
 output += &quot;&amp;lt;thead&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;th align=&#39;left&#39;&amp;gt;&amp;lt;font color=&#39;steelblue&#39; size=&#39;2pt&#39;&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;Sites that I have access to&amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;/thead&amp;gt;&quot;; 
 output += &quot;&amp;lt;tbody&amp;gt;&quot;;

 
 for( var x = 0; x &amp;lt; arraySearchResults.length; x++ )
 {
  var title = arraySearchResults[x][0];
  var path = arraySearchResults[x][1];
  var desc = arraySearchResults[x][2];
  
  output += PrintRow(path, title, desc);
 } 
 
 output += &quot;&amp;lt;/tbody&amp;gt;&amp;lt;/table&amp;gt;&quot;;
 
 document.getElementById(&quot;searchResults&quot;).innerHTML = output;
 
  
 $(&#39;#mySitesTable&#39;).dataTable( {
  &quot;sScrollY&quot;: &quot;300px&quot;,
  &quot;bPaginate&quot;: false,
  &quot;bSort&quot;: false
 } );
}
 
function PrintRow(path, title, desc)
{
 var output = &quot;&quot;;

 if( desc != null &amp;amp;&amp;amp; desc != &quot;&quot; )
  output += &#39;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;a href=&quot;&#39; +  path +  &#39;&quot; target=&quot;_blank&quot;&amp;gt;&#39; + title   + &#39;&amp;lt;/a&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;font color=&quot;green&quot;&amp;gt;&#39; + path + &#39;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&#39;+desc+&#39;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&#39;;
 else
  output += &#39;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;a href=&quot;&#39; +  path +  &#39;&quot; target=&quot;_blank&quot;&amp;gt;&#39; + title   + &#39;&amp;lt;/a&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;font color=&quot;green&quot;&amp;gt;&#39;+path+&#39;&amp;lt;/font&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&#39;;

 return output; 
}
 
 
function DisplayErrorMesssage( Status, xData)
{
 document.getElementById(&quot;errorMsg&quot;).innerHTML = &quot;Error occurred. &quot; + Status ;

 if( xData.responseXML != null )
 {
  document.getElementById(&quot;errorMsg&quot;).innerHTML += $(xData.responseXML).text();
 }
}
 
 
function sortSearchResults(a, b){

 var aTitle = a[0]; 
 var bTitle = b[0];
  
  
 var x = aTitle.toLowerCase(), y = bTitle.toLowerCase();   
 
 return x &amp;lt; y ? -1 : x &amp;gt; y ? 1 : 0;   
}


function escapeHTML (str) 
{  
 return str.replace(/&amp;amp;/g,&#39;&amp;amp;&#39;).replace(/&amp;lt;/g,&#39;&amp;lt;&#39;).replace(/&amp;gt;/g,&#39;&amp;gt;&#39;);   
}     
 &amp;lt;/script&amp;gt;



&lt;style&gt;
b { color: blue }
u { color: &quot;umber&quot; }
&lt;/style&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://dcsharepointchick.blogspot.com/feeds/7865159250845708723/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dcsharepointchick.blogspot.com/2012/08/show-all-sites-i-have-access-to-in.html#comment-form' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7715120637497505141/posts/default/7865159250845708723'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7715120637497505141/posts/default/7865159250845708723'/><link rel='alternate' type='text/html' href='http://dcsharepointchick.blogspot.com/2012/08/show-all-sites-i-have-access-to-in.html' title='Show All Sites I Have Access to in SharePoint with Filtering using JQuery and Javascript'/><author><name>spar</name><uri>http://www.blogger.com/profile/05436274905022706601</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7715120637497505141.post-9100752200509388757</id><published>2012-08-07T13:19:00.000-04:00</published><updated>2012-10-15T11:10:13.849-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="list item attachments"/><category scheme="http://www.blogger.com/atom/ns#" term="SharePoint Designer"/><title type='text'>Track SharePoint Attachments Uploaded and Deleted in the EditForm using JavaScript</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
To track the changes to attachments in a SharePoint item for auditing/record keeping purposes:&lt;br /&gt;
&lt;br /&gt;
1. Create a new SharePoint edit form for the list using SharePoint Designer&lt;br /&gt;
2. Make sure that your Edit Form is updated and can upload attachments (use this MSDN article if you are having issues &lt;a href=&quot;http://support.microsoft.com/kb/953271/en-us&quot;&gt;http://support.microsoft.com/kb/953271/en-us&lt;/a&gt;)&lt;br /&gt;
&lt;br /&gt;
3. &lt;strong&gt;**Updated step** &lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
Find &amp;lt;tr id=&quot;idAttachmentsRow&quot; &amp;gt; and directly underneath of that closing &amp;lt;/tr&amp;gt; add&amp;nbsp;the following:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;nbsp;style=&quot;display:none&quot;&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;td colspan=&quot;2&quot; valign=&quot;top&quot; class=&quot;ms-formbody&quot; nowrap=&quot;&quot; height=&quot;20px&quot;&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;H3 class=&quot;ms-standardheader&quot;&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;SharePoint:AttachmentsField ControlMode=&quot;Display&quot; FieldName=&quot;Attachments&quot; runat=&quot;server&quot; Visible=&quot;true&quot;/&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/H3&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/tr&amp;gt;&lt;br /&gt;
(By adding this row and this field, it will&amp;nbsp;retain the name of the attachment)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
4. To get the newly added attachments, you will want to grab the &quot;attachmentsOnClient&quot; element. This is where the references to the&amp;nbsp;newly added attachments are stored. Next, you will want to iterate through all the INPUT tags and get the &quot;value&quot; attribute to get the names of the files that were uploaded. &lt;br /&gt;
&lt;br /&gt;
5. To get the removed attachments from the SharePoint list item, we will grab the &quot;attachmentsToBeRemovedFromServer&quot; element. All of the GUIDs of the list item attachments to be removed are stored in this element. We will parse out each guid and use&amp;nbsp;it to&amp;nbsp;identify the attachmentRow found under the attachmentsTable. This row will have a reference to the removed items. &lt;br /&gt;
&lt;br /&gt;
6. To view the changes that have been made when a user&amp;nbsp;clicks to save the form, add the script below. Of course, instead of alerting the user of the changes made, you can record it in a status or audit trail field to make it more seamless!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &lt;body onload=&quot;prettyPrint();&quot;&gt;
&lt;div style=&quot;display: inline-block; width: 40em;&quot;&gt;
&lt;pre class=&quot;prettyprint lang-html&quot;&gt;
&amp;lt;script type=&quot;text/javascript&quot;&amp;gt;

function GetNewlyUploadedAttachments()
{
 var uploadedAttachments = new Array();
 var oAttachments = document.getElementById(&quot;attachmentsOnClient&quot;);
 if( oAttachments.innerHTML != null )
 {
  var attachmentTable = oAttachments.getElementsByTagName(&quot;INPUT&quot;);
  for (var i = 0; i &amp;lt; attachmentTable.length; i++) 
  {    
   var value = attachmentTable[i].getAttribute(&quot;value&quot;);    
   if ( value != null &amp;amp;&amp;amp; value.length &amp;gt; 0 ) 
   {   
    var lastIndex = value.lastIndexOf(&quot;\\&quot;);
    var fileName = value.substring(lastIndex+1);
    uploadedAttachments.push(fileName); 
   } 
  } 
 }

 return uploadedAttachments.toString();
}

function GetRemovedAttachments()
{
 var removedAttachments = new Array();
 var attachmentsToBeRemoved = document.getElementsByName(&quot;attachmentsToBeRemovedFromServer&quot;).item(0).value;

 if( attachmentsToBeRemoved != null &amp;amp;&amp;amp; attachmentsToBeRemoved != &quot;&quot;)
 {
  var array = attachmentsToBeRemoved.split(&#39;;&#39;);
  for(var i =0; i &amp;lt; array.length; i++ )
  {
   attachmentGuid = array[i];
   if( attachmentGuid != null &amp;amp;&amp;amp; attachmentGuid != &quot;&quot; )
   {
    var attachmentRow =  document.getElementById(attachmentGuid);
    var span = attachmentRow.getElementsByTagName(&#39;span&#39;)[0];
    var links = span.getElementsByTagName(&quot;a&quot;);
    for (z = 0; z &amp;lt; links.length; z++) 
    {
     removedAttachments.push(links[z].firstChild.nodeValue);
    }
   }
  }
 }
 return removedAttachments.toString();
}

function PreSaveAction()
{
 var newUploadedAttachments = GetNewlyUploadedAttachments();
 var removedAttachments = GetRemovedAttachments();
 if( removedAttachments != null &amp;amp;&amp;amp; removedAttachments != &quot;&quot; )
 {
  alert(&quot;User removed attachments: &quot; + removedAttachments );
 }
 if( newUploadedAttachments != null &amp;amp;&amp;amp; newUploadedAttachments != &quot;&quot; )
 {
  alert(&quot;User uploaded attachments: &quot; + newUploadedAttachments );
 }
}
&amp;lt;/script&amp;gt;
&lt;style&gt;
b { color: blue }
u { color: &quot;umber&quot; }
&lt;/style&gt;


&lt;/pre&gt;
&lt;/div&gt;
&lt;/body&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://dcsharepointchick.blogspot.com/feeds/9100752200509388757/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dcsharepointchick.blogspot.com/2012/08/track-sharepoint-attachments-uploaded.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7715120637497505141/posts/default/9100752200509388757'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7715120637497505141/posts/default/9100752200509388757'/><link rel='alternate' type='text/html' href='http://dcsharepointchick.blogspot.com/2012/08/track-sharepoint-attachments-uploaded.html' title='Track SharePoint Attachments Uploaded and Deleted in the EditForm using JavaScript'/><author><name>spar</name><uri>http://www.blogger.com/profile/05436274905022706601</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7715120637497505141.post-363665267358962773</id><published>2012-07-09T10:25:00.003-04:00</published><updated>2013-02-27T20:19:04.500-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Javascript"/><category scheme="http://www.blogger.com/atom/ns#" term="list item attachments"/><category scheme="http://www.blogger.com/atom/ns#" term="SharePoint Designer"/><title type='text'>Display SharePoint List Item Attachments as Images</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;span style=&quot;color: #134f5c;&quot;&gt;Suppose you want a visual display of the images that you attach to a SharePoint list. Clicking on each attachment to open it can be a &lt;/span&gt;&lt;span style=&quot;color: #134f5c;&quot;&gt;hassle instead of just having it automatically display the images on load. &lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #134f5c;&quot;&gt;By default, the&amp;nbsp;attachments are&amp;nbsp;listed as links:&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://sites.google.com/site/dcsharepointchick/home/attachmentimages/attachmentsBefore.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; sca=&quot;true&quot; src=&quot;https://sites.google.com/site/dcsharepointchick/home/attachmentimages/attachmentsBefore.JPG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #134f5c;&quot;&gt;If you&amp;nbsp;view the properties of a SharePoint list item,&amp;nbsp;you will see that the link to each&amp;nbsp;attachment is calculated by:&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;&lt;span style=&quot;color: #b45f06;&quot;&gt;[Site Url]/Attachments/[Item ID]/[Attachment Name]&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #134f5c;&quot;&gt;So, if we can grab the item id of the list item, and then determine the attachment names, we will be able to use those properties to display the image with an img&amp;nbsp;tag.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #134f5c;&quot;&gt;First thing&#39;s first. If you view the source of that&amp;nbsp;default SharePoint item view page, you will see that the attachments are store din the element: &lt;strong&gt;idAttachmentsTable&lt;/strong&gt;. We want to grab all of the attachment names in that element. To do so, we will iterate through the span elements and parse out the attachments: &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;color: #134f5c;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #134f5c;&quot;&gt;&lt;/span&gt;&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
&lt;body onload=&quot;prettyPrint();&quot;&gt;
&lt;div style=&quot;display: inline-block; width: 40em;&quot;&gt;
&lt;pre class=&quot;prettyprint lang-html&quot;&gt;&amp;lt;script type=&quot;text/javascript&quot;&amp;gt;
spanTag = document.getElementById(&quot;idAttachmentsTable&quot;).getElementsByTagName(&quot;span&quot;);
var attachmentArray = new Array();
for (var i = 0; i &amp;lt; spanTag.length; i++) 
{
  filename = spanTag[i].innerHTML;
  var index  = filename.indexOf(&#39;&amp;gt;&#39;)+1;
  var lastindex = filename.lastIndexOf(&#39;&amp;lt;&#39;);

  var name = filename.substring(index, lastindex);

  name = name.replace(/ /g, &#39;%20&#39;);
  name = name.replace(/&#39;/g, &#39;%27&#39;);

  for( var x = 0; x &amp;lt; imgExtensions.length; x++ )
  {
   if( name.indexOf(imgExtensions[x]) &amp;gt;=0 )
   {
    attachmentArray.push([name]);
    break;
   }
  }
}
&amp;lt;/script&amp;gt;
&lt;style&gt;
b { color: blue }
u { color: &quot;umber&quot; }
&lt;/style&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/body&gt;
&lt;span style=&quot;color: #b45f06;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #134f5c;&quot;&gt;Now that we have the names of the attachments, we want to grab the current item id of our list item, which we can simply&amp;nbsp;grab from the source url. &lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;&lt;strong&gt;&lt;span style=&quot;color: #134f5c;&quot;&gt;Call to get the item ID: &lt;/span&gt;&lt;/strong&gt;&lt;/u&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;display: inline-block; width: 40em;&quot;&gt;
&lt;pre class=&quot;prettyprint lang-html&quot;&gt;var paramID = getParameterByName(&quot;ID&quot;);
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;strong&gt;&lt;u&gt;&lt;span style=&quot;color: #134f5c;&quot;&gt;Function to grab the parameter from the source url:&lt;/span&gt;&lt;/u&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;div style=&quot;display: inline-block; width: 40em;&quot;&gt;
&lt;pre class=&quot;prettyprint lang-html&quot;&gt;function getParameterByName(name) 
{&amp;nbsp;&amp;nbsp; 
&amp;nbsp;name = name.replace(/[\[]/, &quot;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;a href=&quot;http://www.blogger.com/&quot;&gt;&lt;span style=&quot;color: #b45f06;&quot;&gt;\\\[&quot;).replace(/[\]]/&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #b45f06;&quot;&gt;, &quot;&lt;/span&gt;&lt;a href=&quot;http://www.blogger.com/&quot;&gt;&lt;span style=&quot;color: #b45f06;&quot;&gt;\\\&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #b45f06;&quot;&gt;]&quot;);&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;var regexS = &quot;[\\?&amp;amp;]&quot; + name + &quot;=([^&amp;amp;#]*)&quot;;&amp;nbsp; &lt;br /&gt;&amp;nbsp;var regex = new RegExp(regexS);&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;var results = regex.exec(window.location.href);&amp;nbsp; &lt;br /&gt;&amp;nbsp;if(results == null)&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;return &quot;&quot;; &lt;br /&gt;&amp;nbsp;else&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;return decodeURIComponent(results[1].replace(/\+/g, &quot; &quot;));&lt;br /&gt;} &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #134f5c;&quot;&gt;Now, we will use the paramID and the attachment names to create our img tags and append it to the Attachments element:&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;display: inline-block; width: 40em;&quot;&gt;
&lt;pre class=&quot;prettyprint lang-html&quot;&gt;var ctrl = document.getElementById(&quot;idAttachmentsTable&quot;);
&amp;nbsp;var attachmentString = &quot;&quot;;
&amp;nbsp;for( i = 0; i &amp;lt; attachmentArray.length; i++)
&amp;nbsp;{
&amp;nbsp;&amp;nbsp;attachmentString += 
&amp;nbsp;&amp;nbsp;&quot; &amp;lt;img src=&#39;&quot; + listAttachmentUrl + paramID + &quot;/&quot;+ attachmentArray[i] + &quot;&#39; width=&#39;400px&#39; border=&#39;2&#39;&amp;gt;&quot;;
&amp;nbsp;}
&amp;nbsp;ctrl.parentNode.innerHTML += attachmentString;

&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #134f5c;&quot;&gt;&lt;strong&gt;After adding our script:&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://sites.google.com/site/dcsharepointchick/home/attachmentimages/attachmentsAfter.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; sca=&quot;true&quot; src=&quot;https://sites.google.com/site/dcsharepointchick/home/attachmentimages/attachmentsAfter.JPG&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #134f5c;&quot;&gt;To use this script, you will&amp;nbsp;need to use SharePoint designer to edit the &quot;View&quot; page of the list. Navigate to the end of the PlaceHolderMain content placeholder, and right before the closing &quot;&amp;lt;/asp:Content&amp;gt;&quot; tag, place the script below&amp;nbsp;in it&#39;s entirety. Make sure to modify the listAttachmentUrl to reflect your site and list names:&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;display: inline-block; width: 40em;&quot;&gt;
&lt;pre class=&quot;prettyprint lang-html&quot;&gt;&amp;lt;script language=&quot;javascript&quot; type=&quot;text/javascript&quot;&amp;gt; 
var listAttachmentUrl = &#39;/mysite/Lists/mylist/Attachments/&#39;;
var imgExtensions = new Array(&quot;.jpg&quot;,&quot;.jpeg&quot;, &quot;.png&quot;, &quot;.bmp&quot;, &quot;.tif&quot;, &quot;.tiff&quot;);
LoadAllAttachments();

function LoadAllAttachments()
{
 spanTag = document.getElementById(&quot;idAttachmentsTable&quot;).getElementsByTagName(&quot;span&quot;);
 var attachmentArray = new Array();
 for (var i = 0; i &amp;lt; spanTag.length; i++) 
 {
  filename = spanTag[i].innerHTML;
  var index  = filename.indexOf(&#39;&amp;gt;&#39;)+1;
  var lastindex = filename.lastIndexOf(&#39;&amp;lt;&#39;);

  var name = filename.substring(index, lastindex);

  name = name.replace(/ /g, &#39;%20&#39;);
  name = name.replace(/&#39;/g, &#39;%27&#39;);
  for( var x = 0; x &amp;lt; imgExtensions.length; x++ )
  {
   if( name.indexOf(imgExtensions[x]) &amp;gt;=0 )
   {
    attachmentArray.push([name]);
    break;
   }
  }
 }

 var paramID = getParameterByName(&quot;ID&quot;);
 var ctrl = document.getElementById(&quot;idAttachmentsTable&quot;);
 var attachmentString = &quot;&quot;;
 for( i = 0; i &amp;lt; attachmentArray.length; i++)
 {
  attachmentString += 
  &quot; &amp;lt;img src=&#39;&quot; + listAttachmentUrl + paramID + &quot;/&quot;+ attachmentArray[i] + &quot;&#39; width=&#39;400px&#39; border=&#39;2&#39;&amp;gt;&quot;;
 }
 ctrl.parentNode.innerHTML += attachmentString;
}

function getParameterByName(name) 
{   
 name = name.replace(/[\[]/, &quot;\\\[&quot;).replace(/[\]]/, &quot;\\\]&quot;);   
 var regexS = &quot;[\\?&amp;amp;]&quot; + name + &quot;=([^&amp;amp;#]*)&quot;;  
 var regex = new RegExp(regexS);   
 var results = regex.exec(window.location.href);  
 if(results == null)  
  return &quot;&quot;; 
 else    
  return decodeURIComponent(results[1].replace(/\+/g, &quot; &quot;));} 
&amp;lt;/script&amp;gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://dcsharepointchick.blogspot.com/feeds/363665267358962773/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dcsharepointchick.blogspot.com/2012/07/display-item-attachments-in-sharepoint.html#comment-form' title='10 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7715120637497505141/posts/default/363665267358962773'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7715120637497505141/posts/default/363665267358962773'/><link rel='alternate' type='text/html' href='http://dcsharepointchick.blogspot.com/2012/07/display-item-attachments-in-sharepoint.html' title='Display SharePoint List Item Attachments as Images'/><author><name>spar</name><uri>http://www.blogger.com/profile/05436274905022706601</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>10</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7715120637497505141.post-272862934600335963</id><published>2012-07-06T15:31:00.001-04:00</published><updated>2012-08-15T15:24:57.516-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Color coded list"/><category scheme="http://www.blogger.com/atom/ns#" term="Javascript"/><title type='text'>SharePoint Color Coded list based on a Field in the Row</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;span style=&quot;color: #134f5c;&quot;&gt;SharePoint doesn&#39;t provide an out of the box way of color coding lists. But, thank goodness, we can use a little scripting to edit the styling of our lists!&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&lt;a href=&quot;http://techtrainingnotes.blogspot.com/2008/11/sharepoint-color-coding-sharepoint.html&quot; target=&quot;_blank&quot;&gt;Mike Smith provided a&amp;nbsp;great script&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;color: #134f5c;&quot;&gt;&amp;nbsp;that allows you to color the background of the row if the cell&#39;s value matches the value it&#39;s looking for. But, what if another field in the same row has one of the other values and throws off your color coding? &lt;/span&gt;&lt;br /&gt;
﻿ &lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;float: left; margin-right: 1em; text-align: left;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://sites.google.com/site/dcsharepointchick/home/color-code-calendar/colorCodedList.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; sca=&quot;true&quot; src=&quot;https://sites.google.com/site/dcsharepointchick/home/color-code-calendar/colorCodedList.JPG&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;Case in point: color coding is thrown off because the Description field &lt;br /&gt;
can have the same value that is being used to color code on&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
﻿ ﻿ ﻿﻿﻿﻿ &lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #134f5c;&quot;&gt;Well, this script below will search only the cell index of the row that you would like to base your color coding on. In our case, we would like to search only on the Status field/column. To get started:&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #134f5c;&quot;&gt;1.&amp;nbsp;Add a content editor web part directly underneath the list&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #134f5c;&quot;&gt;2. Open the source editor and place the script below&amp;nbsp;into it&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #134f5c;&quot;&gt;3. Modify the columnIndexToSearch and the columnSpan variables to match the cell/field index to search for and the number of cells in each row respectively. &lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #134f5c;&quot;&gt;&lt;strong&gt;Note&lt;/strong&gt;: In this case, the attachment field counts as a cell. Since we are searching only on the Status,&amp;nbsp;our columnIndexToSearch is 2 (0 = Attachment field and 1 = Title field). The total number of columns we are displaying on our list is 5. If you add or remove columns in the view, the color coding will get thrown off. So, make sure to update these variables if you do make updates to the list view.&lt;/span&gt;&lt;br /&gt;
﻿ &lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://sites.google.com/site/dcsharepointchick/home/color-code-calendar/colorCodedListAfter.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; sca=&quot;true&quot; src=&quot;https://sites.google.com/site/dcsharepointchick/home/color-code-calendar/colorCodedListAfter.JPG&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;Final Result: Color coded based on the Status column only&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
﻿ ﻿ ﻿﻿ ﻿&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;

&lt;body onload=&quot;prettyPrint();&quot;&gt;
&lt;div style=&quot;width: 40em; display: inline-block&quot;&gt;
&lt;pre class=&quot;prettyprint lang-html&quot;&gt;
&amp;lt;script type=&quot;text/javascript&quot;&amp;gt;


var listView = getElementsByClass(&quot;ms-listviewtable&quot;); //get the list on the page
var tRows = listView[0].childNodes[0].childNodes;

var columnIndexToSearch = 2; //the index of the column that should be searched
var columnSpan = 5; //number of columns visible on the list

var j = 0;
var i = 0; 
var cellcounter = 0; //used to keep track of the cells searched on the row

for( j = 0; j &lt; tRows.length; j++)
{
 if( tRows[j].className == &quot;&quot; || tRows[j].className == &quot;ms-alternating&quot;)
 {
  var x = tRows[j].childNodes; // find all of the TRs
  for (i = 0; i &lt; x.length; i++) 
  { 
   if( cellcounter == columnIndexToSearch) 
   {
    if (x[i].innerHTML.indexOf(&quot;In Progress&quot;) &gt;= 0)
    { 
     x[i].parentNode.style.backgroundColor=&#39;lightgreen&#39;; 
    }

    else if (x[i].innerHTML.indexOf(&quot;Completed&quot;) &gt;= 0)
    { 
     x[i].parentNode.style.backgroundColor=&#39;lightblue&#39;; 
    }

    else if (x[i].innerHTML.indexOf(&quot;Deferred&quot;) &gt;= 0)
    { 
     x[i].parentNode.style.backgroundColor=&#39;lightgrey&#39;; 
    }

    else if (x[i].innerHTML.indexOf(&quot;Waiting on someone else&quot;) &gt;= 0)
    { 
     x[i].parentNode.style.backgroundColor=&#39;orange&#39;; 
    }
  }

   cellcounter++;
   if( cellcounter &gt;= columnSpan)
   {
    cellcounter = 0;
   }
  } 
 }
}

function getElementsByClass(searchClass, node, tag) 
{
 var classElements = new Array();
 if ( node == null )
  node = document;
 if ( tag == null )
  tag = &#39;*&#39;;
 var els = node.getElementsByTagName(tag);
 var elsLen = els.length;
 var pattern = new RegExp(&quot;(^|\\s)&quot;+searchClass+&quot;(\\s|$)&quot;);
 for (i = 0, j = 0; i &lt; elsLen; i++) 
 {
  if ( pattern.test(els[i].className) ) 
  {
   classElements[j] = els[i];
   j++;
  }
 }
 return classElements;
}


&amp;lt;/script&amp;gt;
&lt;style&gt;
b { color: blue }
u { color: &quot;umber&quot; }
&lt;/style&gt;


&lt;/pre&gt;
&lt;/div&gt;
&lt;/body&gt;


&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dcsharepointchick.blogspot.com/feeds/272862934600335963/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dcsharepointchick.blogspot.com/2012/07/sharepoint-color-coded-list-based-on.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7715120637497505141/posts/default/272862934600335963'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7715120637497505141/posts/default/272862934600335963'/><link rel='alternate' type='text/html' href='http://dcsharepointchick.blogspot.com/2012/07/sharepoint-color-coded-list-based-on.html' title='SharePoint Color Coded list based on a Field in the Row'/><author><name>spar</name><uri>http://www.blogger.com/profile/05436274905022706601</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7715120637497505141.post-8664095956444160961</id><published>2012-07-06T10:04:00.002-04:00</published><updated>2012-08-15T15:25:35.029-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Calendar"/><category scheme="http://www.blogger.com/atom/ns#" term="Javascript"/><title type='text'>SharePoint Calendar Jump to Next or Previous Month</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;span style=&quot;color: #0c343d;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #0c343d;&quot;&gt;I had a SharePoint calendar and I wanted a way to jump to the Next or Previous month from the&amp;nbsp;left hand navigation/quick launch menu.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #0c343d;&quot;&gt;I couldn&#39;t hardcode this url into the navigation, because it would change every month. I needed a dynamic way to do this. To address this, I created a new blank SharePoint page in my site, called &quot;MonthRedirector&quot;. I added a script that would determine the current month, and then either skip to the next or previous month based on the query string parameters passed in. &lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #0c343d;&quot;&gt;1. Create a blank SharePoint page, call it MonthRedirector&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #0c343d;&quot;&gt;2. Add a content editor web part to the page and paste in the script below or&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://sites.google.com/site/dcsharepointchick/home/sharepoint-calendar-jump-month/calendarJump.txt?attredirects=0&amp;amp;d=1&quot; target=&quot;_blank&quot;&gt;&lt;span style=&quot;color: #b45f06;&quot;&gt;&lt;strong&gt;(View Code)&lt;/strong&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #0c343d;&quot;&gt;Make sure to set the &quot;Chrome Type&quot; to be &quot;none&quot; and modify the site url in the script to reflect your site&#39;s url&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #0c343d;&quot;&gt;3. Add 2 new links to the Navigation menu, 1 for the previous month and 1 for the next month:&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #0c343d;&quot;&gt;[siteurl]/Pages/MonthRedirector.aspx?Jump=Prev&amp;amp;Calendar=[Your calendar name]&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #0c343d;&quot;&gt;[siteurl]/Pages/MonthRedirector.aspx?Jump=Next&amp;amp;Calendar=[Your calendar name]&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #0c343d;&quot;&gt;Now, when a&amp;nbsp;user clicks on the links on the left hand navigation, it will automatically direct them to the previous month or the next month on the calendar!&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&amp;nbsp;






&lt;body onload=&quot;prettyPrint();&quot;&gt;
&lt;div style=&quot;width: 40em; display: inline-block&quot;&gt;
&lt;pre class=&quot;prettyprint lang-html&quot;&gt;
&amp;lt;style&amp;gt;
#sidebar,#sidebar-footer {display : none !important;}
&amp;lt;/style&amp;gt;

&amp;lt;script type=&quot;text/javascript&quot;&amp;gt;
var siteURL = &quot;http://mySiteUrl&quot;;
//if you do not wish to hardcode the name, use something
//like SPServices to grab the current site url
//var siteURL = $().SPServices.SPGetCurrentSite();

var curDate = new Date();
var paramfilterJump = getParameterByName(&quot;Jump&quot;);
var paramCalendarName = getParameterByName(&quot;Calendar&quot;);

if( paramCalendarName != null &amp;&amp; paramCalendarName !=&quot;&quot; &amp;&amp; paramfilterJump != null 
 &amp;&amp; paramfilterJump != &quot;&quot; &amp;&amp; paramfilterJump == &quot;Next&quot;)
{
 var fullDateString =  PadDigits(curDate.getMonth() + 2, 2)  + &quot;%2F&quot; + PadDigits(curDate.getDate(), 2) + &quot;%2F&quot; +  curDate.getFullYear();  
 var redirectURL = siteURL + &quot;/Lists/&quot; + paramCalendarName + &quot;/calendar.aspx?CalendarDate=&quot; + fullDateString; 
 window.location.href = redirectURL;
}
else if( paramCalendarName != null &amp;&amp; paramCalendarName != &quot;&quot; &amp;&amp; paramfilterJump != null 
 &amp;&amp; paramfilterJump != &quot;&quot; &amp;&amp; paramfilterJump == &quot;Prev&quot;)
{
 var fullDateString =  PadDigits(curDate.getMonth(), 2)  + &quot;%2F&quot; + PadDigits(curDate.getDate(), 2) + &quot;%2F&quot; +  curDate.getFullYear();  
 var redirectURL = siteURL + &quot;/Lists/&quot; + paramCalendarName + &quot;/calendar.aspx?CalendarDate=&quot; + fullDateString; 
 window.location.href = redirectURL;
}

function PadDigits(n, totalDigits) 
{ 
 n = n.toString(); 
 var pd = &#39;&#39;; 
 if (totalDigits &gt; n.length) 
 { 
  for (i=0; i &lt; (totalDigits-n.length); i++) 
  { 
   pd += &#39;0&#39;; 
  } 
 } 
 return pd + n.toString(); 
} 

function getParameterByName(name) {   name = name.replace(/[\[]/, &quot;\\\[&quot;).replace(/[\]]/, &quot;\\\]&quot;);   var regexS = &quot;[\\?&amp;]&quot; + name + &quot;=([^&amp;#]*)&quot;;   var regex = new RegExp(regexS);   var results = regex.exec(window.location.href);   if(results == null)     return &quot;&quot;;   else     return decodeURIComponent(results[1].replace(/\+/g, &quot; &quot;)); } 

&amp;lt;/script&amp;gt;
&lt;style&gt;
b { color: blue }
u { color: &quot;umber&quot; }
&lt;/style&gt;


&lt;/pre&gt;
&lt;/div&gt;
&lt;/body&gt;




&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dcsharepointchick.blogspot.com/feeds/8664095956444160961/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dcsharepointchick.blogspot.com/2012/07/sharepoint-calendar-jump-to-next-or.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7715120637497505141/posts/default/8664095956444160961'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7715120637497505141/posts/default/8664095956444160961'/><link rel='alternate' type='text/html' href='http://dcsharepointchick.blogspot.com/2012/07/sharepoint-calendar-jump-to-next-or.html' title='SharePoint Calendar Jump to Next or Previous Month'/><author><name>spar</name><uri>http://www.blogger.com/profile/05436274905022706601</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7715120637497505141.post-2239225879072455096</id><published>2012-06-26T12:51:00.000-04:00</published><updated>2016-02-09T13:07:26.168-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Full Text Search"/><category scheme="http://www.blogger.com/atom/ns#" term="JQuery"/><category scheme="http://www.blogger.com/atom/ns#" term="SPServices"/><title type='text'>Full Text Search in SharePoint on multiple document libraries using SPServices</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;color: #134f5c;&quot;&gt;
A while ago, I needed a way to do a full text search of several SharePoint document libraries and display it in one page in a friendly way. I decided to use SPServices to do my querying and output the results using Javascript. &lt;/div&gt;
&lt;div style=&quot;color: #134f5c;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #134f5c;&quot;&gt;
This script does a full text search on the keywords&amp;nbsp;passed into an input&amp;nbsp;box&amp;nbsp;on the current scope of the site. After getting the query results, it then iterates through each search result and displays only the results where&amp;nbsp;the path matches the list names passed in. &lt;/div&gt;
&lt;div style=&quot;color: #134f5c;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;&lt;u&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;Documents in 2 different libraries:&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://sites.google.com/site/dcsharepointchick/testDoc2.JPG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;81&quot; src=&quot;https://sites.google.com/site/dcsharepointchick/testDoc2.JPG&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://sites.google.com/site/dcsharepointchick/testDoc1.JPG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;74&quot; src=&quot;https://sites.google.com/site/dcsharepointchick/testDoc1.JPG&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&lt;u&gt;Search output:&lt;/u&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://sites.google.com/site/dcsharepointchick/SearchOutput.JPG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;218&quot; src=&quot;https://sites.google.com/site/dcsharepointchick/SearchOutput.JPG&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&lt;u&gt;Refined search output:&lt;/u&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://sites.google.com/site/dcsharepointchick/SearchOutputRefined.JPG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;128&quot; src=&quot;https://sites.google.com/site/dcsharepointchick/SearchOutputRefined.JPG&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;color: #134f5c;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #134f5c;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #134f5c;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #134f5c;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #134f5c;&quot;&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #134f5c;&quot;&gt;
&lt;b&gt;&lt;u&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;Steps:&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;color: #134f5c;&quot;&gt;
1. Ensure search is configured and working on your site &lt;/div&gt;
&lt;div style=&quot;color: #134f5c;&quot;&gt;
2. Add this script to a content editor web part on your page &lt;a href=&quot;https://sites.google.com/site/dcsharepointchick/home/spservices-search/spServicesSearch.txt&quot; target=&quot;_blank&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;&lt;strong&gt;(View Code)&lt;/strong&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;color: #134f5c;&quot;&gt;
3. Update the script tags with the location of SPServices and JQuery on your site &lt;/div&gt;
&lt;div style=&quot;color: #134f5c;&quot;&gt;
4. Make sure to update the listUrl div with the correct list paths that you would like to restrict the output to &lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;body onload=&quot;prettyPrint();&quot;&gt;&lt;div style=&quot;display: inline-block; width: 40em;&quot;&gt;
&lt;pre class=&quot;prettyprint lang-html&quot;&gt;

&amp;lt;div id=&quot;divSearch&quot;&amp;gt;
	&amp;lt;div&amp;gt;
		&amp;lt;b&amp;gt;Search Keyword: &amp;lt;/b&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;input type=&quot;text&quot; id=&quot;tbSearch&quot; size=&quot;50%&quot; /&amp;gt;
		&amp;lt;input type=&quot;button&quot; id=&quot;btnSearch&quot; value=&quot;Search Policies&quot; onclick=&quot;RunSearch();&quot; /&amp;gt;
	&amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;

&amp;lt;div id=&quot;divErrorMsg&quot;&amp;gt;&amp;lt;/div&amp;gt;
&amp;lt;div id=&quot;divSearchResults&quot;&amp;gt;&amp;lt;/div&amp;gt; 
&amp;lt;div id=&quot;divTestQueryResult&quot;&amp;gt;&amp;lt;/div&amp;gt;
&amp;lt;div id=&quot;divTestQuery&quot;&amp;gt;&amp;lt;/div&amp;gt;

&amp;lt;script language=&quot;javascript&quot; type=&quot;text/javascript&quot; src=&quot;https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js&quot;&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script type=&quot;text/javascript&quot; language=&quot;javascript&quot; src=&quot;/policy/SiteAssets/js/jquery.SPServices-0.7.2.min.js&quot;&amp;gt;&amp;lt;/script&amp;gt;

&amp;lt;script type=&quot;text/javascript&quot;&amp;gt; 

//author: sparsee
//DCSharePointchick.blogspot.com
/**configurable**/
var m_searchCap = 5000;
var m_listUrls = &quot;https://site/policy/Procedure;https://site/policy/Policy;https://site/policy/Supplement;&quot;;
var m_displayQueryResults = false;
/**************/

var m_searchQueryForList = &quot;&quot;;
var m_arrSearchResults = new Array();
var m_searchResultCount = 0;
var m_output = &quot;&quot;;

var imgTxt = &#39;&amp;lt;img src=&quot;_layouts/images/ictxt.gif&quot; BORDER=0&amp;gt;&#39;;
var imgDoc = &#39;&amp;lt;img src=&quot;/_layouts/images/icdocx.gif&quot; BORDER=0&amp;gt;&#39;;
var imgPdf = &#39;&amp;lt;img src=&quot;_layouts/images/pdf16.gif&quot; BORDER=0&amp;gt;&#39;;
var imgDefault = &#39;&amp;lt;img src=&quot;_layouts/images/STS_ListItem16.gif&quot; BORDER=0&amp;gt;&#39;;

$(document).ready( function() 
{
	//get document properties
	var listUrls = m_listUrls;
	listUrls = listUrls.slice(1,listUrls.length);  
	listUrls = listUrls.substring(0, listUrls.length-1); 
	var arrlistUrls = listUrls.split(&#39;;&#39;);

	for( var y = 0; y &amp;lt; arrlistUrls.length; y++)
	{
		var curUrl = arrlistUrls[y];
		
		if( curUrl != null &amp;&amp; curUrl != &quot;&quot; )
		{
			var url = curUrl.toLowerCase();
			if( m_searchQueryForList != &quot;&quot; )
			{
				m_searchQueryForList += &quot;OR CONTAINS(Path, &#39;\&quot;&quot;+ url +&quot;*\&quot;&#39;)&quot;;
			}
			else
			{
				m_searchQueryForList += &quot;CONTAINS(Path, &#39;\&quot;&quot;+ url +&quot;*\&quot;&#39;)&quot;;
			}
		}
	} 
	
	$(&quot;#tbSearch&quot;).keyup(function(){
		RunSearch();
	});
});


function RunSearch()
{
	$(&quot;#divSearchResults&quot;).html(&quot;Searching...&quot;);
	$(&quot;#divErrorMsg&quot;).html(&quot;&quot;);
	m_arrSearchResults = new Array();

	var tbSearch = document.getElementById(&quot;tbSearch&quot;).value; 

	var myQuery = &quot;&amp;lt;QueryPacket xmlns=&#39;urn:Microsoft.Search.Query&#39; Revision=&#39;1000&#39;&amp;gt;&quot; + 
		&quot;&amp;lt;Query&amp;gt;&quot; + 
		&quot;&amp;lt;Range&amp;gt;&amp;lt;Count&amp;gt;&quot; + m_searchCap + &quot;&amp;lt;/Count&amp;gt;&amp;lt;/Range&amp;gt;&quot; +
		&quot;&amp;lt;Context&amp;gt;&quot; +
		&quot;&amp;lt;QueryText language=&#39;en-US&#39; type=&#39;MSSQLFT&#39;&amp;gt;&quot; +
		&quot;SELECT Title, Rank, Size, Author, HitHighlightedSummary, Description, Path, Write FROM Scope() WHERE FREETEXT(&#39;&quot; + tbSearch + &quot;&#39;) AND (&quot; + m_searchQueryForList + &quot;) ORDER BY \&quot;Rank\&quot; DESC&quot; +
		&quot;&amp;lt;/QueryText&amp;gt;&quot; +
		&quot;&amp;lt;/Context&amp;gt;&quot; +
		&quot;&amp;lt;/Query&amp;gt;&quot; +
		&quot;&amp;lt;/QueryPacket&amp;gt;&quot;;


	$().SPServices({
		operation: &quot;Query&quot;,
		async: true,
		queryXml: myQuery,
		//debug: true,
		completefunc: function (xData, Status) {

			$(&quot;#divSearchResults&quot;).html(&quot;Searching...&quot;);
			$(&quot;#divErrorMsg&quot;).html(&quot;&quot;);
			m_arrSearchResults = new Array();


			if (Status != &quot;success&quot;) 
			{
				DisplayErrorMesssage(Status);
				return;
			}

			var queryResult = $(xData.responseXML).find(&quot;QueryResult&quot;).text();

			if( m_displayQueryResults )
			{
				$(&quot;#divTestQueryResult&quot;).text(queryResult);
				$(&quot;#divTestQuery&quot;).text(&quot;&amp;lt;br/&amp;gt;&quot; + myQuery);
			}
			else
			{
				$(&quot;#divTestQueryResult&quot;).text(&quot;&quot;);
				$(&quot;#divTestQuery&quot;).text(&quot;&quot;);
			}

			$(xData.responseXML).find(&quot;QueryResult&quot;).each(function() 
			{  
				var xml = $(&quot;&amp;lt;xml&amp;gt;&quot; + $(this).text() + &quot;&amp;lt;/xml&amp;gt;&quot;);  
				xml.find(&quot;Document&quot;).each(function() 
				{  
					var curPath = $(&quot;Action&amp;gt;LinkUrl&quot;, $(this)).text().toLowerCase();  

					var curTitle = &quot;&quot;;  
					$(this).find(&quot;Property&quot;).each(function() 
					{  
						if ($(&quot;Name&quot;, $(this)).text() == &quot;TITLE&quot;) 
						{  
							curTitle = $(&quot;Value&quot;, $(this)).text(); 
						}  
					});  

					var curHithighlighted = &quot;&quot;;
					$(this).find(&quot;Property&quot;).each(function() 
					{  
						if ($(&quot;Name&quot;, $(this)).text() == &quot;HITHIGHLIGHTEDSUMMARY&quot;) 
						{  
							curHithighlighted = $(&quot;Value&quot;, $(this)).text(); 
						}  
					});  

					var curWrite = &quot;&quot;;
					$(this).find(&quot;Property&quot;).each(function() 
					{  
						if ($(&quot;Name&quot;, $(this)).text() == &quot;WRITE&quot;) 
						{  
							curWrite = $(&quot;Value&quot;, $(this)).text(); 
						}  
					});  
		 
					var curAuthor = &quot;&quot;;
					$(this).find(&quot;Property&quot;).each(function() 
					{  
						if ($(&quot;Name&quot;, $(this)).text() == &quot;AUTHOR&quot;) 
						{  
							curAuthor = $(&quot;Value&quot;, $(this)).text(); 
						}  
					});   
		
					var arrayRows = new Array();
					arrayRows.push([curTitle, curPath, curHithighlighted, curWrite, curAuthor]);

					m_arrSearchResults.push([ curTitle, arrayRows ]);
				});  
			});
			
			PrintOutput();
		}
	});
}

function PrintOutput()
{ 
	m_searchResultCount = 0;
	m_output = &#39;&amp;lt;table class=&quot;section-body&quot;&amp;gt;&#39;;
	
	var tb = document.getElementById(&quot;tbSearch&quot;).value; 

	for( var x = 0; x &amp;lt; m_arrSearchResults.length; x++ )
	{
		var searchTitle = m_arrSearchResults[x][0];
		var arrayRows = m_arrSearchResults[x][1];

		if( arrayRows.length &amp;gt; 0 )
		{
			var tableID = &#39;&quot;&#39; + x + &#39;Table&quot;&#39;;
			
			m_output += &quot;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;table id=&quot; + tableID + &quot; class=&#39;tablesorter section-table table_summary&#39; width=&#39;800px&#39; style=&#39;margin-top:0px !important;&#39;&amp;gt;&quot;;

			for( var y = 0; y &amp;lt; arrayRows.length; y++)
			{			
				var row = arrayRows[y];
				
				var title = row[0];
				var path = row[1];
				var highlighted = row[2];
				var write = row[3];
				var author = row[4];

				highlighted = GetFormattedHighlightedText(highlighted);
				title = GetHighlightedTitle(title, tb);
				title = GetFormattedTitle(path, title);

				write = GetFriendlyDate(write);

				var highlightedPath = GetHighlightedPath(path, tb);

				m_output += PrintRow(path, title, highlighted, highlightedPath, write, author);
				m_searchResultCount++;  
			}
			
			m_output += &quot;&amp;lt;/table&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&quot;;
		}
	}

	var returnedResults = &quot;&amp;lt;br/&amp;gt;&amp;lt;span style=&#39;color:red&#39;&amp;gt;Showing Results for: &amp;lt;b&amp;gt;&quot; + document.getElementById(&quot;tbSearch&quot;).value + &quot;&amp;lt;/b&amp;gt;&amp;lt;/span&amp;gt; (Returned: &amp;lt;font color=&#39;green&#39;&amp;gt;&quot; + m_searchResultCount + &quot;&amp;lt;/font&amp;gt; results)&quot;;

	m_output += &quot;&amp;lt;/table&amp;gt;&quot;;
	m_output = returnedResults + m_output;

	$(&quot;#divSearchResults&quot;).html(m_output);
}

function PrintRow(path, title, highlighted, highlightedPath, write, author)
{
	var row = &#39;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;a href=&quot;&#39; + path + &#39;&quot; target=&quot;_blank&quot;&amp;gt;&#39; + title + &#39;&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&#39; + 
	&#39;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&#39; + highlighted + &#39;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&#39; +
	&#39;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;a style=&quot;color:green;&quot; href=&quot;&#39;+ highlightedPath + &#39;&quot;&amp;gt;&#39; + highlightedPath +&#39;&amp;lt;/a&amp;gt;&amp;lt;font color=&quot;grey&quot;&amp;gt; - &#39; + author + &#39; - &#39; +  write + &#39;&amp;lt;/font&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&#39;;
	
	return row;
}

function GetFormattedTitle(path, title)
{
	if( path.indexOf(&quot;.pdf&quot;) &amp;gt;= 0 )
		title = imgPdf + title;
	else if( path.indexOf(&quot;.doc&quot;) &amp;gt;= 0 )
		title = imgDoc + title;
	else if( path.indexOf(&quot;.txt&quot;) &amp;gt;= 0 )
		title = imgTxt + title;
	else
		title = imgDefault + title;
		
	return title;
}

function GetHighlightedTitle(title, searchText)
{
	if( searchText != &quot;&quot; )
		return highlight(title, searchText);
	else
		return title;
}

function GetHighlightedPath(path, searchText)
{
	if( searchText != &quot;&quot; )
		return highlight(path, searchText);
	else
		return path;
}

function highlight( data, search ) { return data.replace( new RegExp( &quot;(&quot; + preg_quote( search ) + &quot;)&quot; , &#39;gi&#39; ), &quot;&amp;lt;b&amp;gt;$1&amp;lt;/b&amp;gt;&quot; ); } 
function preg_quote( str ) {  return (str+&#39;&#39;).replace(/([\\\.\+\*\?\[\^\]\$\(\)\{\}\=\!\&amp;lt;\&amp;gt;\|\:])/g, &quot;\\$1&quot;); } 


function GetFormattedHighlightedText(highlighted)
{
	if( highlighted != null )
	{
		highlighted = highlighted.replace(&quot;&amp;lt;c0&amp;gt;&quot;, &quot;&amp;lt;font color=&#39;green&#39;&amp;gt;&amp;lt;b&amp;gt;&quot;);
		highlighted = highlighted.replace(&quot;&amp;lt;/c0&amp;gt;&quot;, &quot;&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&quot;);

		highlighted = highlighted.replace(&quot;&amp;lt;c1&amp;gt;&quot;, &quot;&amp;lt;font color=&#39;green&#39;&amp;gt;&amp;lt;b&amp;gt;&quot;);
		highlighted = highlighted.replace(&quot;&amp;lt;/c1&amp;gt;&quot;, &quot;&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&quot;);

		highlighted = highlighted.replace(&quot;&amp;lt;c2&amp;gt;&quot;, &quot;&amp;lt;font color=&#39;green&#39;&amp;gt;&amp;lt;b&amp;gt;&quot;);
		highlighted = highlighted.replace(&quot;&amp;lt;/c2&amp;gt;&quot;, &quot;&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&quot;);

		highlighted = highlighted.replace(&quot;&amp;lt;c3&amp;gt;&quot;, &quot;&amp;lt;font color=&#39;green&#39;&amp;gt;&amp;lt;b&amp;gt;&quot;);
		highlighted = highlighted.replace(&quot;&amp;lt;/c3&amp;gt;&quot;, &quot;&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&quot;);

		highlighted = highlighted.replace(&quot;&amp;lt;c4&amp;gt;&quot;, &quot;&amp;lt;font color=&#39;green&#39;&amp;gt;&amp;lt;b&amp;gt;&quot;);
		highlighted = highlighted.replace(&quot;&amp;lt;/c4&amp;gt;&quot;, &quot;&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&quot;);

		//highlighted = &quot;&amp;lt;i&amp;gt;&quot; + highlighted + &quot;&amp;lt;/i&amp;gt;&quot;;

		return highlighted;
	}
	return &quot;&quot;;
}

function GetFriendlyDate(dateField)
{
	var datetimeparts = dateField.split(&#39;T&#39;);
	var dateparts = datetimeparts[0].split(&#39;-&#39;);
	var month = dateparts[1];
	var date = dateparts[2];
	var yr = dateparts[0]

	var formatteddateandtime = month + &quot;/&quot; + date + &quot;/&quot; +  yr ;
	
	return formatteddateandtime;
}

function DisplayErrorMesssage( errorMsg )
{
	$(&quot;#divErrorMsg&quot;).html(&quot;Error occurred. &quot; + errorMsg );
}

function CheckSubmit() 
{
    if (event.keyCode == 13) 
	{
		$(&quot;#btnSearch&quot;).focus();
    }
}
&amp;lt;/script&amp;gt;

&lt;style&gt;
p { color: pink }
b { color: blue }
u { color: &quot;umber&quot; }
&lt;/style&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://dcsharepointchick.blogspot.com/feeds/2239225879072455096/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dcsharepointchick.blogspot.com/2012/06/full-text-search-in-sharepoint-on.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7715120637497505141/posts/default/2239225879072455096'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7715120637497505141/posts/default/2239225879072455096'/><link rel='alternate' type='text/html' href='http://dcsharepointchick.blogspot.com/2012/06/full-text-search-in-sharepoint-on.html' title='Full Text Search in SharePoint on multiple document libraries using SPServices'/><author><name>spar</name><uri>http://www.blogger.com/profile/05436274905022706601</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7715120637497505141.post-4866667766354468853</id><published>2012-06-22T14:07:00.001-04:00</published><updated>2012-08-08T13:18:53.967-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Fiscal Quarter"/><category scheme="http://www.blogger.com/atom/ns#" term="Fiscal Year"/><category scheme="http://www.blogger.com/atom/ns#" term="FullCalendar"/><category scheme="http://www.blogger.com/atom/ns#" term="SPServices"/><title type='text'>SharePoint Calendar by Fiscal Year with FullCalendar and SPServices</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;span style=&quot;color: #0c343d;&quot;&gt;A little background: &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #0c343d;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;color: #0c343d;&quot;&gt;Last week at work, I had a requirement to display a calendar view in SharePoint that would display a full fiscal quarter&amp;nbsp;of a year on one page. &lt;/span&gt;&lt;span style=&quot;color: #b45f06;&quot;&gt;&lt;b&gt;It would have to be a color coded calendar, filter by Fiscal Year, Fiscal Quarter and&amp;nbsp;by the Department and show a full quarter view (3 months) on one page&lt;/b&gt;. &lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;color: #073763;&quot;&gt;
&lt;span style=&quot;color: #0c343d;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #073763;&quot;&gt;
&lt;span style=&quot;color: #0c343d;&quot;&gt;The first&amp;nbsp;thing I&amp;nbsp;thought of&amp;nbsp;was to add&amp;nbsp;3 calendar&amp;nbsp;web parts on one page (one for each month&amp;nbsp;of the quarter)&amp;nbsp;and then add some javascript that would redirect the calendars to the current quarter&#39;s months.&amp;nbsp;Well,&amp;nbsp;that didn&#39;t work out too well because the calendars are controls, and I can&#39;t pass in multiple parameters in the url for each one.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #0c343d;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #0c343d;&quot;&gt;So next, I started down the path of creating a gannt chart that would be filtered by each quarter. Each quarter and fiscal year would be dynamically set based on calculated column fields. The first bump in the road was that the gannt chart doesn&#39;t go past 2 years. The second bump in the road was that reoccuring events would show one line from the first date to the very end date (there were no tick boxes). I had to scratch that plan.&lt;/span&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;span style=&quot;color: #0c343d;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;div style=&quot;color: #073763;&quot;&gt;
&lt;span style=&quot;color: #0c343d;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #073763;&quot;&gt;
&lt;span style=&quot;color: #0c343d;&quot;&gt;After doing some research, I came across this &lt;/span&gt;&lt;a href=&quot;http://joshmccarty.com/2011/11/sharepoint-jquery-and-fullcalendar%E2%80%94now-with-spservices/&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #274e13;&quot;&gt;&lt;span style=&quot;color: #b45f06;&quot;&gt;blog&lt;/span&gt; &lt;/span&gt;&lt;/b&gt;&lt;/a&gt;&lt;span style=&quot;color: #0c343d;&quot;&gt;by &lt;/span&gt;&lt;a href=&quot;http://joshmccarty.com/2011/11/sharepoint-jquery-and-fullcalendar%E2%80%94now-with-spservices/&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #b45f06;&quot;&gt;Josh McCarty&lt;/span&gt;&lt;/b&gt;&lt;/a&gt;&lt;span style=&quot;color: #0c343d;&quot;&gt;. It utilizes the &lt;/span&gt;&lt;a href=&quot;http://arshaw.com/fullcalendar/&quot;&gt;&lt;span style=&quot;color: #0c343d;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #b45f06;&quot;&gt;FullCalendar&lt;/span&gt;&lt;/b&gt; &lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #0c343d;&quot;&gt;jQuery library with &lt;/span&gt;&lt;a href=&quot;http://spservices.codeplex.com/&quot;&gt;&lt;span style=&quot;color: #0c343d;&quot;&gt;&lt;strong&gt;&lt;span style=&quot;color: #b45f06;&quot;&gt;SPServices&lt;/span&gt;&lt;/strong&gt; &lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #0c343d;&quot;&gt;to query a SharePoint calendar and display it in a friendly way.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #073763;&quot;&gt;
&lt;span style=&quot;color: #0c343d;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #0c343d;&quot;&gt;I used his code as a base, and expanded it to create multiple calendar views on one page (one calendar view&amp;nbsp;per month (up to 12!)), allow filtering by the fiscal year and fiscal quarter,&amp;nbsp;filter by department, add a legend of colors for the department&amp;nbsp;and&amp;nbsp;enable tooltips for each event.&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #0c343d;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #073763;&quot;&gt;
&lt;span style=&quot;color: #0c343d;&quot;&gt;The entire color-coded calendar view, with a legend and drop down fields to filter on fiscal year, fiscal quarter and department (by default, it will set the Time Frame to be the current fiscal year and quarter):&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #073763;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://sites.google.com/site/dcsharepointchick/home/-sharepoint-fullcalendar-fiscalfilter/fiscalQuarterView.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; rca=&quot;true&quot; src=&quot;https://sites.google.com/site/dcsharepointchick/home/-sharepoint-fullcalendar-fiscalfilter/fiscalQuarterView.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; color: #073763; text-align: center;&quot;&gt;
&lt;strong&gt;&lt;br /&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; color: #073763; text-align: left;&quot;&gt;
&lt;u&gt;&lt;strong&gt;&lt;span style=&quot;color: #b45f06;&quot;&gt;Ability to show the calendar by the week:&lt;/span&gt;&lt;/strong&gt;&lt;/u&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://sites.google.com/site/dcsharepointchick/home/-sharepoint-fullcalendar-fiscalfilter/fiscalQuarterWeekView.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; rca=&quot;true&quot; src=&quot;https://sites.google.com/site/dcsharepointchick/home/-sharepoint-fullcalendar-fiscalfilter/fiscalQuarterWeekView.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; color: #073763; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;u&gt;&lt;strong&gt;&lt;span style=&quot;color: #b45f06;&quot;&gt;Ability to filter by Department:&lt;/span&gt;&lt;/strong&gt;&lt;/u&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://sites.google.com/site/dcsharepointchick/home/-sharepoint-fullcalendar-fiscalfilter/fiscalQuarterWiewFilteredByDept.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; rca=&quot;true&quot; src=&quot;https://sites.google.com/site/dcsharepointchick/home/-sharepoint-fullcalendar-fiscalfilter/fiscalQuarterWiewFilteredByDept.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;color: #073763;&quot;&gt;
&lt;span style=&quot;color: #0c343d;&quot;&gt;&lt;b&gt;Steps&lt;/b&gt;: &lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #073763;&quot;&gt;
&lt;span style=&quot;color: #0c343d;&quot;&gt;1. Create a simple calendar on your SharePoint site. Add a column called &quot;&lt;span style=&quot;color: #b45f06;&quot;&gt;Department&lt;/span&gt;&quot; and make it a choice field. Add the choice options. Ex.: &lt;/span&gt;&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot; style=&quot;color: #073763;&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #0c343d;&quot;&gt;Dept1&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #0c343d;&quot;&gt;Dept1: SubDept&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #0c343d;&quot;&gt;Dept2&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #0c343d;&quot;&gt;Dept2: SubDept &lt;/span&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;div style=&quot;color: #073763;&quot;&gt;
&lt;span style=&quot;color: #0c343d;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #073763;&quot;&gt;
&lt;span style=&quot;color: #0c343d;&quot;&gt;2. Add a calculated column called &quot;Color&quot; and set it to:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #073763;&quot;&gt;
&lt;span style=&quot;color: #0c343d;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #073763;&quot;&gt;
&lt;span style=&quot;color: #0c343d;&quot;&gt;&lt;link href=&quot;file:///C:%5CDOCUME%7E1%5CPARSEE%7E1%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_filelist.xml&quot; rel=&quot;File-List&quot;&gt;&lt;/link&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;link href=&quot;file:///C:%5CDOCUME%7E1%5CPARSEE%7E1%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_themedata.thmx&quot; rel=&quot;themeData&quot;&gt;&lt;/link&gt;&lt;br /&gt;
&lt;link href=&quot;file:///C:%5CDOCUME%7E1%5CPARSEE%7E1%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_colorschememapping.xml&quot; rel=&quot;colorSchemeMapping&quot;&gt;&lt;/link&gt;&lt;style&gt;
&lt;!--
 /* Font Definitions */
 @font-face
 {font-family:Calibri;
 panose-1:2 15 5 2 2 2 4 3 2 4;
 mso-font-alt:&quot;Century Gothic&quot;;
 mso-font-charset:0;
 mso-generic-font-family:swiss;
 mso-font-pitch:variable;
 mso-font-signature:-520092929 1073786111 9 0 415 0;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
 {mso-style-unhide:no;
 mso-style-qformat:yes;
 mso-style-parent:&quot;&quot;;
 margin:0in;
 margin-bottom:.0001pt;
 mso-pagination:widow-orphan;
 font-size:11.0pt;
 font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;
 mso-fareast-font-family:Calibri;
 mso-fareast-theme-font:minor-latin;}
.MsoChpDefault
 {mso-style-type:export-only;
 mso-default-props:yes;
 font-size:10.0pt;
 mso-ansi-font-size:10.0pt;
 mso-bidi-font-size:10.0pt;}
@page WordSection1
 {size:8.5in 11.0in;
 margin:1.0in 1.0in 1.0in 1.0in;
 mso-header-margin:.5in;
 mso-footer-margin:.5in;
 mso-paper-source:0;}
div.WordSection1
 {page:WordSection1;}
--&gt;
&lt;/style&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;color: orange;&quot;&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #b45f06;&quot;&gt;=IF(ISNUMBER(FIND(&quot;Dept1&quot;,Department)),&quot;LightBlue&quot;,IF(ISNUMBER(FIND(&quot;Dept2&quot;,Department)),&quot;Yellow&quot;)&lt;/span&gt;&lt;/b&gt;&lt;/blockquote&gt;
&lt;/div&gt;
&lt;div style=&quot;color: #073763;&quot;&gt;
&lt;b&gt;&lt;/b&gt;&lt;i&gt;&lt;span style=&quot;color: #0c343d;&quot;&gt;Modify this field with the correct department names and colors you would like to use.&amp;nbsp; &lt;/span&gt;&lt;/i&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; color: #0c343d;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #073763;&quot;&gt;
&lt;span style=&quot;color: #0c343d;&quot;&gt;3. Add the javascript/spservices/jquery libraries to a document library on your site.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #073763;&quot;&gt;
&lt;span style=&quot;color: #0c343d;&quot;&gt;4. Insert this code into a Content Editor web part on a page&amp;nbsp;and modify the &lt;b&gt;&lt;span style=&quot;color: #b45f06;&quot;&gt;listCalendarName &lt;/span&gt;&lt;/b&gt;variable to be the name of your calendar and update the script tags.&lt;span style=&quot;background-color: white;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;a href=&quot;https://sites.google.com/site/dcsharepointchick/home/-sharepoint-fullcalendar-fiscalfilter/fullCalendar.txt?attredirects=0&amp;amp;d=1&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;&lt;span style=&quot;background-color: white; color: red;&quot;&gt;(&lt;b&gt;View Code&lt;/b&gt;)&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;color: #073763;&quot;&gt;
&lt;span style=&quot;color: #0c343d;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #073763;&quot;&gt;
&lt;span style=&quot;color: #0c343d;&quot;&gt;5. Voila! You should be able to see a color coded calendar similar to the one above! &lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #073763;&quot;&gt;
&lt;span style=&quot;color: #3d85c6;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;color: #3d85c6;&quot;&gt;&lt;/span&gt;&lt;/blockquote&gt;
&lt;div style=&quot;color: #073763;&quot;&gt;
&lt;span style=&quot;color: #3d85c6;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dcsharepointchick.blogspot.com/feeds/4866667766354468853/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dcsharepointchick.blogspot.com/2012/06/sharepoint-calendar-by-fiscal-year.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7715120637497505141/posts/default/4866667766354468853'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7715120637497505141/posts/default/4866667766354468853'/><link rel='alternate' type='text/html' href='http://dcsharepointchick.blogspot.com/2012/06/sharepoint-calendar-by-fiscal-year.html' title='SharePoint Calendar by Fiscal Year with FullCalendar and SPServices'/><author><name>spar</name><uri>http://www.blogger.com/profile/05436274905022706601</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry></feed>