Wednesday, 4 February 2015

check current logged user in sharepoint group using spservices

Share it Please
<script type="text/javascript" src="https://Site Collection Url/sites/TestSite/Style Library/Samples/jquery-1.8.0.min.js"></script>
<script type="text/javascript" src="https://Site Collection Url/sites/TestSite/Style Library/Samples/jquery.SPServices-2014.02.min.js"></script>


<script type="text/javascript">
 $(document).ready(function() {

   $().SPServices({
     operation: "GetGroupCollectionFromUser",
     userLoginName: $().SPServices.SPGetCurrentUser(),
     async: false, 
     completefunc: function(xData, Status) {
        if($(xData.responseXML).find("Group[Name='TestGroup']").length == 1)
        {
            alert("Yes");
        }
        else
       {
           alert("No");
       }
      }
   });
}); 
</script>

No comments:

Post a Comment

Followers

Follow The Author