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.

SharePoint Server Development
SharePoint Server Development
SharePoint Server: A family of Microsoft on-premises document management and storage systems.Development: The process of researching, productizing, and refining new or existing technologies.
1,438 questions
0 comments No comments
{count} votes

Accepted answer
  1. Baker Kong-MSFT 3,781 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