Posts

Showing posts from March, 2018

Declaring and Reading the SharePoint People Picker Values Programmatically.

Declaring the Sharepoint Custom People Picker and Reading the Value. 1. Copy and Paste the below code in your form to create the Sharepoint Custom People Picker Control in Visual Web part design page. <SharePoint:PeopleEditor ID="pplEditor" CssClass="ms-long ms-spellcheck-true" runat="server" Rows="1" MultiSelect="false" PlaceButtonsUnderEntityEditor="false" Width="500" SelectionSet="User" /> 2. Make it " true " the MultiSelect Option, if you want to select the Multiple Users from the Picker. 3. Use the below code snippet to Read the Value from the People Picker. SPFieldUserValue userValues=new SPFieldUserValue(); userValues = GetSPUserValue(web, pplEditor); Method used to Get the People Picker Values  /*People Picker Control*/         public SPFieldUserValue GetSPUserValue(SPWeb objSPWeb, PeopleEditor pplEditor)         {             try             {                

REST API to check login user groups

/*  Check Current user Permission Level or User Group */ function getCurrentUserReviewerAndApprover() {      var currentUserRole = "";     jQuery.ajax     ({         url: _spPageContextInfo.webAbsoluteUrl + " /_api/web/GetUserById(" + _spPageContextInfo.userId + ")/Groups ",         method : "GET",         async : false,         headers : { "Accept": "application/json; odata=verbose" },         success : function (data) {             var results = data.d.results;             var isVisitor =  false ;             var isMember=  false ;             var isOwener=  false ;             //var groupInfo = jQuery.grep(results, function (group) {             jQuery.grep(results, function (group) {                 if (group.Title === "Visitor") {                     isVisitor = true ;                                  }                if (group.Title === "Member")                {