1

I want to execute a powershell script from an event receiver. The event receiver is triggered whenever an new item is added to my custom list in sharepoint online site.

1
  • You won't be able to do that. Sep 25 '14 at 15:57
0

Whatever you do in Powershell, you should be able to convert in code behind. If you start another post on that, maybe I could help convert it. But if that is too cumbersome, try this post:

http://devinfra-us.blogspot.ca/2011/02/using-powershell-20-from-aspnet-part-1.html

Or you could try running a process object from your receiver (something I've only tested with executables)

Process myProcess = new Process();
myProcess.StartInfo.UseShellExecute = true;
myProcess.StartInfo.FileName = @"C:\Approvals.ps1";
myProcess.StartInfo.CreateNoWindow = true;
myProcess.Start();
3
  • Can i hardcode my powershell script inside the event receiver code.Because i want to run this event receiver from sharepoint online.
    – saud
    Sep 26 '14 at 6:46
  • Powershell script cannot be deployed to sharepoint online.
    – saud
    Sep 26 '14 at 6:52
  • I guess I should read the title of the post. Sorry Sep 26 '14 at 13:41

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.