Display "Created By"- user id and department from user profile in list view using JSLink

Prajakta Patil 21 Reputation points
2021-02-25T02:06:18.347+00:00

I want to display created by field's loginID and department in list view using JSlink in SP 2016. I observed that Author field gives only following fields: email ,id, title and sip .
I can use id and query userprofile using REST, JSOM but again user profiles directly give info only when LogIn_ID(domain\LoginID) is passed. This way its increasing my api calls. What would be the best way to do this? Don't want to use SSOM and workflow.

Microsoft 365 and Office | SharePoint Server | Development
0 comments No comments
{count} votes

Answer accepted by question author
  1. Baker Kong-MSFT 3,801 Reputation points
    2021-02-25T07:37:37.673+00:00

    @Prajakta Patil ,

    You can get the author field as below:

    71987-image.png

    Or : /_api/web/lists/GetByTitle('xx')/items?$select=Author/Name,Author/Department&$expand=Author

    71989-image.png

    Best Regards,
    Baker Kong


    If an Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Prajakta Patil 21 Reputation points
    2021-03-02T01:59:57.87+00:00

    Finally I decided to use jquery data table as with JSlink export to excel will not export additional columns in excel.

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.