Posts

Showing posts from April, 2017

Sharepoint : get all sites where feature is active at site or web level

Sharepoint : get all sites where feature is active at site or web level Please do not forget to comment if this helps. Get all Site Colletions where GUID matched to site colleation feature Get-SPSite -limit ALL | foreach{ $_.features["GUID"] } | select Parent Get all Webs where GUID matched to web feature Get-SPSite -limit ALL | Get-SPWeb -limit ALL | foreach{ $_.features["GUID"] } | select Parent

How to handle JavaScript post back in SharePoint 2010

Scenario : Run JavaScript on page load but not on postback. Why : SharePoint does field validation on server side so it runs page load js again. Please do not forget to comment if this helps. Please use below script to avoid same : $(document).ready(function() { if((window.location.pathname).toLowerCase().indexOf("new.aspx") > 0) { if((document.referrer).toLowerCase().indexOf("new.aspx") < 0) { ExecuteOrDelayUntilScriptLoaded(functionToCall, "sp.js"); } } }); function functionToCall() { alert('Just on page load'); }