Advertisement
In this article we can able to know, how to populate current
login user in SharePoint and we can able to populate in to people picker using
JQuery.
First upload the JQuery in to the Site Assets library.
Navigate to particular list that you want to populate the current login user ,In the NewForm.aspx edit the page add the current editor edit it and
refer the JQuery file.
<script type="text/javascript" src="/sites/dotnetsharepoint/SiteAssets/jquery.SPServices-0.7.2.min.js"></script>
<script type="text/javascript" src="/sites/dotnetsharepoint/SiteAssets/jquery.SPServices-2014.02.min.js"></script>
<script language="javascript" type="text/javascript">
$(document).ready(function()
{
ExecuteOrDelayUntilScriptLoaded(populateCurrentUser, "sp.js");
});
function populateCurrentUser() {
var currentuserName = $().SPServices.SPGetCurrentUser({
fieldName: "UserName",
debug: false
});
var controlName = "Author"; // fieldname in the list
var peoplepickerDiv = $("[id$='ClientPeoplePicker'][title='" + controlName + "']");
var peoplepickerEditor = peoplepickerDiv.find("[title='" + controlName + "']");
var sppeoplepicker = SPClientPeoplePicker.SPClientPeoplePickerDict[peoplepickerDiv[0].id];
peoplepickerEditor.val(currentuserName);
sppeoplepicker.AddUnresolvedUserFromEditor(true);
}
</script>
815A6F0E9C
ReplyDeleteTakipçi Satın Al
Whiteout Survival Hediye Kodu
Telegram Coin Botları
Osm Promosyon Kodu
101 Okey Vip Hediye Kodu
The article explains how to retrieve the currently logged-in SharePoint user and populate that user into a People Picker field using jQuery and SPServices. The example demonstrates loading the required libraries, waiting for SharePoint scripts to load, retrieving the current username, and assigning it to the People Picker control.
DeleteThe example is a useful demonstration of how JavaScript and jQuery can interact with SharePoint controls and automate common form-related tasks. Developers interested in strengthening their JavaScript skills can explore Javascript Training Courses to learn programming concepts that can be applied to web-based applications.
The article also shows how client-side scripting can work with SharePoint's People Picker functionality to populate user information automatically. Developers interested in modern frontend development can also explore ReactJS Course in Chennai to build broader skills in JavaScript-based application
Delete6325C8EC
ReplyDeleteÖlüdeniz
Akhisar
EreÄŸli
Silivri
Güllük
İnegöl
Payas
Kırıkhan
Kuşadası