Search This Blog

Total Pageviews

Thursday, September 21, 2017

Expand ALL & Collapse ALL in Sharepoint Library Group View

 <input type="button" value="Expand ALL" onclick="ProcessAll(this)"  style='color:white;background-color:darkgreen;font-weight:bold;'/>

<script>
function ProcessAll(btnobj)
{
if(btnobj.value=="Expand ALL")
{
expandAllData();
btnobj.value="Collapse ALL";
}
else
{
collapseAllData();
btnobj.value="Expand ALL";
}
}
function  expandAllData() {
$("img.ms-commentexpand-icon").click();
}
function  collapseAllData() {
$("img.ms-commentcollapse-icon").click();
}
</script>

Wednesday, September 6, 2017

Clear Your SharePoint Designer 2010/2013 Cache

Procedure:
  1. Close SPD if it is open
     
  2. Open My Computer
     
    a.Click the address bar
     
  3. Paste in:
    %USERPROFILE%\AppData\Local\Microsoft\WebsiteCache
     
  4. Delete everything within this location
     
  5. Click the address bar
     
  6. Paste in:
    %APPDATA%\Microsoft\Web Server Extensions\Cache
     
  7. Delete everything in this location
SharePoint Designer 2010 and 2013
  1. Navigate to the "File" menu then select "Options" -> "General" -> "Application Options".
  2. On the “General” tab, under the “General” heading, uncheck “Cache site data across SharePoint Designer sessions”.

Thursday, August 10, 2017

Validate Current user Belog to Member of the Groups

 public bool VaildateUserBelogtoGroups(string[] groupNames)
        {
            bool rval = false;
            try
            {
                foreach (string grpName in groupNames)
                {
                    SPGroup ogrp = SPContext.Current.Web.SiteGroups.GetByName(grpName);
                    if (ogrp.ContainsCurrentUser && rval == false)
                        rval = true;
                }
            }
            catch (Exception ex)
            {


            }
            return rval;
        }

The above method will validate the Current user becomes the Member of Specific Groups.


Tuesday, August 8, 2017

Show Sharepoint Ribbon on page Load

<script>
setTimeout(function() {
var elem = document.getElementById("MSOZoneCell_WebPartWPQ2");
if(elem != null) {
var dummyevent = new Array();
dummyevent["target"] = elem;
dummyevent["srcElement"] = elem;
WpClick(dummyevent);
}
}, 100);
</script>

The above script will invoke the ribbon by default in IE( for the specific webpart), incase if you added multiple webparts.