pnp / PnP-PowerShell

SharePoint PnP PowerShell CmdLets
https://pnp.github.io/powershell
Other
990 stars 663 forks source link

Add cmdlet 'Add-PnPAlert' to add alerts for users #1890

Closed heinrich-ulbricht closed 5 years ago

heinrich-ulbricht commented 5 years ago

Reporting an Issue or Missing Feature

I'm missing a cmdlet to add alerts for users (User.Alerts).

Expected behavior

I expected to find a cmdlet like:

Add-PnPAlert -List "Documents" -CurrentUser -AlertType Email ....

I had to implement it using CSOM (like here), a cmdlet would've been prettier.

Actual behavior

Cmdlet is missing. I searched the code base for AlertCreationInformation but it's not there.

Which version of the PnP-PowerShell Cmdlets are you using?

How did you install the PnP-PowerShell Cmdlets?

KoenZomers commented 5 years ago

@heinrich-ulbricht as you seem to be proficient in CSOM, this could be a very nice moment to join the open source development of PnP PowerShell :) Why not pull a fork of PnP PowerShell and add the command yourself?

heinrich-ulbricht commented 5 years ago

@KoenZomers I'll give it a shot and hope to have a pull request for review soon. Could you please assign this to me (if this is possible)?

KoenZomers commented 5 years ago

I don't have rights to assign things but you should be fine without it. Ensure yourself you're forking off of the latest version. Double check to ensure the command you're about to add really does not exist yet to avoid wasting your time. Most obvious stuff already exists these days. If you're sure it doesn't exist yet, create a new branch in your fork where you will make the modifications. Keep it small and simple. Don't make changes to other files than just yours to keep the pull request clean and give it a better chance of surviving Erwin his strict approval process. Good luck and happy coding!

erwinvanhunen commented 5 years ago

I assigned you @heinrich-ulbricht. Give it a go.

ghost commented 5 years ago

Hello, I was just running the Add-PnPAlert -Title "SharePoint Team Announcements" -List "SPO Announcements" -User $user.LoginName version of this command and am getting Add-PnPAlert : Object reference not set to an instance of an object. At C:\Users\wshea\SPOLPSScripts\SPO-AddUsersToAlerts.ps1:11 char:4

I did find that it worked if I just passed in the $user object entirely rather than the LoginName so you might want to check me out on that and update the documentation if correct. Thanks for writing this one (and all of them) btw.

eshartwell commented 4 years ago

Definitely a great add for the Add-PnPAlert cmdlet. It'd be great if the alert property filterPath could be added at some point to enable setting alerts on folders. Is there a workaround for this functionality now? filterpathexample