1

My scenario is i have a list of folders representing companies,each time i have to create a new folder(company) a webhook event is triggered and it call an azure function that assign permission to that folder and create some sub folders. I noticed that if i do upload a file in the subfolders the webhook is triggered!!! Is there a way that it trigger the webhook only on creating a new company? or an alternative way to achieve the same result apart from using webhook

0

As of now SharePoint Webhooks respond to any action within a list. Also only Asynchronous events are being taken care of. We really dont have the flexibility to isolate the events.

The only option would be to write your logic within the Azure function where you will get the item ID using (change as ChangeItem).ItemId} . Now create a list item object using this ID.

Once you have the list item object, check if it is a file or folder using the CSOM code. This was you can run your logic only if the item that caused the event is a folder

 if (listItem.FileSystemObjectType == FileSystemObjectType.Folder)
{
    Console.WriteLine("Folder item ");
}
else
{
    Console.WriteLine("File item ");
}
  • possible workaround but not a good business solution,each time this check is performed the azure function is working and it cost money for the client,If not webhook is there another alternative ? – Keshav Taurah Aug 7 '17 at 9:43
  • i dont think this solution will work in my case,you are just verifying if the changeitem is a folder!! but in my case a new company is a folder but am creating subfolders also,won't they count as folder??? my initial logic should affect only the company folder not the subfolders in it. @Priyaranjan KS – Keshav Taurah Aug 7 '17 at 10:44
  • With webhooks you are left without any other options. The only options then would be to use Remote Event Receiver using Provide Hosted Add-Ins – Priyaranjan KS Aug 7 '17 at 11:00
  • what if i replaced my inner folders by document set,do the above code still works? @Priyaranjan KS – Keshav Taurah Aug 7 '17 at 11:27

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.