Saturday, June 6, 2020

How to get modern Team & Communication sites using PnP Powershell

PnP Powershell commands are one of the powerful player in accessing and managing the SharePoint Online / On-Premise sites from remote machinePnP team keep on updating the commands based on the updating feature released on SharePoint Online & On-premise tenants.
For now a days, we are keep on talking about modern  team and communication sites. Here I’m going to list out the commands to get the details on the modern sites created based on the team and communication templates.
Visit SharePoint/PnPPowerShell from Github to know more about PnP Powershell and you can view all the powershell cmdlets from PnPPowershell Documentation
In this post, I’m giving you an example based on SharePoint online. So I have installed the online module called “SharePointPnPPowerShellOnline”.
Before accessing the SharePoint objects, open the powershell command prompt and ensure latest powershell module installed on your machine. Use the below command to update to the latest SharePointPnPPowerShellOnline module,
PS:> Update-Module SharePointPnPPowerShell*
Use the below command references to connect the SharePoint online site
PS:> $credential = Get-credential

PS:> Connect-PnPOnline -Url https://ktskumar.sharepoint.com -Credential $credential

Once we got connected to the SharePoint site, use the below commands to get the list of available sites in SharePoint tenant.

Get all SharePoint sites except Modern sites

PS:> Get-PnPTenantSite
The above PnP powershell command retrieves and  shows the available SharePoint classic sites in the Tenant. It doesn’t returns the sites created with modern templates. We may expect this command to show classic and modern sites in coming days.

Get all SharePoint sites including modern and onedrive sites

PS:> Get-PnPTenantSite - IncludeOneDriveSites
The above PnP command retrieves and shows the classic, modern and OneDrive for Buisness sites from the Tenant.

Get all Modern Team SharePoint sites

PS:> Get-PnPTenantSite -WebTemplate GROUP#0
The above PnP powershell command gets and lists the sites created based on Modern team site template from the SharePoint tenant. And each site is associated with a Office 365 group.

Get all Modern Communication SharePoint sites

PS:> Get-PnPTenantSite -WebTemplate SITEPAGEPUBLISHING#0
The above PnP powershell command lists the communication sites from the SharePoint tenant.

The SharePoint online site collection information are stored in the hidden list called “DO_NOT_DELETE_SPLIST_TENANTADMIN_AGGREGATED_SITECOLLECTIONS” under SharePoint Tenant Administration site and this list has the below columns

AllowGuestUserSignIn
PrimaryAdmin
SMTotalSize
Classification
ShareByEmailEnabled
StorageQuota
ExternalSharing
ShareByLinkEnabled
StorageQuota.
FileViewedOrEdited
SiteId
StorageUsed
IsGroupConnected
SiteOwnerEmail
StorageUsed.
LastActivityOn
SiteOwnerName
TemplateTitle
LastActivityOn.FriendlyDisplay
SiteSecondaryOwnerEmail
TimeCreated
NumOfFiles
SiteSecondaryOwnerName
TimeDeleted
PageViews
SiteUrl
Title
List URL: https://<tenant>-admin.sharepoint.com/Lists/DO_NOT_DELETE_SPLIST_TENANTADMIN_AGGREGATED_SITECO
By using the this list, we can also categorize and retrieve the modern site collections. Use the below command references to connect the SharePoint Tenant Administration online site
PS:> $credential = Get-credential
PS:> Connect-PnPOnline -Url https://ktskumar-admin.sharepoint.com -Credential $credential

How To Hide List Column(Read only columns like Check-box, Calculated) in SharePoint 2010/13


  1. Open SharePoint Designer.
  2. Open the website that contains your list with the calculated column.
  3. Click on "Lists and Libraries" in the left column (under Site Objects).
  4. On the right, click on the list that contains your calculated column.
  5. Under "Content Types", click on the content type where you want to hide the calculated column
  6. In the content type screen, click "Edit content type columns"
  7. In the column "Property", try clicking a few times on the "Optional" value until it changes into a dropdown list.
  8. Select "Hidden" from the dropdown list and click on push changes to sites and lists on ribbon.
  9. Finally Save your changes.