3

I want to create a windows forms application which will run on client computer and will notify users when a new item added to a specific SharePoint list. Creating windows forms application or displaying notifications on this application is not really difficult but what is the best way to getting data from SharePoint list? It may be done by checking SharePoint list every 5 minutes for new items; but I do not want to do that. Can I broadcast data from SharePoint to trigger this application to notify users? Is there any other ways to do this?

Thanks in advance.

  • Why are you not using event receivers for this scenario? – Amit Feb 3 '17 at 12:55
  • How can I display notification on client computer using event receiver? After creating event receiver which steps should I follow? – newbie Feb 3 '17 at 13:21
1

Follow under stap

  1. Create workflow on item added
  2. Call Webservices from workflow
  3. Webservices call google api and get notification in windows application
0

You can go ahead with SignalR.

For that purpose you need several things combining together:

  1. Dedicated web application for hosting SignalR hub and some Web API which triggers SignalR broadcast. All you win forms clients should have an access to this web app.
  2. Event receiver inside SharePoint. Event receiver's code sends new request to your Web API notifying that new item added. Your Web API in turn will send SignalR broadcast message to all clients (client can be any application - web, desktop or mobile).
  3. Your desktop app listen to messages from your SignalR hub and displaying notifications about new items.

Here is sample code for winform app listen to SignalR:

HubConnection hubConnection;
IHubProxy hubProxy;
public Form1()
{
    InitializeComponent();
    hubConnection = new HubConnection("http://localhost:32555/signalr/hubs");
    hubProxy = hubConnection.CreateHubProxy("MyChatHub");
    hubProxy.On<string>("newMessageReceived", (message) => lstMessages.Items.Add(message));
    hubConnection.Start().Wait();
} 

More info here - How to Push Data from Server to Client Using SignalR

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.