In this blog I will talk about a simple PnP PowerShell script which adds Child Terms under each term following the same hierarchy in SharePoint Taxonomy / Metadata.
Note that the same script can be used in SharePoint Online, 2013, 2016 or 2019.
You can refer to below hierarchical structure:
Term Group (Region names) –> Term Set (Region) –> Countries –> Customer –>Mine
Metadata hierarchical structure
In this example I want to add a new term called “Mine missing” under each customer, so instead of doing it manually I will use a script to add Mine missing under each Customer for each country.
Connect-PnPOnline -url <<site url >>
#Here I have used term guid for Asia Pacific to point to a Term
$ParentTerm = Get-PnPTerm -Identity <<term guid>> -TermSet "Regions" -TermGroup "Region names" -IncludeChildTerms -Recursive
$countryterm = $ParentTerm.Terms
foreach($term in $countryterm)
{
$addterms = $term.Terms
foreach($addedterm in $addterms)
{
$ChildTerm = $addedterm.CreateTerm("Mine Missing", 1033, (New-Guid))
Invoke-PnPQuery
}
}
A comprehensive solution showcasing packaging, solution deployment, provisioning and SPFx web parts to inspire and guide developers, business users and SharePoint Admins to create solutions on similar lines.
Why you should have a look at this?
This has been created by best people in this field (SharePoint, Microsoft 365) which means that code, design and relevance of the web parts are extremely good, all the web parts can be used in your tenant as is. You can learn and create your own ways to
Package solutions
Provisioning mechanism
Coding guidelines, standards
Build modern portals
How to get started?
If you want to install everything at one shot the steps are simple. I suggest to have a look first install it on development tenant and not the Production tenant, as it will upload lot of SPFx solutions and make changes so best is that you review it in a developer tenant. Based on your understanding you can plan to deploy it in Production.
Prerequisites: There are some preparation steps which you need to before you install it as follows
Account used to deploy this solution should be a tenant administrator
Works with English tenants, all solutions are in English
An App Catalog is present in SharePoint with Apps option
Account used to deploy this that is tenant admin should also be termstore admin, in general it is but please verify
if you have created a new tenant just now or set targeted relase now or just now created App Catalog then it is advised to wait for 1 day before you install this.
This will ask your User Id and Password, please use tenant administrator for this as it will be used to install the Starter Kit.
Then go to Provisioning folder in the source code you have downloaded from GitHub.
cd <<location>>
Then execute following command in PowerShell
Apply-PnPTenantTemplate -Path .\starterkit.pnp
The command might take 10-15 mins to execute and if all goes well three sites will be created.
You can watch a video to view complete process
Issues you might face
Exception while invoking endpoint: I encounter this issue while installing almost half way through the installation. Error message you might get is this Apply-PnPTenantTemplate : Exception while invoking endpoint https://login.microsoftonline.com/fffff-4121-ae51-71e06b5edc04/oauth2/token.
If you get this it follow below steps rather than the normal steps
Remove earlier version of SharePointPnpPowerShellOnline
Connect-PnPOnline -Url https://tenant-admin.sharepoint.com/ -PnPO365ManagementShell , this will open a window in browser for device login in which you should enter a code specified, make it is succcessful.
Till then you can deploy individual apps in SharePoint 2019 farm and use the apps. Following apps will work in SharePoint 2019 as well
Banner
Followed sites
Links
People directory
Site information
Tiles
Weather
World clock
To deploy the apps you can copy the package from source code you downloaded before from this location “sp-starter-kit-master\source\<<solution-name>>\sharepoint\solution” and upload it to App Catalog of your farm.
There is no need to build the solution and can be directly deployed but in case you face issues you can build it using
gulp bundle --ship
gulp package-solution --ship
SP Starter Kit v2 SP 2019
Once deployed you can add it on a page, in this case I am showing Tiles app.
Tiles App SharePoint 2019Tiles App in SharePoint 2019
I also did a demo of SharePoint Starter Kit V2 on PnP Community SharePoint Framework and JavaScript Special Interest Group (SIG) – Bi-weekly sync call recorded on September 10, 2020.
This issue might occcur in SharePoint on premise versions 2013, 2016 and 2019.
Issue description:
Images do not load properly or load with full size that is without rendition. This can happen if Blob Cache is corrupted on one of the Web Front end or web front ends are not synced between each other.
What is Blob Cache?
A disk based cache which reduces round trip to database to get files such as images, audio or video. Once a file is requested it is copied to a disk for the first time and for subsequent requests file is fetched from dsik rather than database hence reducing load on database. More details here https://docs.microsoft.com/en-us/sharepoint/administration/flush-the-blob-cache
The default max size for an image when using Image Renditions is 40 mega pixels. Should you want to modify this value you will need to add the imageRenditionMaxSourcePixels parameter. For example: <BlobCache location="C:\BlobCache\14" path="\.(gif|jpg|jpeg|jpe|jfif|bmp|dib|tif|tiff|themedbmp|themedcss|themedgif|themedjpg|themedpng|ico|png|wdp|hdp|css|js|asf|avi|flv|m4v|mov|mp3|mp4|mpeg|mpg|rm|rmvb|wma|wmv|ogg|ogv|oga|webm|xap)$" maxSize="10" imageRenditionMaxSourcePixels="100000000" enabled="true" />
Error message: I was not able to identify an error message but users complained that intranet page seems weird and images are displaying over text and etc
How to fix:
Try flushing blob cache with below PowerShell command , this will not recycle the IIS so you can do it during day as well but always good to do it outside office hours.
2. It is not necessary that above will fix the issue, in our case we identified that this did not fix the issue because cache was not getting updated in one of the web front end and time stamp was quite old.
How can you check if it is old and it’s not getting updated?
Visit the folder location of Blob cache on Web front end and each web app will have it’s own folder, check last modified date, you can also compare with other web front ends.
If your issue as explained below then do like this but make sure you have web front end outside of load balancer or you are doing in outside of office hours.
Disable blob cache temporarily: You can make the flag false in web.config file of the IIS which has issues, the line in web.conifg looks like below
Before you start reading this I would like to mention that steps mentioned here are to create a Virtual Machine in Azure for demo, development or labs purpose.
I decided to write this blog as I faced some difficulties while installing SharePoint 2019 on Azure Virtual Machine, I never faced these while installing it on Physical machines or company provided Virtual Machines.
Click on the menu and select “Virtual Machines” and then click Add from top
Azure Virual machine creationAzure Virtual Machine List
2. Once you get to the page you will have lots of tabs to filled in, I have highlighted few fields which are required and needs to be filled in, rest of it can be left as is.
Important field which we need to select is “Image” that is we need a Windows Server etc, for easy installation I will be selecting a Windows server with SQL Server 2016 already installed in it so that we don’t have to do that manually.
Creating Azure Virtual machine
3. Select “Browse all public and private images” and search for SQL server 2016 and select Standard SP 2 version, for size I recommend 4 CPU and 16 GB memory else the server runs very slow as SQL and SharePoint both are running on the same server.
Selecting image for Azure virtual machine
4. Next step is to create an Admin account so pick a name and password which you can remember. After that you can click “Review + Create”, although there are lot of other things which can be filled in but sake of simplicity I will just leave them as is.
Review and create Azure Virtual Machine
5. Once on the Review tab, click “Create” to create the Virtual Machine. It will start the deployment process and might take 10 minutes. You can check the progress while it deploys.
6. After creation you can check the Virtual Machine in the list, click on the name to access it.
Azure virtual machine list
7. Click on the name and you will get to a window as show below, to connect to the machine we should RDP it, so click Connect and chose RDP. It will download a file which can be used to connect to machine using the Admin account you have created. This finishes step for creating Virtual Machine.
Azure Virtual machine created
Add domain servcies to Virtual Machine
Initially I had thought that this steps is not needed but it does not work if Virtual Machine is not connected to a domain, you will get an error at the end of SharePoint 2019 installation that is Search Service Application will not be created successfully. You may get errors like below
The SDDL string contains an invalid sid or a sid that cannot be translated.Parameter name: sddlFormSystem.ArgumentException: The SDDL string contains an invalid sid or a sid that cannot be translated.Parameter name: sddlForm at System.Security.AccessControl.RawSecurityDescriptor.BinaryFormFromSddlForm(String sddlForm) at System.Security.AccessControl.RawSecurityDescriptor..ctor(String sddlForm) at
Errors were encountered during the configuration of the Search Service Application. System.ArgumentException: The SDDL string contains an invalid sid or a sid that cannot be translated. Parameter name: sddlForm at System.Security.AccessControl.RawSecurityDescriptor.BinaryFormFromSddlForm(String sddlForm) at Microsoft.SharePoint.Win32.SPNetApi32.CreateFileShareWithSecurity(String name, String description, String path, String sddl) at Microsoft.Office.Server.Search.Admi.nistration.AnalyticsAdministration.CreateAnalyticsUNCShare(String dirParentLocation, String shareName) at Microsoft.Office.Server.Search.Administration.AnalyticsAdministration.ProvisionAnalyticsShare(SearchServiceApplication serviceApplication) at Microsoft.Office.Server.Search.Administration.AnalyticsAdministration.CreateDefaultStoreLocation(SearchServiceApplication serviceApplication) at Microsoft.Office.Server.Search.Administration.AnalyticsAdministration.ProvisionRawEventStore(SearchServiceApplication serviceApplication) at Microsoft.Office.Server.Search.Administration.AnalyticsServiceAdministration.Provision() at Microsoft.Office.Server.Search.Administration.SearchServiceApplication.Provision() at Microsoft.Office.Server.Search.Administration.SearchAdminUtils.UpdateIgnoreSPUpdatedConcurrencyException(String description, SearchAdminUtilsUpdateDelegate updateDelegate, SearchAdminUtilsRefreshObjectDelegate refreshObjectDelegate) at Microsoft.Office.Server.Search.Administration.SearchConfigWizard.CreateSearchApp() at Microsoft.Office.Server.Search.Administration.SearchConfigWizard.ProvisionSearchServiceApplication() at Microsoft.Office.Server.Search.Administration.SearchConfigurationJobDefinition.ExecuteTimerJob()
Once that is done you have got rid of other error which will come as now you will be using a domain account and not local account to install SharePoint 2019.
The specified user “username” is a local account. Local accounts should only be used in standalone mode.
Check SQL Server settings :
Open SQL Server Management Studio which should be installed already as we had got server with SQL server already installed.
The account which will install SharePoint 2019 should have required access like below, this account is same as what you had created while creatin Virtual Machine. You can find it under Logins and make sure you have selected “dbcreator” and “securityadmin”. This will make sure the account has correct access to create databases while installing SharePoint 2019.
SQL Server SharePoint 2019
3. Another thing we need to do is to make sure the account which you updated above has name as “domain\username”, initially it will have name as “computername\username”, since we when we created Virtual Machine with SQL server there was no domain it will remain as is. If you miss this step then you will have issues while creating Search Service Application. So remember to change name as suggested by right clicking and rename. Error message while installing SharePoint 2019 will be like below
The service application “Search Service Application” could not be created because of the following error: System.Data.SqlClient.SqlException (0x80131904): Windows NT user or group
Once downloaded first step is to install pre-requisites, make sure you have an internet connection else it will not work. Click on “Pre-Requisites”, you will the installation happening
Shareoint 2019 installation
4. Once that is done successfully double click “setup” to installing SharePoint 2019, it will start the installation, check pictures below to understand the steps, in the step 2 make sure you use the same account you had created before with format as “domain\username”, in step 3 select “Single Farm”.
Once the above steps are done a IE window will open to configure further, you can chose to perform rest of the steps manually or run the wizard, I chose to run wizard.
So this should finish your SharePoint 2019 installation and you are ready to use it.
Connect with me on Twitter or Linked In if you need more information.