Posts

Showing posts with the label PnP

How to get site collection created date in SharePoint Online

Image
  Q: How to get the site collection created date in SharePoint online Answer:  This can be done using the PnP SharePoint commands $connection  =   Connect-PnPOnline   - Url  " <SITE URL> "   - ReturnConnection  - UseWebLogin $web  =   Get-PnPWeb   - Includes Created  - Connection $connection Write-Host  $web.Created Happy Coding...!!!

Retrieve SharePoint List Item Versions in SharePoint Online using PnP

Image
  In many cases, we need to identify the versions of the SharePoint List Item. So here is the way to get all the versions of the item using PnP. function   Get-ItemVersion  {      param  ($spURL, $spListTitle)           $checked  =  ([ char ] 8730 )           Write-Host   " Creating connection to the SharePoint Online..... "   - ForegroundColor Yellow  - NoNewline     $spConnection  =   Connect-PnPOnline   - Url $spURL  - UseWebLogin  - ReturnConnection  - ErrorAction Stop      Write-Host  $checked  - ForegroundColor Green       Write-Host   " Reading list items from ' $listTitle '..... "   - ForegroundColor Yellow  - NoNewline    ...

Connect-PnPOnline Error: "Token request failed"

Image
Hi friends, I was working on PnP Powershell and while trying to connect it to the site via AppId & AppSecret or ClientId & ClientSecret I started getting the error: " Connect-PnPOnline: Token request failed ". After a lot of googling, I got the solution or say the root cause of the issue. Find out the expiration dates of the SharePoint Add-ins installed to the Office 365 tenancy When a SharePoint add-in is created, the ClientId and ClientSecret is valid for the duration of 1 year, after that you need to renew the ClientSecret.  To verify the valid keys in your tenant execute the below code Step 1 : Install the MSOnline module To get the information, you need to install the MSOnline module. To install open the Powershell application with the Administrator rights and execute the below command This will install the necessary module Step 2: Check for the valid ClientId's Execute the below code in the Powershell. This will return all the valid ClientID's. Below scr...