Skip to main content

Posts

Showing posts from August, 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)             {     ...

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.