Current User Display Name
Posted by Stu - Aug 10 ’16 at 08:37
How do you get the current users Display name?
Thanks
Stuart
-
Dmitry KozlovAdminMember for: 9 years 4 months 17 days
Hi Stu,
Please, use the code:
SP.SOD.executeOrDelayUntilScriptLoaded((function () { var ctx = new SP.ClientContext.get_current(); var web = ctx.get_web(); ctx.load(web); var user = web.get_currentUser(); user.retrieve(); ctx.executeQueryAsync( function () { alert(user.get_title()); }); }), "SP.js");
-
StuMemberMember for: 6 years 8 months 28 days
Thanks it worked perfectly
-
GregFitzMemberMember for: 7 years 9 months 2 days
[#1]:
Hello,
Hope all is well, I have a quick question hoping you can help with.
I wanted to hide a table (or show) based on current user.
Using the following script (thank you Dmitry for forum post) I can get the current user:
SP.SOD.executeOrDelayUntilScriptLoaded((function () {
var ctx = new SP.ClientContext.get_current();
var web = ctx.get_web();
ctx.load(web);
var user = web.get_currentUser();
user.retrieve();
ctx.executeQueryAsync(
function () {
alert(user.get_title());
});
}), "SP.js");
However trying to filter using the above var ‘user’ isn’t working .
i.e.
if (user == 'Reviewing%20%Manager') {
$('.MgmtC').show(); // Enable
} else {
$('.MgmtC').hide(); // Disable
}
I must be missing something
Thanks,
Greg -
annajennerMemberMember for: 2 years 3 months 11 days
Hello ! Do you know a company that provides expert-level ios development services ? I am an entrepreneur and now I am planning to develop an online store in order people to make orders 24/7.
Thanks in advance! -
Karli RathMemberMember for: 2 years 2 months 20 days
You know that import and export business is the biggest business in the world and more that three billion folks are connected with. I have just got college paper writing services and read this wonderful post about import and export business which provided me many businees tips and info.
-
Berenice5MemberMember for: 2 years 2 months 18 days
Are you searching for academic writing help and having a problem with writing BTEC assignments? BTEC coursework is the best solution to resolve your issues related to assignments. We are the qualified assistant to deal with your high-level assignments by pouring in our efforts to let you present the best of the write my assignment writing.
-
Berenice5MemberMember for: 2 years 2 months 18 days
Are you searching for academic writing help and having a problem with writing BTEC assignments? BTEC coursework is the best solution to resolve your issues related to assignments. We are the qualified assistant to deal with your high-level assignments by pouring in our efforts to let you present the best of the write my assignment writing.
-
OddyannMemberMember for: 2 years 1 month 22 days
<a href="https://www.reddit.com">Thanks!</a>
-
shub8923MemberMember for: 2 years 1 month 1 day
UPSEE Exam is conducted for students who have recently completed their
schooling and want to take admission in any professional course. After qualifying
for the examination, the student will go through counselling to choose the
colleges of their choice. Moreover, students can visit our website to know the exam dated and syllabus for this exam.
-
jameswMemberMember for: 1 year 3 months 9 days
The cryptocurrency market is a very interesting thing. It is not for nothing that many people study it and thereby increase their income. Recently I found an article https://goodcrypto.app/trading-cryptocurrency-101-what-tools-do-you-need-2/ about the basics of cryptocurrency trading.