0

I am using spfx v.1.21, and pnp/sp v.4.15

I have created a webpart to display contents of a library in a custom way.

Is there a property I can read or some other way I can determine if the user / viewer of the webpart has previously opened / viewed each of the individual items?

I have considered styling :visited with plain html, but of course that will have a different history per device.

In other systems, I have maintained a separate table / store with userid/docid references, but I would rather not maintain a separate list in SharePoint for this purpose if I can avoid it.

My current item-fetching code

private async _getListData(): Promise<ISPLists>{
  const response: any[] = await this._sp.web.lists.getByTitle(this.properties.MyLibraryTitle).items.select('Id','CustomColumnA', 'Title', 'CustomColumnB').orderBy('Modified',false)(); // _sp is: this._sp = spfi().using(SPFx(this.context));

  const shapedItems = response.map((item: any):MyCustomItem =>({
    Author:item.CustomColumnA,
    CorrespondenceDate:item.CustomColumnB,
    Title:item.title,
    IsPreviouslyViewed: ???????????
  }));

return shapedItems;
}
1

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.