C# code to read out all webhooks of a SharePoint Online list

C# code to read out all webhooks of a SharePoint Online list

2018/06/21 Office 365 SharePoint 0
using Microsoft.SharePoint.Client;

ClientContext context = new ClientContext("https://quantr.sharepoint.com/dev");
context.Credentials = new SharePointOnlineCredentials("peter@quantr.hk", ToSecureString("your password"));
Web web = context.Web;
context.Load(web);
context.ExecuteQuery();

List list = context.Web.Lists.GetByTitle("CustomList1");
ListItemCollection collection = list.GetItems(new CamlQuery());
context.Load(collection);
context.ExecuteQuery();


context.Load(list.EventReceivers);
context.ExecuteQuery();

for (int x = 0; x < list.EventReceivers.Count; x++)
{
    Console.WriteLine(list.EventReceivers[x].ReceiverName+" : "+ list.EventReceivers[x].ReceiverUrl);
}
for (int x = 0; x < collection.ToList().Count; x++)
{
    Console.WriteLine(collection.ToList()[x]["Title"]);
}

Console.Read();

read count : 1

Leave a Reply

Your email address will not be published. Required fields are marked *