Articles about European Sharepoint Hosting Service
Other Related Post

SharePoint 2013 Hosting – HostForLIFE :: Use Of Image Web Part In SharePoint Online
Mar 2nd
This blog describes the use of the Image Web part in SharePoint Online. It allows us to insert an Image on the page from our device or the web.
Adding Image Web part in SharePoint Online Page
To insert the Image Web part in the Site Page, select Edit on the top right of the page and put the page in edit mode. Click on the + circled icon and select the Image web part. Click on the Image and insert the web part.
After inserting the web part, the following default options for inserting the image will be displayed:
Select the relevant option and insert the image.
Once the image is inserted into the page following editing options will be available,
- Resize
- Crop with a free ratio
- Aspect Ratios
- Alignment
- Save
Caption can also be inserted for the image.
Click on the Edit Web part button on the top which will open the property panel on the right of the page displaying the following options:
- Change – Option to change already inserted image.
- Link – Adds a link to the image. On click of the image, it navigates to the link.
- Add Text over the image – Adds Text over the image similar to the caption. It appears on top of the image.
- Alternative Text.
This is how we can use the Image Web part in SharePoint Online.

SharePoint 2013 Hosting – HostForLIFE :: Getting Site Users Report Using PnP PowerShell
Feb 23rd
Recently, I have been tasked with getting the site user’s report in SharePoint sites in our organization Tenant. There are tools and other ways to get it. Here I have used PnP PowerShell version and the concept of PS Custom Object to achieve this task. In this article, we will see how to get the Site Users report using PnP PowerShell and PS Custom Object.
What is PS Custom Object?
This is a new property introduced in PowerShell 3.0 version and above, which helps in creating structured data, and with this data it makes it easier to
- Query the data
- Import and export the data
- Storing the data while working in a session
The details about PSCustomObject is nicely explained by Kevin in his blog and I would highly recommend checking it.
Pre-Requisites
Before proceeding you need to have the following configurations.
- Access to your organization tenant as SharePoint Admin or Global Admin or access to the sites as Site Collection admin where you want to get the site user’s report
- PnP PowerShell module installed. Please investigate the references section on how to install the PowerShell module.
Steps
Please follow the below steps to get the site user’s report.
Step 1
Connect to the SharePoint site
Step 2
Get the Permission Groups in the SharePoint site.
Step 3
For each user in Group get the required information and write to object. Here I am only getting Email, PrincipalType, Title, LoginName
If you are interested in getting additional properties you can also add them. By default, it gets the following properties, which can be found by querying a member with select * parameter.
Step 4
Export the object data into CSV.
Validation
Below is the input format of the CSV file.
Below is the output CSV after the script run completes.
Below is the complete script

SharePoint 2013 Hosting – HostForLIFE :: Import Excel Data To SharePoint Online Using PowerShell
Feb 3rd
In this article, we will go through the steps required to import the Excel file data to SharePoint online list using PnP PowerShell. There are a lot of ways to import the data, but for this article, we will stick to PowerShell way. Here the credit goes to person Danile Finke who developed the Import Excel PowerShell module and made it available in PowerShell Gallery. Kudos to him.
Step 1
Open the PowerShell with Admin Privileges. Check if the PowerShell module ‘ImportExcel’ is installed. You can check the installed modules from PowerShell by running Get-Module in the PowerShell ISE or PowerShell Command window.
Get-Module
As you observed, in my case the ImportExcel module is installed.
Step 2
Check the availability of the module in PowerShell Gallery. You can do so by entering the below command.
Find-Module
The Find-Module queries the PowerShell Gallery and gets the information from it.
Step 3
Install the module “ImportExcel” by entering the below command in the PowerShell window.
Install-Module -Name ImportExcel -Scope AllUsers
Note: You may be prompted if you trust the repository. Select ‘Yes’.
Step 4
After installing you may have to import-module.
If you are not able to find the module try the import-module command.
Import-Module -Name ImportExcel
Step 6
Now check the Excel Columns by importing the excel data.
$data = Import-Excel -Path “C:\Temp\TestRecords.xlsx”
Here the columns marked in the screenshot above, are present in excel. Create a PS Custom Object accordingly. You can refer to the script section on how to do this.
Step 6
Check if the PnP PowerShell module is installed. If not check the article in the references, on how to install the PnP PowerShell module. If installed, import the module.
Import-Module -Name PnP.PowerShell
Step 7
Declare the following variables with the Site URL and the List Name where the excel data needs to be imported.
$SiteUrl = “https://contoso.sharepoint.com/sites/ContosoDev”
$ListName = “MyTestList”
Step 8
Initiate a connection to SharePoint online using the parameter -interactive
Connect-PnPOnline -url $SiteUrl -interactive
Note – Please note that the account running the script should have Site Collection Administrator rights.
Step 9
Read the excel data using the import-excel command and store it in a variable.
$data = Import-Excel -Path “C:\Temp\TestRecords.xlsx”
Step 10
Read each excel row data, and for each row record, update the SharePoint list using the Add-PnPListItem command.
Step 11
Validate the data in the SharePoint online list.
Complete Script
Conclusion
Thus, in this article, we have seen how to import the excel data to SharePoint online list using PnP PowerShell Module.

