Showing posts with label ECMAScript. Show all posts
Showing posts with label ECMAScript. Show all posts

Friday, February 5, 2016

How to get user displayname in SharePoint 2010 and even more in 2013 ECMA Script

ExecuteOrDelayUntilScriptLoaded(init,"sp.js");
var currentUser;

function init(){
 this.clientContext = new SP.ClientContext.get_current();
 this.oWeb = clientContext.get_web();
 currentUser = this.oWeb.get_currentUser();
 this.clientContext.load(currentUser);
 this.clientContext.executeQueryAsync(Function.createDelegate(this,this.onQuerySucceeded), Function.createDelegate(this,this.onQueryFailed));
}
function onQuerySucceeded() {
 document.getElementById("currentUser").innerHTML = currentUser.get_loginName();
}
function onQueryFailed(sender, args) {
 alert('Request failed. \nError: ' + args.get_message() + '\nStackTrace: ' + args.get_stackTrace());
}
</script>
<div>Current Logged-In User:<label id="currentUser"></label></div>

Tuesday, March 17, 2015

how to create CRUD operation in SharePoint App in Client Object Model?

Add List item
how to create a custom properties in  user profile service application



Open to Central Adminstration->Application Management->Manage Service Applications-> Click on the User Profile Service Application.