Articles about European Sharepoint Hosting Service
Posts tagged Hosting cheap european sharepoint server 2010 hosting

SharePoint 2013 Hosting – HostForLIFE :: How To Use PnP React Accordion Control In SPFx?
Feb 18th
Implementation
- Create a list with Title and Description fields as mentioned above.
- Open a command prompt
- Move to the path where you want to create a project
- Create a project directory using:
1 |
md directory-name |
1 |
cd directory-name |
1 |
yo @microsoft/sharepoint |
1 |
code . |
1 2 |
npm install @pnp/sp --save npm install @pnp/spfx-controls-react --save --save-exact |
1 2 3 4 5 6 7 |
import { WebPartContext } from "@microsoft/sp-webpart-base"; export interface IPnpReactAccordionProps { description: string; listName: string; context: WebPartContext; } |
Create a file I{webpartname}State.ts inside src > webparts > webpart > components and create state interface as below,
1 2 3 4 5 6 7 8 9 10 |
interface IListItem { Id?: string; Title: string; Description: string } export interface IPnpReactAccordionState { listItems: IListItem[]; errorMessage: string; } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
import { WebPartContext } from "@microsoft/sp-webpart-base"; import { sp } from '@pnp/sp/presets/all'; export class SPService { constructor(private context: WebPartContext) { sp.setup({ spfxContext: this.context }); } public async getListItems(listName: string) { try { let listItems: any[] = await sp.web.lists.getByTitle(listName) .items .select("Id,Title,Description") .get(); return listItems; } catch (err) { Promise.reject(err); } } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
import * as React from 'react'; import * as ReactDom from 'react-dom'; import { Version } from '@microsoft/sp-core-library'; import { IPropertyPaneConfiguration, PropertyPaneTextField } from '@microsoft/sp-property-pane'; import { BaseClientSideWebPart } from '@microsoft/sp-webpart-base'; import * as strings from 'PnpReactAccordionWebPartStrings'; import PnpReactAccordion from './components/PnpReactAccordion'; import { IPnpReactAccordionProps } from './components/IPnpReactAccordionProps'; export interface IPnpReactAccordionWebPartProps { description: string; listName: string; } export default class PnpReactAccordionWebPart extends BaseClientSideWebPart<IPnpReactAccordionWebPartProps> { public render(): void { const element: React.ReactElement<IPnpReactAccordionProps> = React.createElement( PnpReactAccordion, { description: this.properties.description, listName: this.properties.listName, context: this.context } ); ReactDom.render(element, this.domElement); } protected onDispose(): void { ReactDom.unmountComponentAtNode(this.domElement); } protected get dataVersion(): Version { return Version.parse('1.0'); } protected getPropertyPaneConfiguration(): IPropertyPaneConfiguration { return { pages: [ { header: { description: strings.PropertyPaneDescription }, groups: [ { groupName: strings.BasicGroupName, groupFields: [ PropertyPaneTextField('description', { label: strings.DescriptionFieldLabel }), PropertyPaneTextField('listName', { label: strings.ListNameFieldLabel }) ] } ] } ] }; } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
import * as React from 'react'; import styles from './PnpReactAccordion.module.scss'; import { IPnpReactAccordionProps } from './IPnpReactAccordionProps'; import { IPnpReactAccordionState } from './IPnpReactAccordionState'; import { escape } from '@microsoft/sp-lodash-subset'; import { SPService } from '../../../Service/SPService'; import { Accordion } from "@pnp/spfx-controls-react/lib/Accordion"; export default class PnpReactAccordion extends React.Component<IPnpReactAccordionProps, IPnpReactAccordionState> { private _services: SPService = null; constructor(props: IPnpReactAccordionProps) { super(props); this.state = { listItems: [], errorMessage: '' } /** Bind service using current context */ this._services = new SPService(this.props.context); } public componentDidMount() { this.getListItems(); } /** Get items of selected list and set values in state */ private async getListItems() { if (this.props.listName) { let items = await this._services.getListItems(this.props.listName); this.setState({ listItems: items }); } else { this.setState({ errorMessage: 'Please enter the list name in property pane configuration.' }); } } public render(): React.ReactElement<IPnpReactAccordionProps> { return ( <div className={styles.pnpReactAccordion}> { //Map list items and render in accordion (this.state.listItems && this.state.listItems.length) ? this.state.listItems.map((item, index) => ( <Accordion title={item.Title} defaultCollapsed={true} className={"itemCell"} key={index}> <div className={"itemContent"}> <div className={"itemResponse"} dangerouslySetInnerHTML={{ __html: item.Description }}></div> </div> </Accordion> )) : <p>{this.state.errorMessage}</p> } </div> ); } } |
1 |
gulp serve |

SharePoint 2013 Hosting – HostForLIFE :: Managing Site Storage In SharePoint Online
Feb 11th
Overview
Site Storage in SharePoint Online
Site storage configuration
- Automatic
The default. All sites get the storage from a central pool. The global or SharePoint administrator does not have to manage the storage per site. It is handled automatically by SharePoint for them. - Manual
The global or SharePoint administrator can have a fined tuned site storage allocated for each of the SharePoint site collection.
Manage site storage for individual sites
- Navigate to the site settings page.
- Under Site Collection Administration, click Storage Metrics.
PowerShell support
- Set-SPOSite -Identity https://contoso.sharepoint.com -StorageQuota 1500 -StorageQuotaWarningLevel 1400
Summary
SharePoint 2013 Hosting – HostForLIFE.eu :: Send Email Using PowerShell
Jul 5th

Use Cases
A few use cases where this capability is instrumental are,
- Send email to target audience at the end of a script, with the result files as attachments
- Send email as a part of monitoring scripts. For instance, a PS script sending out mailers when a SharePoint subsite exceeds a size limit set by administrator
- Send email to administrator when a .NET site is not used frequently, based on site visits thresholds set by administrators
The Script
1 |
$runDateTime = Get-Date $smtp = "mailservice.redduck.com" $to = "customer1@redduck.com" $cc = "customer2@redduck.com" $from = "guardbot@redduck.com" $subject = "Script Run Completed - $runDateTime" $attachmentLocation = "C:\Users\Jarvis\Desktop\TestFile.txt" $body = "Hello Team, <br><br>" $body += "The program <b>Fantastic Powershell Program</b> has been completed successfully at <i>$runDateTime.</i><br><br>" $body += "Have a great day!<br><br>" $body += "Thank you" Send-MailMessage -SmtpServer $smtp -To $to -Cc $cc -From $from -Subject $subject -Body $body -BodyAsHtml -Attachments $attachmentLocation Write-Host "====== Email sent! ======" |
Explanation
Parameters | Type | Description/Remarks |
-To | String | The recipient of the email. For multiple recipients separate them as individual strings. For example – “user1@demo.com”, “user2@demo.com” |
-From | String | The sender of the email |
-Cc | String | The recipient who will be copied in the email |
-Bcc | String | The recipient who will be copied but not listed in the email |
-Subject | String | The subject line of the email body |
-Body | String | The email body of the message.Multiple lines including variables can also be appended. HTML elements and stylings (bold, italics, etc.) can also be included as shown in the script above. |
-Attachments | String | The path of the attachment fileIt is worth noting that, for attachments that exceed the limits set by the email service provider, it might fail. Hence, it is recommended to exercise caution for before attaching files in emails. For larger attachments, shared locations can be used. |
-SmtpServer | String | The SMPT server that is responsible for establishing communication. This is very vital. |
-BodyAsHtml | String | This parameter specifies that the email body contains HTML and will be rendered as per HTML standards. |
Illustration
Modify the parameters and variables as per your requirements, execute the program, and that’s it!
The email will be delivered to your recipients!

SharePoint 2013 Hosting – HostForLIFE.eu :: Update Taxonomy Or Managed Metadata Field Via SharePoint JSOM
Jun 27th
1 |
function CreateItem(isSingleValue){ SP.SOD.executeOrDelayUntilScriptLoaded(function () { 'use strict'; var context = new SP.ClientContext(_spPageContextInfo.siteAbsoluteUrl); var list = context.get_web().get_lists().getByTitle('CustomList'); var itemCreateInfo = new SP.ListItemCreationInformation(); var item = list.addItem(itemCreateInfo); var field = list.get_fields().getByInternalNameOrTitle("MyMMDField"); var taxField = context.castTo(field, SP.Taxonomy.TaxonomyField); if(isSingleValue == true){ // this you have to handle manually , use var termValue = new SP.Taxonomy.TaxonomyFieldValue(); termValue.set_label("MyWikiTerm"); termValue.set_termGuid("fb58bc5e-5ce5-41fc-9a90-7431018aa935"); termValue.set_wssId(-1); taxField.setFieldValueByValue(item, termValue); item.set_item("Title", "Created New Item and Set single valued Taxonomy"); } else { // this you have to handle manually item.set_item("Title", "Created New Item and Multi valued Taxonomy"); var pairs = "-1;#MyWikiTerm|fb58bc5e-5ce5-41fc-9a90-7431018aa935;#-1;#MyWikiTerm2|1cee8427-41f1-4a2b-aff3-26c67685988e"; var termValueCollection = new SP.Taxonomy.TaxonomyFieldValueCollection(context,pairs,taxField); taxField.setFieldValueByValueCollection(item, termValueCollection); } item.update(); context.load(item); context.executeQueryAsync( function () { console.log('Item created sucessfully: ' + item.get_id()); }, function (sender, args) { console.log("exception in addItem"); }); }, 'SP.Taxonomy.js'); } |
Let us quickly test this via Chrome Developer Console.
1 |
function UpdateItem(ItemId,isSingleValue){ SP.SOD.executeOrDelayUntilScriptLoaded(function () { 'use strict'; var context = new SP.ClientContext(_spPageContextInfo.siteAbsoluteUrl); var list = context.get_web().get_lists().getByTitle('CustomList'); var item = list.getItemById(ItemId); var field = list.get_fields().getByInternalNameOrTitle("MyMMDField"); var taxField = context.castTo(field, SP.Taxonomy.TaxonomyField); if(isSingleValue == true){ // this you have to handle manually , use var termValue = new SP.Taxonomy.TaxonomyFieldValue(); termValue.set_label("MyWikiTerm"); termValue.set_termGuid("fb58bc5e-5ce5-41fc-9a90-7431018aa935"); termValue.set_wssId(-1); taxField.setFieldValueByValue(item, termValue); item.set_item("Title", "Updated item and Set single valued Taxonomy"); } else { // this you have to handle manually item.set_item("Title", "Updated Item and Multi valued Taxonomy"); var pairs = "-1;#MyWikiTerm|fb58bc5e-5ce5-41fc-9a90-7431018aa935;#-1;#MyWikiTerm2|1cee8427-41f1-4a2b-aff3-26c67685988e"; var termValueCollection = new SP.Taxonomy.TaxonomyFieldValueCollection(context,pairs,taxField); taxField.setFieldValueByValueCollection(item, termValueCollection); } item.update(); context.load(item); context.executeQueryAsync( function () { console.log('Item updated sucessfully: ' + item.get_id()); }, function (sender, args) { console.log("exception in updating item"); }); }, 'SP.Taxonomy.js'); } |
Use the same Chrome Developer Console technique to quickly test this function. Type ”UpdateItem(8,false)”. Please note that we are updating the same item created using CreateItem method.



Remote PowerShell Execution For SharePoint On-Premises
Jun 20th

Why do we need this remote execution of PowerShell script?
- Managing multiple servers and running a command on every server individually is time-consuming.
- Centralized server (one server) to run a script on all remote servers gives more control over process.
- Prevents uneccessary access to all servers.
- Tighter and secure environment.
- Single script to run on one machine and updating multiple servers at once.
Use case
Setup Remote Server

1 |
Enable-PSRemoting |
1 |
Enable-WSmanCredSSP -Role Server |
1 |
winrm set winrm/config/winrs ‘@{MaxShellsPerUser=”25″}’ winrm set winrm/config/winrs ‘@{MaxMemoryPerShellMB=”600″}’ |
- Firewall rule must be enabled to allow communication with the server.
- Ensure the user has permission to SharePoint content database.
Setup Up Client machine
1 |
Enable-PSRemoting |
1 |
Enable-WSmanCredSSP -Role "Client" -DelegateComputer "server2.contoso.com" -Force |
1 |
$password = ConvertTo-SecureString "your password" -AsPlainText -Force $cred = New-Object System.Management.Automation.PSCredential("username",$password) |
Enable SSP and Get Session object to enter to remote server.
1 |
$s=new-PSsession -ComputerName serverA -authentication credssp -credential $cred |
1 |
Invoke-Command -Session $s -ScriptBlock {Add-PSSnapin Microsoft.SharePoint.PowerShell;Update-SPSolution -Identity yourfile.wsp -LiteralPath "C:\Program Files (x86)\(location of your file)...\yourfile.wsp" -GacDeployment} |
1 |
Enter-PSSession -session $s |
On successfully running this, it will run all the invoke commands on the remote server. Go to the server and check if WSP is updated.
Summary

SharePoint 2013 Hosting – HostForLIFE.eu :: SharePoint Column Formatting: Display A Single line Of Text As Hyperlink
Jun 13th
- Using SPFx extension Field customizer
- Using Column Formatting option
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
{ "$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json", "elmType": "div", "children": [ { "elmType": "a", "style": { "padding-right": "8px" }, "txtContent": "@currentField", "attributes": { "target": "_blank", "href": { "operator": "+", "operands": [ "mailto:", "@currentField", "?subject=Wonder women here&body=Hey ", "[$Title]", "\nJust checking, if you have saved the world?.\r\n---\r\n", "\r\nClick this link for more info. http://contoso.sharepoint.com/sites/ConferencePrep/Tasks/Prep/DispForm.aspx?ID=", "[$ID]" ] } } }, { "elmType": "a", "attributes": { "target":"_blank", "iconName": "Mail", "class": "sp-field-quickActions", "href": { "operator": "+", "operands": [ "mailto:", "@currentField", "?subject=Wonder women here&body=Hey ", "[$Title]", "\nJust checking, if you have saved the world?\r\n---\r\n", "\r\nClick this link for more info. http://contoso.sharepoint.com/sites/ConferencePrep/Tasks/Prep/DispForm.aspx?ID=", "[$ID]" ] } } } ] } |

Click Ok and go back to view and refresh the page, you should see the below.
- The first – “elmType”: “div” – Here we are saying that we need the element to be rendered as div
- Now within this div, we will create 2 children of type anchor tag (one for email and one for icon) – yes, this could have been done in a single anchor tag but I wanted to understand how it works so I kept 2 childrens both childrens “elmType”: “a” is anchor(a is html tag)
- For the first one we are having attribute “txtContent”: “@currentField” – This tells it to render text inside anchor tag as value of current field.
- Then we have ‘attributes’ – it is Json because we are setting different attributes like target and href.
- Within href we are using again using json object as we need to concate some values, hence ‘operator’ is ‘+’ and operands are array of values with static text and dynamic values(from other columns in list item).
- Values within array are separated by comma, a typical javascript array.
- As explained before some of fields like $Title, $ID are being used to create href link.
- href could have been built by simply using ‘+’ operator like below,