SharePoint 2013 Hosting – HostForLIFE :: Automation Of Creating SharePoint Site Using Custom Site Template
Dec 1st
SharePoint Online is being used by many organizations not only for collaboration and document management but it is used for several business activities which involve similar types of custom sites.
Let’s take an example project site. User creates a separate site to manage each of the project where the architecture, configuration, and design of the site are the same. SharePoint provides the ability to create a Site Template using an existing site using PnP PowerShell Script.
I am describing here the steps to create a SharePoint site automatically using the existing site template. In this article, we will be using SharePoint List, Power Automate, Azure Automation, and Azure Runbook.
First create a template file using the existing SharePoint Site using below PowerShell Script
The above script creates a XML file called TemplateFile.xml. Upload this file to a SharePoint Library somewhere so that we can use it each time by PowerShell to create a new site.
Now login to Azure Portal and create an Automation Account.
Once automation account is created, then go to automation account.
First you need to install the module you require to run the PowerShell.
Click the “Modules” under “Shared Resource” from the left panel and click the “Browse Gallery”
Then search the pnp.powershell. This will show the module and select.
When you installed the required modules, go to the Runbook.
You will see a Runbook under Process Automation in the left panel.
Click the runbook and create a new runbook. Provide the name of runbook, select PowerShell as runbook type, runtime version, and description.
Once runbook is created, go to runbook. You will find “Edit” link on top with other links.
Click the edit link. You will find an editor to put your PowerShell Script. Now enter the below PowerShell Script. We will be passing SiteURL as parameter.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
param( [parameter(Mandatory = $true)] [string] $SiteURL = "https://tenant.sharepoint.com/sites/SiteName") $UserName = "username@tenant.onmicrosoft.com" $Password = "xxxxxxxxx" $SecurePassword = ConvertTo - SecureString - String $Password - AsPlainText - Force $Cred = New - Object - TypeName System.Management.Automation.PSCredential - argumentlist $UserName, $SecurePassword #Above line will connect SharePoint Site Connect - PnPOnline - Url "https://tenant.sharepoint.com/sites/NewSiteName" - Credentials $Cred $fileRelativeURL = "/sites/SiteName/shared Documents/TemplateFile.xml" #Download template xml file. $file = Get - PnPFile - Url $fileRelativeURL - AsFile - Path c: \temp - Filename " TemplateFile.xml" # Connect new site where template will be implemented. Connect - PnPOnline - Url $SiteURL - Credentials $Cred #Implement the template. Invoke - PnPSiteTemplate - Path "c:\temp\TemplateFile.xml" - ClearNavigation |
After putting the script, click Save and Publish the runbook.
Now Create a SharePoint List that will contain a list of projects.
Then create a new flow using Power Automate connected to the above list triggered “When an item is created” so that flow trigger as soon as a new item is created in the list. Add next steps in the flow as “Send an HTTP request to SharePoint” and put the details as below:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
Site Address: Your SharePoint site address Method: POST Uri: /_api/SPSiteManager / create Headers: accept - application / json; odata.metadata = none Body: { "request": { "Title": "Site Name returned from list", "Url": "https://tenant.sharepoint.com/sites/SiteName", "Lcid": 1033, "ShareByEmailEnabled": false, "Description": "Description of site", "WebTemplate": "STS#0", "Owner": "owner@tenant.onmicrosoft.com", } } |
Microsoft Power Automate has connector available to connect with a runbook under an automation account. Add an action and select “Azure Automation” connector, then select “Create a job” from the list of actions.
This will require your azure details like subscriptions, resource group, automation account, and runbook. When you select your runbook, it will prompt for parameter defined in the runbook. Pass the parameter and save. This will call the script and pass the parameter to script.
You can add more actions in the flow like updating a list or sending a notification mail etc.
Your flow will look like below.
Now automation is ready.
Please create a new item to the list. It will trigger the flow and create a new site with custom template.
Now automation is ready.
Please create a new item to the list. It will trigger the flow and create a new site with custom template.

