How to display user profile information in master page header

I am trying to display user profile info like following in custom master page.
I have just added a html code for displaying this info.
Now, please tell me how could i achieve this
I am doing this in sharepoint 2013 on-premise.

see below is example for javascript and userprofile information
<script type="text/javascript">//<![CDATA[
$(document).ready(function
var currentUser;
// Ensure that the SP.js is loaded
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_title();
var currentUserAccount = account.substring(account.indexOf("|")
+ 1);
var currentUserAccountUnderScore = currentUserAccount.toLowerCase().replace(/\s/g,
//alert(currentUserAccount);
$("#username").text(currentUserAccount);
$("#ProfileImage").attr("src",
"https://mydomain-my.sharepoint.com/User%20Photos/Profile%20Pictures/"
+ currentUserAccountUnderScore +
"_mydomain_onmicrosoft_com_MThumb.jpg");
$("#ProfileImage").attr("alt", currentUserAccount
+ " User Profile Image");
$("#ProfileImage").attr("class",
"ss-profile-image");
//This function runs if the executeQueryAsync call fails.
function onRequestFail(sender, args)
alert('request failed' + args.get_message()
+ '\n' + args.get_stackTrace());
$("#ProfileImage").attr("src",
"https://mydomain.sharepoint.com/SiteAssets/userImageDefault.jpg");
//]]>
</script>
-Nilesh

Similar Messages

  • How to find the profile information of a icloud account user?

    How to find the profile information of a icloud account user?

    This would actually be the Apple ID information and is only available to the user.

  • Create a specific user profile to Material master data

    Dear colleagues.
    We need create on R/3 4.6 a specific user profile for material master data, to create or modify (MM01/MM02) only the following views: 'Sales org. data 1', 'Sales org. data 2' and 'Sales:General/Plant data'. The problem is that when I use the SAP gui functions, I can create the profile, but also with the views 'Foreign trade: Export data' and 'Sales text'. Someone know how create this profile without this last two views? Thanks.

    See:
    http://technet.microsoft.com/en-us/library/cc262327(v=office.15).aspx#create
    And a more complex, in-depth example leveraging MMS:
    http://www.sharepointsteve.com/2010/10/making-custom-user-profile-properties-searchable-in-sharepoint-2010/
    Trevor Seward
    Follow or contact me at...
    &nbsp&nbsp
    This post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.

  • Retrieving Webcenter User Profile information from portlet programmaticaly

    Hi guys,
    I'm triing to retrieve WC user profile information programmatically from a jsr 286 portlet but:
    ADFContext.getCurrent().getSecurityContext().getUserName(); ----> always return anonymous
    ADFContext.getCurrent().getSecurityContext().isAuthenticated() ----> always return false
    (i'm obviously authenticated on webcenter with my profile)
    Anyone knows what the problem is or how to retrieve webcenter user profile information from within a portlet?
    Thank you.

    thank you for the reply, but that issue seems not resolved.
    I hope there are other ways to retrieve user information.
    Anyone knows if there is a way to retrieve programmatically user profile from a jsr286 portlet inside webcenter?
    Edit:
    i've tried passing this parameter to the portlet : #{webCenterProfile[securityContext.userName].userName}
    I can retrieve from the request object and the username is correct, the problem is that i need the whole profile (i have some logic that are dependant on user email, lastname etc), and adding all profile attributes as parameter seems to me not the correct solution.
    I need a way to access the user profile directly from the portlet.
    Edited by: ZOLTAN on Jun 22, 2011 5:56 AM

  • User Profile information

    I have recently installed the 8iLite on a win2000 pro desktop. WHne I log in as scott on POLITE, I get the standard:
    Error accessing PRODUCT_USER_PROFILE
    Warning: Product user profile information not loaded!
    You may need to run PUPBLD.SQL as SYSTEM
    Ok, so I log into the POLITE as system and run this command:
    @PUPBLD
    It creates some synonyms.
    I log back in as scott and still get that message. Is this a problem and how can I resolve it?
    null

    Try these
    Login as system
    Query dba_synonyms
    product_user_profile synonym should be a public synonym
    select from product_user_profile
    delete entries for scott.
    null

  • How to Get user profile properties in provider -cloud hosted app in sharepoint online - office 365 using REST API?

    How to Get user profile properties in provider -cloud hosted app in sharepoint online - office 365 using REST API?
    any idea?

    Hi,
    From your description, my understanding is that you want to get user profile properties in provider-hosted app in SharePoint online using REST API.
    Here is sample code for getting user profile properties:
    http://www.vrdmn.com/2013/07/sharepoint-2013-get-userprofile.html
    Here is a blog below about accessing data from the provider-host apps:
    http://dannyjessee.com/blog/index.php/2014/07/accessing-sharepoint-data-from-provider-hosted-apps-use-the-right-context/
    Best Regards,
    Vincent Han
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • How to check user profile service working in sharepoint 2013?

    HI All,
    How to check user profile service working or not in sharepoint 2013? Thanks.

    Hi,
    Select which OU's you want to synchronize, then check if all users in those OU's have a user profile in the user profile service application.
    Nico Martens - MCTS, MCITP
    SharePoint 2010 Infrastructure Consultant / Trainer

  • How to prevent user keyin wrong in master-detail

    How to prevent user keyin wrong in master-detail.
    Example : User click button to created mster with out crete detail then they going to another master record for created detail for that master,
    How to control user keyin master-detail currect record finish first then can go to another master?
    Is it posible if I will disable another record of master and enable only current record after they finish to keyin master and detail of this record then I enable all.
    If posible can you give me step-by-step and coding.
    Thank you very much

    I'm not able to understand the scenario. You probably will have to provide more detail of the issue.
    --Shiv                                                                                                                                                                                                                           

  • How to display images and information

    how to display images and information(e.g. like questions) on a jsp page that stored in a database

    Look As far as i can see....
    Utlimately every file could be expressed as a bytes buffer.
    so say if you have a bean called Choice Bean which is expressed as
    public class ChoiceBean{
       private String choiceid;
       private String choicedesc;
       private byte image[];
       public void setChoiceId(String choiceid){
              this.choiceid = choiceid;
        public String getChoiceId(){
               return this.choiceid;
          public void setChoiceDesc(String choicedesc){
               this.choicedesc = choicedesc;
           public String getChoiceDesc(){
               return this.choicedesc;
           public void setImage(byte image[]){
                  this.image = image;
             public byte[] getImage(){
                  return this.image;
    }QuestionList.java:
    ===============
    public class QuestionList{
         private List<ChoiceBean> choicelist;
          /*Other member variable declarations*/
           public  List<ChoiceBean> getChoiceList(){
                    /*Custom code where you may build the list by querying the DA layer*/
                     return this.choicelist;
         public int search(String choiceid){
                 int index = -1;
                 for(int i =0 ; i < this.choicelist.size() ; i++){
                        ChoiceBean cb = this.choicelist.get(i);
                         if(cb.getChoiceId().equals(choiceid)){
                                index = i;
                                break;
                 return index;
        /* Other member method declarations */
    }and you are retreving List<ChoiceBean> from DB using your query & have created a session attribute / <jsp:useBean> named ChoiceList
    NOTE: sometimes your application server can go out of bounds as you are consuming a lot of memory by creating an arraylist object.
    use the following methodology to display images & choices
    sample.jsp:
    =========
    <jsp:useBean id="QuestionList"  class="com.qpa.dao.QuestionList" scope="session"/>
    <TABLE>
    <%
    /* QuestionList.getChoiceList() is a method which fetches data from the DB & returns it in form of  List<ChoiceBean> */
    List<ChoiceBean> choicelist = QuestionList.getChoiceList();
    for(int i =0 ; i < choicelist.size() ; i++){
    %>
    <TR>
    <TD><%!=choicelist.get(i).getChoiceId()%></TD>
    <!-- calling servlet which renders an images in JPG format based upon given choiceid(unique field) -->
    <TD><IMAGE src="ImageServlet?choiceid=<%!=choicelist.get(i).getChoiceId()%>"/> </TD>
    <TD><%!=choicelist.get(i).getChoiceDesc()%></TD>
    </TR>
    <%
    %>
    </TABLE>
    <%
        session.remove("QuestionList");
    %>
    NOTE: usage of JSTL or any other custom built tag-libraries makes life more simpler in the following case
    ImageServlet.java:
    ===============
    public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
            byte buffer[] = null;
            HttpSession session = request.getSession(false);
            /*getting the QuestionList from the session*/
            QuestionList ql = null;
            String choiceid = new String("");
            try{
                 choiceid = request.getParameter("choiceid");
                 /*getting the QuestionList from the session*/
                ql = (QuestionList)  session.getAttribute("QuestionList");
            } catch(Exception exp){
            if(choiceid.equals("") == false &&  ql != null ){
                List<ChoiceBean> clist = QuestionList.getChoiceList();           
                   assuming that you have created a serach method which searches the entire choice list and would give you
                   the index of that object which is being refered by unique choiceid and returns -1 if not found
                int index =  QuestionList.search(choiceid);
                if(index != -1){
                   ChoiceBean cb = clist.get(index);
                   buffer = cb.getImage();
            if(buffer != null){
                 // assuming that we have stored images in JPEG format only
                 JPEGImageDecoder decoder = JPEGCodec.createJPEGDecoder(new ByteArrayInputStream(buffer));
                 BufferedImage image =decoder.decodeAsBufferedImage();
                 response.setContentType("image/jpeg");
                 // Send back image
                 ServletOutputStream sos = response.getOutputStream();
                 JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(sos);
                 encoder.encode(image);
            } else {
               response.setContentType("text/html");
               response.getWriter().println("<b>Image data not found</b>");              
    }However,i still feel there are few loopholes with this approach where Application Server can eat up a lot of heap space which may result in outofmemorybound exception.
    Hope this might help :)
    REGARDS,
    RaHuL

  • How to stop user profiles clean-up job from deleting Active users.

    Hi,
    Somehow bunch of active users profile are marked for deletions and their managers have received email saying it will be deleted in X days.
    I know if we disable My Site Clean Up Job, it will not delete any profiles. But I want that job to continue running and stop active user profiles from getting deleted.
    How do I proceed here...
    Thanks,
    Abhilash

    Hi Abhilash,
    I understand SharePoint 2010 MySite clean up timer job is deleting active user profiles.
    Firstly, I need to confirm with you that the timer job will work on below two situations:
    1.When you use the web UI in Central Administration to delete a user profile
    2.When a user who was included in a previous user profile import is no longer included in the import. 
    The second point bears a little more explanation, please refer to How Is A User Profile Deleted?
    in the article below:
    http://blogs.msdn.com/b/kaevans/archive/2012/06/25/top-recommendations-for-managing-the-my-site-cleanup-timer-job.aspx
    Let me know if you situation is not included in the above two.
    Regards,
    Rebecca Tu
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • How to recover user profile PSADMIN to its original status ?

    Folks,
    Hello. My user ID to login into Application Designer is "PSADMIN". I just set up PIA. "http://localhost/psp/ps/?cmd=login" can get to PeopleSoft signon page, and I use "PSADMIN" to login. I can open all of web pages after login. "PSADMIN" is access profile and user profile.
    But after I create a role "newUser" and assign a permission list to the Role, then link the role "newUser" to user profile "PSADMIN", I cannot open most of the web pages after login into PeopleSoft signon page using "PSADMIN". The system come up the message: " You have no access to the Navigation collection. Please contact your Portal Administrator".
    Can any folks tell me how to recover user profile "PSADMIN" to its original status so that open all of web pages after login ?
    Thanks.

    go into PIA using a root user like VP1 or PS and delete what u added to PSADMIN.
    if u have locked ur root user by any chance ... unlocked using back end.
    PSOPRDEFN TABLE , unlock root user using update acctlock .
    then login using that and make changes to PSADMIN. or else simply from the backend u can delete the added role from PSADMIN profile using same table.

  • How to display date and time on jsf page

    Hi,
    how to display date and time on jsf page
    we are using 11.2.0.0 jdeveloper on windows.
    thanks
    Edited by: user12187801 on 26-Jul-2012 01:42

    Your question is certainly lacking some information.
    If you want a constantly updating date/time - then JavaScript is your best bet, and Google would find you examples like [url http://www.webestools.com/scripts_tutorials-code-source-7-display-date-and-time-in-javascript-real-time-clock-javascript-date-time.html]this
    If you meant something else, then it's back to you to explain.

  • How to display horizontal line in top-of-page by using object oriented ALV?

    How to display horizontal line in top-of-page by using object oriented ALV.
    I am created top-of-page in object oriented alv.
    But not be successes in showing horizontal line in it.
    Can any one pls give solution for this..
    Thanks and regards..

    Hi
    Try like this
    data: gt_list_top_of_page type slis_t_listheader. " Top of page text. 
    Initialization. 
    perform comment_build using gt_list_top_of_page[]. 
    form top_of_page. 
    * Note to self: the gif must be loaded into transaction OAOR with 
    * classname 'PICTURES' AND TYPE 'OT' to work with ALV GRID Functions. 
    * I Loaded NOVALOGO2 into system. 
    call function 'REUSE_ALV_COMMENTARY_WRITE' 
         exporting 
    * I_LOGO = 'NOVALOGO2' 
    * i_logo = 'ENJOYSAP_LOGO' 
             it_list_commentary = gt_list_top_of_page. 
    endform. " TOP_OF_PAGE 
    form comment_build using e04_lt_top_of_page type slis_t_listheader. 
    data: ls_line type slis_listheader. 
          clear ls_line. 
          ls_line-typ = 'A'. 
          ls_line-info = 'Special'(001). 
          fgrant = xgrant. 
          concatenate ls_line-info fgrant 
          'Stock Option Report to the board'(002) 
                 into ls_line-info separated by space. 
                        condense ls_line-info. 
          append ls_line to e04_lt_top_of_page. 
    endform. " COMMENT_BUILD
    Use following syntex for footer print in alv:
    * For End of Page
    form END_OF_PAGE.
      data: listwidth type i,
            ld_pagepos(10) type c,
            ld_page(10)    type c.
      write: sy-uline(50).
      skip.
      write:/40 'Page:', sy-pagno .
    endform.
    *  For End of Report
    form END_OF_LIST.
      data: listwidth type i,
            ld_pagepos(10) type c,
            ld_page(10)    type c.
      skip.
      write:/40 'Page:', sy-pagno .
    endform.
    check this link
    http://abapprogramming.blogspot.com/
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/5dc3e690-0201-0010-1ebf-b85b3bed962d
    Changing width of a custom container dynamically
    Display Page numbers in ALV
    Insert picture in selection screen.
    Logo in OO ALV Grid
    Reward all helpfull answers
    Regards
    Pavan

  • HOW TO DISPLAY THE TEXT ON A PARTICULAR PAGE IN SAPSCRIPTS

    HI,
       HOW TO DISPLAY THE TEXT ON A PARTICULAR PAGE IN SAPSCRIPTS?

    in ur script main window
    /: IF &TTXSY-PAGE& = 15.              
    ur text or standard text           
    /: ENDIF.                             
    use this.
    hope it helps if any issues revert back

  • How to display text on last but one page in SAPSCRIPTS

    how to display text on last but one page in SAPSCRIPTS

    u have create one Foooter window , this has to be called in  only One Page.So hardcode /assign this window to only one PAGE number.
    regards
    Prabhu

Maybe you are looking for

  • Sending email with an excel attachment

    Hi, I have designed one workflow for PO approval .For the release code 01 i am displaying the one custom report to the approver . Now the requirement is after release of the code 01 i have to download this custom  report into excel format and i have

  • HT204370 Why should I buy the movie in English and in my language (Slovak) as a separate purchases?

    Here is a screen shot from my iPhone. There is finaly a movie Brave available but if I want to have both audio versions I will have to spent twice 16,99 EUR. I prefer the English but for kids Slovak is essential. Any ideas how should I proceed?

  • Premiere Pro non-responsive

    I have been using Production Premium CS5 for a couple of years now without an issue. Today I made a new project and imported some video clips and dropped them in a new sequence. Then I tried to replace one of the clips (right-click it and "replace fo

  • Newly installed Cap 8 not capturing mouse clicks

    Newly installed Captivate 8 is not capturing my mouse clicks.  Captivate is set to Training & I have my regular settings selected.  I have also worked with the application I am trying to capture before and did not experience any issues.  Thoughts?

  • Order of Voicemail messages

    How do I go to my last voicemail message without opening each message before it?