New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add SiteCollection as scope to EventReceivers cmdlets #241
Comments
@erwinvanhunen , this actually seems to be an issue -- not necessarily with PnP but the way the authenticated context is created. I'm executing following commands to register an event receiver at the site collection level. (The event receiver blocks creation of Lists of certain templates). In both cases, I see event receiver is registered. However, it does not work (does not prevent the list creation) when registered using PnP.PowerShell but works when using old module. I delete event receiver before connecting and registering with other module. So I know both modules are able to register. Another interesting observation is that I cannot delete the event receiver from site collection that is registered using other module. I get 401:unauthorized.
It also works if I go about CSOM way to create context.
Additionally, I tried registering using a Console application. There seems to be similar experience. If I create a context using SharePointOnlineCredentials, it works. If I create context using AccessToken (with AllSites.FullControl scope and with a account that has Tenant Admin access), it does not work (RER is registered but does not work). Do you suggest I open a support case with Microsoft or is it something it can be investigated here? |
We unfortunately cannot fallback to SharePointOnlineCredentials anymore as those do not exist anymore in the later CSOM builds for .NET Core. E.g. we have to use OAuth2 based authentication using access tokens. As such there should be no difference. As the access is delegated access, all the actions performed on the server are performed under your identity. Indeed, if this fails for you, we can't fix that as we do not have control over the server code. What you could try is programmatically make a request to the server with your own access token added to the request. It's a bit of a setup, I understand that, but if that fails we can make sure it's not PnP code doing it. Also when you communicate with MS, if you mentioned the word PnP, there is a huge risk they will redirect you back here... which is not helping you that much. That's why it's important to understand if it's our implementation of handling the access code (we however fully support MS guidelines there and it has been working like this for quite a while already) or it it's something server side. |
Thank you for responding. Yes, I completely agree it is NOT PnP doing. I'm just pointing out that the legacy way works but in this specific scenario, oath2 token based authentication seens to be not working as expected. I have proved it out outside of PnP usage. (I have learned my lesson to not mention PnP in MS tickets :) ) Wondering if anyone in the community can reproduce the behavior I'm seeing.. Again thank you and the community for all you do. |
I tried to register EventReceivers using RestApi. Old module vs new module resulted in the same behavior that I'm experiencing as above. When I execute following command with old module, EventReceiver works (event receiver registered and triggered), however with new module, EventReceiver doesn't work (registered but not triggered).
I found this StackOverflow thread that matches what I am seeing. Hope this gives some more detail/context. |
This issue is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 5 days |
The issue I'm seeing seems to be a result of how we implemented RERs. |
Is your feature request related to a problem? Please describe.
*-PnPEventReceiver cmdlets currently only support List or Web scopes. It would be wonderful to have Site as another scope to get site collection level event receivers.
Describe the solution you'd like
Get-PnPEventReceiver -Scope Site
or something like that.Describe alternatives you've considered
I currently use CSOM to work with site collection level event receivers.
Additional context
Add any other context or screenshots about the feature request here.
The text was updated successfully, but these errors were encountered: