Posts

Showing posts from May 31, 2019

Get People Picker user properties in SharePoint Online

SPClientPeoplePicker.SPClientPeoplePickerDict.pplNominationSubmitted_TopSpan.OnValueChangedClientScript = function (peoplePickerId, selectedUsersInfo) { if (selectedUsersInfo[ 0 ] == undefined ) { $( "#txtNomination" ).val( "" ); } else { getUserDetails(selectedUsersInfo[ 0 ].Key, "txtNomination" , "pplNominationSubmitted" ); } }; /***This will give you the selected user Details***/ function getUserDetails(userName, ctrl, pplCtrl) { var email = userName.split( '|' )[ 2 ]; var url = "/_api/SP.UserProfiles.PeopleManager/GetPropertiesFor(accountName=@v)?@v=%27i:0%23.f|membership|" + email + "%27" getItems(url, function (userData) { var userProperies = $.grep(userData.d.UserProfileProperties.results, function (item, index) { return item.Key == "Department" ; }) GetUserID(userData.d.AccountName, pplCtrl) }); } /***It will Create the user in Site

SPFx Documentation Sharpoint Online

Install node js (Recommneded Node js is 8.x)        node package manager will install automatically Install Yoeman -- scaffolding engine (which executes generators that prompt theuser with questions based onthe answers yroman will create the folders and files     npm install -- global yo Install Sharepoint Frame work Yeoman Generator -- to create sharepoint frame work prjects folder structer for sharepoint projects     npm install --global @microsoft/generator-sharepoint Install Gulp - it is just like a MS Build in veisual studio (Gulp is a task runner utility)     npm install --global gulp ______________________ For Every New Project After navigating to the desired location, Create Folder with project name md GetListItems Run the Sharepoint Yeoman Generator for project folder structure yo @microsoft/sharpoint While Creating the project folder it will ask you few question related to the project for example if title description and all if you need to change the title

SharePoint Online Communication site Observations

In Communication Site we can not enable Publishing feature In communication site we can not find save list as template option for list  How to enable external user in online site ? in the tenet site select the site collection and click on the share on the ribbon and enable the external sharing

Client Methods In Rest API

Put Request 1)If you strict to the Arcticture and you want to perform the update methods with out passing the function name in the end point then it will automatically invoke the Put method 2)If you want to update a item withe item id then Put is the Perfect approch 3)in Put request we have to pass the data as a body object and in Id as a query parameter 4)PUT is used to replace a resource, if that resource is exist then simply update it, but if that resource doesn't exist then create it 5)using PUT we will provide the resource identifier Post Request 1)A HTTP.POST method always creates a new resource on the server. Its a non-idempotent request i.e. if user hits same requests 2 times it would create another new resource if there is no constraint. 2)Here you are posting the resqust with body object 3)Post is used to create a resource and the returns the resource 4)POST will return the new resource identifier Patch A HTTP.PATCH method is used for partial modifications

Validate Custom People Picker Control in SharePoint Online

var pplNominationSubmitted = SPClientPeoplePicker.SPClientPeoplePickerDict.pplNominationSubmitted_TopSpan; var pplNominationSubmittedUser = pplNominationSubmitted.GetAllUserInfo(); if (pplNominationSubmittedUser.length <= 0 ) { alert( "Please enter the 'Name' of the Submitter " ) }

Set Logged in User As Default value in Custom People Picker control in SharePoint Online

SP.SOD.loadMultiple([ 'sp.core.js' , 'sp.runtime.js' , 'sp.js' , 'autofill.js' , 'clientpeoplepicker.js' , 'clientforms.js' , 'clienttemplates.js' ], function () { if (ItemID == "" ) { SetAndResolvePeoplePicker( "pplNominationSubmitted" , _spPageContextInfo.userEmail) } });

Set User in SharePoint People Picker Custom Control in SharePoint Online

SP.SOD.loadMultiple([ 'sp.core.js' , 'sp.runtime.js' , 'sp.js' , 'autofill.js' , 'clientpeoplepicker.js' , 'clientforms.js' , 'clienttemplates.js' ], function () { SetAndResolvePeoplePicker( "pplNominationSubmitted" , item.SubmitterName.EMail) SetAndResolvePeoplePicker( "pplDirectReportingManager" , item.NomineeDirectRMName.EMail) SetAndResolvePeoplePicker( "pplIndividualUser" , item.NomineeName.EMail) });

Make SharePoint People Picker Custom Control as Empty in Sharepoint Online

$( "div[id=' pplIndividualUser ']" ).focusout( function () { <-- People Picker Control Div ID var fieldName = "pplIndividualUser" var _PeoplePicker = $( "#" + fieldName + "_TopSpan" ); var _PeoplePickerTopId = _PeoplePicker.attr( 'id' ); var _PeoplePickerOject = SPClientPeoplePicker.SPClientPeoplePickerDict[_PeoplePickerTopId]; var usersobject = _PeoplePickerOject.GetAllUserInfo(); if (usersobject.length == 0 ) { $( "#pplIndividualUser_TopSpan_EditorInput" ).val( "" ) } });

Set Logged in User As Default value in People Picker Field SharePoint 2013

function setLoggedinUser() {         var currentUser;         if (SP.ClientContext != null) {             SP.SOD.executeOrDelayUntilScriptLoaded(getCurrentUser, 'SP.js');         }         else {             SP.SOD.executeFunc('sp.js', null, getCurrentUser);         }         function getCurrentUser() {             var context = new SP.ClientContext.get_current();             var web = context.get_web();             currentUser = web.get_currentUser();             context.load(currentUser);             context.executeQueryAsync(onSuccessMethod, onRequestFail);         }         function onSuccessMethod(sender, args) {             var account = currentUser.get_loginName();             var accountEmail = currentUser.get_email();             var currentUserAccount = account.substring(account.indexOf("|") + 1);             SetAndResolvePeoplePicker("Name OF Employee", account);         }         // This function runs if the e