Category Archives: Cheat Sheet

Siôn Lewis

28/11/2020

When attempting to debug a recently copied SPFx solution I kept seeing the following error displayed by my browser:

Cannot GET /temp/workbench.html

As per usual, I had entered the following command into the VSCode Terminal window:

gulp serve --nobrowser

Selected the Local workbench profile and clicked on Start Debugging, which attempted to opened the following URL with Google Chrome:

https://localhost:4321/temp/workbench.html

The solution to stop this “Cannot GET” error was to enter the following URL:

https://localhost:5432/workbench

This appears to reset the “service, cache or something” causing the error to go away.

Now I can debug as per normal again.

How to ‘Unblock’ PowerShell files

Frustrated by the warning message on Windows computers “This file came from another computer and might be blocked to help protect this computer“? The warning appears when you try to open a PowerShell file that has come from a 3rd party.

Check Security section

Right-click on a single file and choose Properties and look for the Security section at the bottom of the window:

“This file came from another computer and might be blocked to help protect this computer.”

You can check the box (in Windows 10) or click the Unblock button (in Windows 7/8) to unblock the file.

Unblock multiple files

If you have multiple files and are unable to select them all at once, you will need to manage each file separately to unblock them. If the files were supplied in a ZIP file, make sure you always unblock the ZIP file before extracting the files.

Unblock multiple files with PowerShell

If you have multiple files an alternative is to run the following PowerShell:

dir -Path [directory path] -Recurse | Unblock-File

Note: Don’t forget to replace [directory path].

SharePoint Online Admin cannot access the Content Type Hub

This is the second time I’ve been unable to access the Content Type Hub on a new Tenant as SharePoint Administrator.

The first time it happened, I thought it might be a one-off provisioning error and so I asked the Company Administrator (the person who create the Tenant) to grant me access.

This time I thought this might be in Microsoft plan to limit access. Having done a Google search and found solution posed by Jasper Ooosterveld. Apparently, he has had the same issue as a Global Administrator

Because the Content Type Hub is a special and is not listed within SharePoint Admin Center you can use the following URL to add your SharePoint Administration account as a site collection administrators.

https://TenantName-admin.sharepoint.com/_layouts/15/online/TA_SiteCollectionOwnersdialog.aspx?site=https://TenantName.sharepoint.com/sites/contentTypeHub

Do not forget to replace TenantName with your tenant name and that should be job done!

Connect-PnPOnline: unwanted credential caching

UPDATE: May 2021

This problem, as described in my original post below, has been fixed for the Connnect-PnPOnline, when using the UseWebLogin param. Plus, the ClearTokenCache parameter is no longer available…

Connect-PnPOnline -Url "https://[tenant].sharepoint.com" -UseWebLogin; 

The “new” (or orignal) experience when calling the above Cmdlet will look like the following screen shot:

Login screen: That didn’t work … Here are a few ideas…

For more options, see https://pnp.github.io/powershell/cmdlets/Connect-PnPOnline.html#example-9

An alternative is to use the Interactive prameter:

Connect-PnPOnline -Url "https://[tenant].sharepoint.com" -Interactive; 

For more information, see https://pnp.github.io/powershell/cmdlets/Connect-PnPOnline.html#example-10

Original Post

Since creating a new Windows 10 profile (new PC) the Connect-PnPOnline PowerShell CmdLet has been caching my primary credentials while using the UseWebLogin parameter.

Connect-PnPOnline -Url "https://[tenant].sharepoint.com" -UseWebLogin; 

This wouldn’t be a problem if I only worked with on tenant…

After a fair amount of Google searching, mucking around with Internet Explorer and Microsoft Edge settings I found that running the Connect-PnPOnline CmdLet with the following parameters worked:

Connect-PnPOnline -Url "https://[tenant].sharepoint.com" -SPOManagementShell -ClearTokenCache;

Once signed you can revert back to using the UseWebLogin parameter, well until the next time the PowerShell console caches the wrong details… 😉

For more information see: https://docs.microsoft.com/en-us/powershell/module/sharepoint-pnp/connect-pnponline?view=sharepoint-ps

Office 365 Service Health

Need to check the health of your Office 365 Tenant and Services?
Here are some links that may help:

Office 365 (Tenant) Service health
https://portal.office.com/adminportal/home#/servicehealth

Microsoft 365 Service health status
https://status.office365.com

Office 365 outage map
https://downdetector.co.nz/status/office-365/map

SharePoint Online Permissions

Overview of SharePoint Online’s “out-of-the-box” permissions:

Permission Restricted View Read Contribute Edit Design Full Control
Can view pagesYesYesYesYesYes Yes
Can view list items
and documents
YesYesYesYes Yes Yes
Download documentsNoYesYesYes Yes Yes
Can add, update
and delete list items
and documents
NoNoYesYes Yes Yes
Can add, edit and
delete lists
NoNoNoYes Yes Yes
Can approve
and customize
NoNoNoNoYes Yes
Has full controlNoNoNoNoNoYes

SharePoint Online permissions, listed in reverse order:

  • Restricted View
    View pages and documents, but not historical versions or user permissions
  • Read
    View pages and items in existing lists and document libraries and download documents
  • Contribute
    View, add, update, and delete list items and documents
  • Edit
    Add, edit, and delete lists; view, add, update, and delete list items and documents. By default, this permission level is assigned to the Members group
  • Design
    Create lists and document libraries, edit pages and apply themes, borders, and style sheets on the site. There is no SharePoint group that is assigned this permission level automatically
  • Full Control
    Contains all available SharePoint permissions. By default, this permission level is assigned to the Owners group. It can’t be customized or deleted.

For more information, see Microsoft pages:

SharePoint ‘Site Content and Structure’ Admin Page

There have been numerous time I’ve need to publish multiple documents in one go. You could use PowerShell or better still the UI…

Welcome to the Site Content and Structure administration page:
https://[TENANT].sharepoint.com/<SITE-PATH>/_layouts/15/sitemanager.aspx

The Site Content and Structure has been around since SharePoint 2007 and it really shows. But don’t let that get in the way of useful functionality. It is still available in SharePoint Online, even though the link has been removed from the Site Settings page.

Imagine you need to publish 50 site pages in one go:

  1. Navigate to the Site Content and Structure using the URL above
  2. Click on Site Pages, within the left navigation
  3. Select the pages to publish
  4. Click on the Actions menu and then Publish

You will see there are other options:

  • Copy…
  • Move…
  • Delete
  • Check Out
  • Discard Check Out
  • Check In
  • Publish
  • Unpublish this version

Perhaps Microsoft will revive the Site Content and Structure and give it the modern face-lift it deserves…? Vote here if you feel the same: https://sharepoint.uservoice.com/forums/329214-sites-and-collaboration/suggestions/37335316-bring-back-the-site-content-and-structure-page

Finding the site template for a SharePoint site

Need to quickly find the site template for an existing site?
Don’t want to use PowerShell?

Well you’re in the right place, here’s how to do it with favourite web browser.

  1. Navigate to the reliant SharePoint site using your favorite web browser (e.g. Google Chrome)
  2. Open the development tools (e.g. for Chrome, press [F12])
  3. Click on the tab that shows the page source (e.g. for Chrome, Elements)
  4. Search for the following JavaScript variable name: webTemplateConfiguration

You should see something like this:

...,"webTemplateConfiguration":"GROUP#0",...