Posts

Showing posts from January, 2015

Using an external file in a master page

In our setup, there are frequent changes that get requested that should apply to all sites. As these sites cross site collections, each one has a custom master page although it's the same master page for all sites. In order to make these changes easier, I created a .js file containing document.writes to display my HTML code: document.write('<div class="SiteTitle"><a href="/">(Acronym for title which will change next week)</a></div>'); Any HTML code can go in there, but SharePoint code like this cannot: <SharePoint:SPLinkButton runat="server" NavigateUrl="~sitecollection/"> <SharePoint:SiteLogoImage  LogoImageUrl=" http://sharepoint.name/SiteAssets/MasterPage%20Assets/sitelogoimage.png " runat="server"/>  </SharePoint:SPLinkButton> The SharePoint tags are executed server side while the js is client side code. However, in the example above, changine the image ...

SharePoint 2010 Hide Quick Launch

Handy Javascript code to hide the quick launch (left nav) bar.  just add it to the html on the page or a content editor web part. <style type="text/css"> /*--Hide Quick Launch--*/ #s4-leftpanel{ display:none } .s4-ca{ margin-left:0px } </style>

SharePoint 2010 Powershell script displays all the Site Collection Administrators for a given web application.

Here's a useful powershell script that I'm blatantly stealing borrowing from here .  This script displays all the Site Collection Administrators for a given web application. $siteUrl = Read-Host "Enter Site URL" $rootSite = New-Object Microsoft.SharePoint.SPSite($siteUrl) $spWebApp = $rootSite.WebApplication foreach ($site in $ spWebApp.Sites ) { foreach ($siteAdmin in $site.RootWeb.SiteAdministrators) { Write-Host "$($ siteAdmin.ParentWeb.Url ) - $($siteAdmin.DisplayName)" } $site.Dispose() } $rootSite.Dispose()

SharePoint 2010 Developer Dashboard

Image
The Developer Dashboard can be a handy little debugging tool that will give you all sorts of info. To turn it on, use the STSADM command: stsadm -o setproperty -pn developer-dashboard -pv on or to not screw up your page, try setting it to on demand: stsadm -o setproperty -pn developer-dashboard -pv ondemand When it is on demand, click the icon (circled): to see something like this on the bottom of the page: Developer Dashboard •Request (GET:http://xxxxxxxxxxxx:80/xxxxxxxxx/default.aspx) (493.96 ms) BeginRequestHandler (0.11 ms) PostAuthenticateRequestHandler (0.12 ms) PostResolveRequestCacheHandler (50.32 ms) GetWebPartPageContent (33.00 ms) GetFileAndMetaInfo (32.56 ms) GetWebPartPageContent (127.62 ms) GetFileAndMetaInfo (127.28 ms) PortalSiteMapDataSource: Determining Starting Node (0.01 ms) PortalSiteMapDataSource: Determining Starting Node#1 (0.01 ms) Add WebParts (6.17 ms) xxxxx Shared Calendar (0.64 ms) xx Logo (0.15 ms) Site Image (0.12 ms) xxxx Org Char...