While deploying some changes to an existing solution the release pipeline in Azure DevOps suddenly failed while running a PowerShell script for releasing a SharePoint Framework (SPFx) app. This release pipeline uses the PnP.PowerShell module, and automatically installs the latest version each time it is run.
Lately there has been a mayor update to PnP.PowerShell moving from version 1 to 2. Some of the key changes is the support for PowerShell moving from 5.
Moving to a new computer made me test out a new organization of my development projects. Before I always have placed this on the root of the drive, in example C:\Projects. After doing a lot of work in WSL and Ubuntu lately, I though why not try out to use my user’s home directory like is more common when working in Linux. Change is not always good and this time this led med into trouble.
Sharing your custom SharePoint Framework (SPFx) apps with guest users might cause some problems if you tenant is not set up for this.
Everything can work fine for you, but as a guest users error messages like Something went wrong If the problem persists, contact the site administrator and give them the information in Technical Details. appear instead of seeing your app. If they expand the error message it also contains information like Original error: Failed to load path dependency “CommonStrings” from component.
When you create new team or communication sites in SharePoint, the first user that visits will be presented with a template gallery picker. This can be disabled by follow these steps:
https://areflyen.no/2022/05/25/hide-the-template-gallery-from-newly-created-sites-in-sharepoint/ After the web template dialog is closed, a new panel is opened on the right side of the page:
As with the template gallery, presenting this dialog to enable the end-user to customize their site is a great addition if you are using the default templates.
When you create new team or communication sites in SharePoint, the first user that visits will be presented with a template gallery picker:
This is a great feature for simpler solutions or where you utilize the Site Design to apply your solution. For organizations using their own provisioning solution the site might already be ready to use for the end-user and this dialog might cause confusion, and even end up in the user breaking your ready made site with their own template.
Background During a intranet migration there was a requirement to move the intranet from the root site to a site collection under "/sites". When moving site collections around in the SharePoint Admin Center a redirect will automatically be added to the old URL, so in many cases this is sufficient.
In this case we could use this approach, as you only can swap at not move away from the root site.
After upgrading SharePoint Framework (SPFx) to the latest version, there still might be a chance for getting into trouble even if you have done everything by the books. An by the books I of course refer to using the excellent project upgrade tool from the Microsoft 365 CLI (https://pnp.github.io/cli-microsoft365/cmd/spfx/project/project-upgrade/).
Example of error message after running a "gulp build": Error - [tslint] The 'member-access' rule threw an error in ... Or maybe.
If you have been an early adopter of the Hub Site functionality (https://docs.microsoft.com/en-us/sharepoint/planning-hub-sites) in SharePoint Online, you might also get stuck in some trouble with Hub Sites not showing up in SharePoint Admin Center or being unable to register or unregister these sites. Fortunately it is quite easy to clean up broken hub sites and get back on track.
Example of error message from PowerShell registering a hub site (Register-SPOHubSite):
From time to time it is necessary to set the LCID or language code for creating new resources like sites. Even if more and more resources get multi-language support, it is usually be required to set the default language for fallback.
DisplayName LanguageTag Lcid Arabic ar-SA 1025 Azerbaijani az-Latn-AZ 1068 Basque eu-ES 1069 Bosnian (Latin) bs-Latn-BA 5146 Bulgarian bg-BG 1026 Catalan ca-ES 1027 Chinese (Simplified) zh-CN 2052 Chinese (Traditional) zh-TW 1028 Croatian hr-HR 1050 Czech cs-CZ 1029 Danish da-DK 1030 Dari prs-AF 1164 Dutch nl-NL 1043 English en-US 1033 Estonian et-EE 1061 Finnish fi-FI 1035 French fr-FR 1036 Galician gl-ES 1110 German de-DE 1031 Greek el-GR 1032 Hebrew he-IL 1037 Hindi hi-IN 1081 Hungarian hu-HU 1038 Indonesian id-ID 1057 Irish ga-IE 2108 Italian it-IT 1040 Japanese ja-JP 1041 Kazakh kk-KZ 1087 Korean ko-KR 1042 Latvian lv-LV 1062 Lithuanian lt-LT 1063 Macedonian mk-MK 1071 Malay ms-MY 1086 Norwegian (Bokmål) nb-NO 1044 Polish pl-PL 1045 Portuguese (Brazil) pt-BR 1046 Portuguese (Portugal) pt-PT 2070 Romanian ro-RO 1048 Russian ru-RU 1049 Serbian (Cyrillic, Serbia) sr-Cyrl-RS 10266 Serbian (Latin, Serbia) sr-Latn-RS 9242 Serbian (Latin) sr-Latn-CS 2074 Slovak sk-SK 1051 Slovenian sl-SI 1060 Spanish es-ES 3082 Swedish sv-SE 1053 Thai th-TH 1054 Turkish tr-TR 1055 Ukrainian uk-UA 1058 Vietnamese vi-VN 1066 Welsh cy-GB 1106 How to get a updated list from your own environment Using PowerShell and the PnP.
I work a lot with automation of tasks in Microsoft 365 and Azure, and many of them involve connecting to other Microsoft 365 services like SharePoint Online. Years back Azure WebJob was the only viable solution for running automated .NET and PowerShell based tasks, but over the years this has moved along to Azure Functions, Azure Automation or even other solutions like Logic Apps and Power Automate. Automation jobs can be running spotless for years in Azure - but everything great has to come to an end ;-)
A common requirement in the past with classic SharePoint solutions was to create start pages utilizing the full canvas of the page. In classic SharePoint this could easily be accomplished by adding a few lines of CSS in a Page Layout.
For modern pages we don't have Page Layouts anymore, and to accomplish the same result a SPFx Extention can be used. This is more spesific a Application Customizer registering one simple CSS override in the top placeholder of the page.
Lately Microsoft released the new and long awaited modern site template for publishing sites in SharePoint Online (Office 365). The site templates is named "Communication Site" and is the second template released after the modern "Team Site". This site template can be created if you have permissions from the SharePoint Home page using the "Create a site" form:
This approach is fine if you have permissions to create sites and are happy with the default setup.
You are not any longer able to log into SharePoint using PowerShell, SharePoint Designer and other 3. party tools (ex. ShareGate, SharePoint Search Query Tool etc). The error message states something that you are "Unauthorized" and "…the web site does not support SharePoint Online credentials" even though you username and password is fine.
Example: Error while logging in with PnP PowerShell Connect-PnPOnline : Cannot contact web site 'https://TENANTID.sharepoint.com/' or the web site does not support SharePoint Online credentials.
I came across a rare scenario when I was going to convert an existing Office 365 group to a Team. In Microsoft Teams ( https://teams.microsoft.com) I was unable to find the "Create a team" button. In my case I was logged on as a Global Admin and thought that I ruled the whole world, but then again no.
Scenario In Microsoft Teams:
Selected "Add team" in the lower right Expected to find the "
This examples shows how to create new lists from custom list templates in SharePoint using PowerShell and CSOM. Custom list templates are STP-files uploaded to the List Template Gallery on the site. This should work both on-premises (2013/2016) and Online (Office 365).
Note: This example uses commands from the Office Dev PnP PowerShell library, ex. "Connect-PnPContext". I recommend using this library for working this PowerShell and SharePoint (both Online and On-Premises).
In document libraries it is possible to enable ratings, both likes and average score (1-5). In this article I will cover how to enable "Likes" on the Pages library in a publishing site.
When configuring libraries manually, this is enabled from the "Rating settings" in the library:
But when we follow the remote provisioning pattern to create new sites by using PowerShell and CSOM, there is currently no available function in the API for this.
In provisioning solutions it can be a good practice to add a security group from Active Directory as an additional site collection owner. Unfortunately a security group is not accepted as either primary or secondary owner. So to set a group as site collection administrator, the easiest approach I could find was to set the "IsSiteAdmin" property on the User object.
Scheduling is easily enabled through the web interface when configuring the "Pages" library, but when deploying solutions using PowerShell, this must be automated as part of the configuration. Unfortunately, as many other sources also state, this is not directly supported in the Client Side API (CSOM).
The solution is to manually set up the Pages library the same way Microsoft does by adding two event receivers, changing some columns from hidden to visible and adding them to the default view.
By default the XsltListViewWebPart does not support export from the web user interface. I often build solutions by configuring the web parts in the browers, exporting and adjusting the defintions and then deploying them with PowerShell. With a few lines of PowerShell this capability can also be enabled for the Xslt List View Web Part.
Before enabling the Export Mode on the webpart:
After running the PowerShell script and enabling the Export mode:
This is a summary of an issue we have had with publishing pages not being indexed, and then unable to build the search-driven pages we wanted using for example Content Search Web Part. This occured in SharePoint Online (Office 365) and we have only had this issue with a couple of tenants. So my guess is that most tenants are working fine, but if you should come across this strange behavior, I hope this post can help you save some time.
Running data migrations with SharePoint 2013 often involves using BCS and PowerShell if you don't have and third party tools at hand. This can be a bit tricky to set up, but once you are familiar the the BCS configuration, the PowerShell scripts are mostly straight forward.
From my experience there are a few differences when running against BCS lists vs. regular lists. I have now been able to find a good guide for this, so from my own trial and error I wanted to share a few tips.
As we more and more evolve from working exclusively with SharePoint on-premises with our complex local SharePoint farm rigged with several virtual machines eating up our highly spec'd laptop, the new way of working with SharePoint in-cloud offers a more attractive setup for us developers.
My background before starting with SharePoint, as for most others, was as a general programmer used to pretty simple and lightweight development environments. I must say I almost had forgotten what a lightweight and clean development environment feels like.
There is a compatibility range mismatch between the Web server and database "SP2013_Content_InsertDatabaseNameHere", and connections to the data have been blocked to due to this incompatibility. This can happen when a content database has not been upgraded to be within the compatibility range of the Web server, or if the database has been upgraded to a higher level than the web server. The Web server and the database must be upgraded to the same version and build level to return to compatibility range.
Problem Error in Central Admin when accessing the Managed Metadata service application:
The Managed Metadata Service or Connection is currently not available. The Application Pool or Managed Metadata Web Service may not have been started. Please Contact your Administrator.
Error in ULS log:
Failed to get term store for proxy 'Managed Metadata Service'. Exception: System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
Error in Event viewer:
The Managed Metadata Service 'Managed Metadata Service' is inaccessible.
In my previous article I provided a list of all the common used web templates in SharePoint 2013. For demo purposes it can be handy to spin up a copy of all these templates and later easy remove them. Using PowerShell we can accomplish this with the snippets provided below. Change the parameters under "Configuration" to match your own environment.
Create new site collections This snippet will create a new site collection for each of the web templates.
On a SharePoint 2013 intranet project I have been working on, we got a report that a web part had started to perform bad after a while of use. The web part presents a personalized list of tools to the end-user, and uses a SPList to store the data. This list is quite simple and includes these fields:
Name Type Description Title Text Title of the tool URL Hyperlink URL to the tool Users Person Users who have chosen to view the tool in their personalized list Groups Managed Metadata Which groups of users the link is available to (matched with user profile)
I created a list of all the common used web templates in SharePoint 2013 with a screenshot showing how the site looks out-of-the-box primary to have for my own reference, but thought it might be interesting for other to access to so I posted this as an article.
This is the web templates available when creating new site collections through Central Admin with SharePoint 2013 Enterprise SP1. As many know there are lots of more templates, but these are the ones common available, and I recommend to stick to these when building solutions.
For some reason a deleted task was still visible in the aggregated task list for a end-user. The task itself had been deleted from the source site, so when you clicked the task you got an error message telling you it did not exist anymore. The problem was that SharePoint was unable to remove the task from the aggregated view, so now we had to deal with a ghost task!
For some reason I have never until now needed to add web parts to a page from the gallery using code. Why would I ever do this? The code runs inside a Feature Receiver, and is executed when creating new sites. The web part had been extended from a standard Content by Query Web Part (CBWP) with no code, and for that reason it was not possible to reference a unique class.
In SharePoint 2013 you can now as a end-user choose to follow sites to both subscribe to their newsfeed, but also to maintain a list of favorites under "Sites" in your MySite. From the administrator point of view, there are no features to push these sites to your users, but with the API's available, this doesn't require much effort to achieve.
Case A user story described that one site in the solution was mandatory to follow since all important company news should be published here.
The "Newsfeed" found on MySite, is a web part with the same name, and can easily be added to other sites if you enable a hidden feature. From what I can tell, this work fine, but not perfect.
The reason I don't feel this is a perfect good solution is due to a bug within the web part. The bug is a bit hidden if you haven't tested all the features within the the feed.
During a content database migration from SharePoint 2010 to 2013, we also had a requirement to move a few sites (SPWeb) to new locations. The plan was to first mount the Content Database on the SharePoint 2013 farm, create an evaluation upgrade site collection and then export the content from the upgraded site using "Export-SPWeb". This operation failed, and after several retries it seems like this is not supported.
PowerShell command to export site:
A common part of a migration from SharePoint 2010 to 2013, is to include the MySite user profile and personal site collections. Both the User Profile and Managed Metadata service applications must be migrated first. After the web application has been created, and the content database(s) has been reattached, the MySite host must be upgraded to 2013. This can easily be done either from the web page or with PowerShell. All customization to the branding will be lost as the Master Page is reverted to "
When migrating SharePoint from 2010 to 2013, it depend of the migration strategy you choose how the end result will appear for your end users. Two different approaches when migrating to SharePoint 2013 can be:
Migrate the farm, content and solutions from 2010 to 2013 Migrate the farm to 2013, but keep the content and solutions in 2010-mode Selecting the last approach requires the least effort, and could be preferred for several reasons:
As a SharePoint developer, I am quite often required to set up new servers for development and testing. Every time I set up a new server, I do a basic configuration before I start installing the specific software I need (SQL Server, SharePoint, Visual Studio etc.). The purpose of doing these preparations is to enable a more desktop like user experience, and remove unnecessary interruptions in the day-to-day usage.
This guide is based on a Windows Server 2012 Standard GUI installation.
The workflow service in SharePoint 2013 Preview is no longer a part of the standard SharePoint server installation, and is provided by the Windows Workflow Manager (Azure). The service it self is a huge improvement to the product, but requires additional step as it has to be installed and configured post-installation of SharePoint Server 2013.
Getting the workflow service in SharePoint 2013 Preview up and running on my development environment gave me some challenges that wasn't well documented at the time, so I decided to list some of the error messages and steps that helped me getting it up and running properly.
In my work with development of SharePoint solutions, I heavily rely on virtualized environments on my own laptop computer. Working inside virtualized environments complicates the configuration of your own infrastructure, and to get and acceptable user experience inside the virtual machines a working internet connection is a requirement.
Earlier Hyper-V was only supported on the server OS, but from Windows 8 this has also been added to the client OS as well.
Profile pictures can either be stored in Active Directory or in SharePoint. The main reason for placing the profile pictures in SharePoint is for easier management, self-service and maintaining high quality images. Storing the pictures directory in Active Directory gives some restrictions on both physical file size and pixels.
Set up delegation in Active Directory Select "Delegate Control" on the top level in Active Directory. Locate the system account performing the synchronization.
Are Flyen is a developer and solution architect located in Norway. He works with Microsoft 365, Power Platform and Azure as a Chief Consultant at Tietoevry.
About this blog The main purpose of this blog will be to share knowledge from my day-to-day professional experience, and hopefully be helping others with my contributions. Please make a short comment if you find the information helpful!
Terms and conditions I support “sharing is caring”, but please do not copy and republish the content of this blog.