1

I am pretty new at working with Sharepoint (2019) & React, so my question is:

My goal is to develop a webpart, which basically shows entrys from a list in a more fancy way. First of all, i got all the items from that list:

await sp.web.lists.getByTitls(this.properties.listName).items.select("Title", "Description", "Location", "Location/Title", "Location/ID", "Author", "Author/Title").expand("Location", "Author").orderBy(...

I store each value in a variable, for example authorName: item.Author.Title then return for each entry a section, in which i display for example: <div className={classNames(styles.Column, styles.Section)}>{item.authorName}</div>

Now i want to generate a link from that item.authorName to the actual SharePoint User, so that anyone can see his/her contact infos. How this is be done - what is the best approve? Caml Query? I tried a few things but nothing worked fine for me, now I am a little desperated. I am using SharePoint 2019 & React. Would be so thankful for any help!

1 Answers1

0

you can use for example:

  1. Pnp Spfx controls - https://pnp.github.io/sp-dev-fx-controls-react/controls/fields/FieldUserRenderer/

    import { FieldUserRenderer } from "@pnp/spfx-controls-react/lib/FieldUserRenderer";

  2. Pnp Js Library: https://pnp.github.io/pnpjs/sp/site-users/ to get user properties and then render your own information

I can recommend to use Pnp spfx controls (for SharePoint 2019 - use version 1.XX, the latest is 1.20 now)

If you need any additional support do not hesitate to contact me - my environment is also Sharepoint 2019.

Matej
  • 396
  • 1
  • 9