SharePoint 2013 Hosting – HostForLIFE :: Enable Session State In SharePoint 2019
Nov 24th
Introduction
While working on SharePoint Server 2019 (on-premise) high-availability setup, client asked to enable session state in the SharePoint production farm, as previously they have faced the issue in high-availability setup via load balancer that whenever any user performs some activity and session is stable for few minutes, the user gets logged out of the application and then user has to login again to access the application, which means user’s session is not persisted.
Description
As you might know that ASP.NET Session state is disabled by default in SharePoint installation, however if you are working with custom solutions, web-parts, third pary tools, etc., persisting the user information per session is very much important and required. So, in this article, I will explain how you can enable session state in SharePoint 2019.
Note
ASP.NET allows persisting session states in below three different ways and it is always a good practice to enable the session state at SQL Server (database) –
- On server memory as an InProc
- On SQL Server to persist session in database (preferred method)
- On Session State Server to persist session on dedicated server memory
Step 1
Enable ASP.NET Session State Service – ASP.NET Session state can be enabled in the SharePoint farm by enabling “SharePoint Server ASP.NET Session State Service” service application on the SharePoint farm. This service application cannot be enabled using SharePoint’s Central Administration interface. This service application can be enabled using below PowerShell command –
Enable-SPSessionStateService –DefaultProvision
By default, this will create service application database with “SessionStateService_<GUID>”, on the database server where SharePoint’s farm configuration database is located and will be provisioned using Windows credentials of the logged in user.
In case you want to create the service application with specific database name, then use the below PowerShell command –
Enable-SPSessionStateService -DatabaseServer <YourDBServerName> -DatabaseName <YourDBName>
Step 2
Check the SharePoint Server ASP.NET Session State Service in Manage Service Applications in SharePoint’s Central Administration –
Step 3
Check if the default service application database is created in the database server
Step 4
The above PowerShell command adds the module in web.config of all the web applications in the farm. Kindly note, that if you have multiple servers in the farm, then module will be added automatically in the web.config file of all the web-front servers, as such you don’t need to add any entry manually in web.config file.
Secondly, a “sessionstate” entry will be created in all the web applications in the farm, as shown in below image
Note
As shown in above image, by default, it would create session for 60 minutes. If you want to increase or decrease session expiration, you can pass “SessionTimeout” parameter while creating ASP.NET Session State Service using Enable-SPSessionStateService command.
Step 5
To ensure that SharePoint web application gets activated to persist ASP.NET sessions, the web.config file needs to be manually updated for the specific SharePoint web application on all web-front servers in the farm. Search for <pages enableSessionState in web.config. By default, its value will be False, you have to make this property as True, as shown in below image
Note
- The web.config path of web application is: C-drive -> inetpub -> wwwroot -> wss -> VirtualDirectories -> WebApplicationPortNumber
- Please take the backup of web.config file before making any manual changes in the web.config file.
I hope by using the information in this article, you will be able to implement session management in SharePoint 2019 farm.
SharePoint 2013 Hosting – HostForLIFE :: External REST API Call from SPFx WebPart with Changeable Properties
Sep 15th
In this article, we will see the steps to create a SPFx web part which calls a third-party anonymous REST API to get data from the API. Some properties like URL and item id will be passed from web part properties to change the data in the web part.
Step 1: Open your React SPFx web part and update the interface IThirdpartyApiCallProps.ts inside your components folder. Update the interface with following 3 properties and import WebPartContext to create property for web part context inside react component.
Step 2: Open web part file ThirdpartyApiCallWebPart.ts and add below 2 properties in interface IThirdpartyApiCallWebPartProps. These properties will be passed to component from the web part.
Step 3: Update render() method to set the properties of react component. Context property of react component is set from web part context. Other 2 properties are set from web part properties.
Step 4: Define 2 new text box properties for property pane of web part in getPropertyPaneConfiguration() method. These 2 properties will be passed to react component properties from web part.
Step 5: Define default value for the 2 new properties in web manifest json file. ThirdpartyApiCallWebPart.manifest.json
Step 6: Create a new .ts file in components folder with name IThirdpartyApiCallState. This interface will have all the values which we fetch from single API record https://jsonplaceholder.typicode.com/users/1. All the properties of API record are stored in react component state which is defined in this interface. We will define all those properties which we want to fetch from API.
Step 6: Now open react component .tsx file ThirdpartyApiCall.tsx and do following:
1. Access state interface IThirdpartyApiCallState in tsx file as state management. Import the interface and add as state in React.Component class constructor.
2. Add construct for react component class ThirdpartyApiCall in tsx file. This constructor will be communicating with properties and state through interfaces. Here were initialing all our state properties to null.
3. Update render() method code to show values of properties received from API.
4. Add componentDidMount() method. This method is called after constructor (with null values) -> render(with printing null values) -> componentDidMount (Invoke API and Set Data Into State). Inside this method we are calling InvokeAPIAndSetDataIntoState. This is getting user details from API using getUserDetails() method and adding to state of react component using setState() method. setState() again calls render method internally and print values received from API. Import HttpClient and HttpClientResponse.
5. When properties of web part changed, values in web part needs to be re-rendered based on the changed values. For this we need to implement componentDidUpdate() method. This method is called when properties of react component are changed. Inside this method we are calling InvokeAPIAndSetDataIntoState() again to get data from API.
Now gulp serve and check your web part with data from external API.
You can change the properties like User ID in property pane.