Tuesday, December 29, 2015

How to check Logged-In User in a SharePoint Group

<script type="text/javascript">
$( document ).ready(function() {
 var userName = $().SPServices.SPGetCurrentUser();
 $().SPServices({
 operation: "GetGroupCollectionFromUser", 
 userLoginName: userName,
 async: false,
 completefunc: function (xData, Status) { 
 if ($(xData.responseXML).find("Group[Name='Manager']").length == 1) {
     alert("Group user");
 }
 else {
      alert("login outside of the Group user");  
 }
 }
 });
});
</script>

No comments:

Post a Comment