Category Archives: Workaround

PowerShell script to hide or display form fields

Hide or show fields in New or Edit forms

SharePoint Customise Form Menu

Microsoft has made it easier to customise “modern” SharePoint Online Lists and Libraries Forms natively.

But what do you do if you need to managing list is “classic” Form or the edit for option is just not available?

One option is to write a PowerShell script, see example below which will hide or show fields within New or Edit Forms.

This code and other scripts can be accessed in GitHub.

For more information on customising Modern SharePoint Forms, see these Microsoft articles:

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.

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!

SharePoint Modern Library Experience: command ribbon

SharePoint Modern Library: Cannot exit “Expand content” mode

After clicking on the “Expand content” command button I have found myself scratching my head:

  • Where is the “Collapse content” command button?
  • Where has the command ribbon gone?
SharePoint Modern Library Experience: “Expand content” command

Well, the command ribbon is still there, it is just hidden by the ‘top placeholder’. Or more precisely, what has loaded into the ‘top placeholder’. For example: Hub Site Navigation or a SPFx Extension.

Having done a few web searches, I’m not the only one seeing this bug and apparently Microsoft is planning to fix the bug. In the meantime, here are two workarounds:

  1. Delete your browser cache (including cookies) and reload the page
  2. Open your browser’s developer tools (e.g. press F12).
    • Select the ‘Console’ tab
    • Paste in the following code
    • Press enter
document.querySelectorAll("button[title='Collapse content']")[0].click();

And now you should see the modern command ribbon again.