SPFX sharepoint online webpart subscibe to list webhooks

Tomáš Strnad 1 Reputation point
2020-11-23T13:13:06.18+00:00

Hi all,
I would like to know if is possible to develop spfx Sharepoint online webpart with similar behaviour which is in standard SharePoint list (document library) view webpart for example - when data in underline list is updated web part is automatically updated without any page reload.
I know about this possible solutions:

  1. query list in intervals and check for update
  2. Use webhooks on list with combination with custom Azure Functions -> SignalR or something similar.

Is there any simple solution how for example sign for webhook directly in webpart.
Thank you.
Tomas

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,713 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Amos Wu-MSFT 4,051 Reputation points
    2020-11-24T02:39:19.077+00:00

    In my opinion, webhook is a better choice than scheduled request, but scheduled request is much simpler.
    Here is a tutorial combining webhook with SPFX, you can refer to it:
    https://www.netwoven.com/2020/05/28/implement-your-spfx-application-customizer-using-webhooks/
    Third-party blog disclaimer:
    Note: Microsoft is providing this information as a convenience to you. The sites are not controlled by Microsoft. Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. Please make sure that you completely understand the risk before retrieving any suggestions from the above link.


    If the response 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.


  2. Tomáš Strnad 1 Reputation point
    2020-11-24T08:51:07.397+00:00

    I know about this option and I have read this article before.. I was looking if there is 3th option for described scenario.
    If there is no then i will have to live with it :).


  3. Tomáš Strnad 1 Reputation point
    2020-12-02T08:19:32.9+00:00

    If somebody is also looking for solution without webhooks or calling list in interval as I have specified in question. There is nice option for Libraries->
    https://learn.microsoft.com/en-us/sharepoint/dev/spfx/subscribe-to-list-notifications
    But this is only for libraries -> some workaround needs to be implemented anyway
    Would be nice if subscribe would be available for List as well :(


Your answer

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