Cadder

Results 10 comments of Cadder

> Have you tried connecting to a site, then using Get-PnPAccessToken to fetch the current access token? You could then use that access token to connect again ...no I haven't....

..Rolling back to PnP.PowerShell 1.10.0 stops Get-PnPContext from throwing the error.

> If you use -ReturnConnection you need to apply -connection switch on all consecutive commands. > Just tested it and it works, you might want to close all ISE/PowerShell windows...

> I agree, it is a major change, ... You can rollback to the old module and update over time, I spent most of the week doing the same. **/re-reads...

Oh this is infuriating. If you *DON'T* stipulate -ReturnConnection, you run into this problem: https://github.com/pnp/powershell/issues/1729 which.. despite comments to the contrary, *hasn't* been fixed and still exists in 1.11.0.

Thanks for the response.. > For a bit of context around the change, you might want to read up on the discussion that has gone on here: #2071 Will do....

Thanks @KoenZomers. The same archiving script is also now throwing this error, as (kinda) reported in https://github.com/pnp/powershell/issues/2099 : **Remove-PnPFile -Connection $Conn -ServerRelativeURL $pnpFileObj.ServerRelativeURL -Recycle -Force** ``` Remove-PnPFile : Value does...

@dimitargeorgievmitev Sending **Remove-PNPFile** to a variable made no difference. I still got the error. However I [did some testing](https://github.com/pnp/powershell/issues/2099#issuecomment-1193070712) and figured I could replace the **Remove-PNPFile** with **Remove-PNPListItem**.

> I can confirm this, we're seeing the same issue. Remove-PnPFile no longer works with release 1.11.0. > > I reverted back to 1.10.0 this morning and it works again....

**WORKAROUND:** I gave up trying to get **Remove-PNPFile** to work intuitively, but did find an old article here: [Why Use Remove-PnPListItem vs Remove-PnPFile?](https://threewill.com/why-use-remove-pnplistitem-vs-remove-pnpfile/) which suggested there is a better way...