Skip to content

Instantly share code, notes, and snippets.

View siata13's full-sized avatar
💭
Keep running

Piotr Siatka siata13

💭
Keep running
View GitHub Profile
{
"colors": [
{
"color": "black",
"category": "hue",
"type": "primary",
"code": {
"rgba": [255,255,255,1],
"hex": "#000"
}
class ColorCode {
[int[]]$rgba;
[string]$hex;
}
class Color {
[string]$color;
[string]$category;
[string]$type;
[ColorCode]$code;
function Get-Colors {
param (
[string]$colorsDataString
)
$colorsJSONData = $colorsDataString | ConvertFrom-Json;
[Colors]$colors = [Colors]::new();
$colors.psobject.properties | ForEach-Object {
if ($colorsJSONData.($_.Name)) {
$colors.($_.Name) = $colorsJSONData.($_.Name)
import { SPHttpClient, SPHttpClientResponse } from "@microsoft/sp-http";
import { IPartialTheme } from "@uifabric/styling/lib";
export interface IThemingOptions {
'@odata.context': string;
hideDefaultThemes: boolean;
themePreviews: IThemePreview[];
}
export interface IThemePreview {
@siata13
siata13 / PnP_MultipleColumns.xml
Last active April 22, 2019 08:36
PnP_MultipleColumns
<?xml version="1.0"?>
<pnp:Provisioning xmlns:pnp="http://schemas.dev.office.com/PnP/2018/05/ProvisioningSchema">
<pnp:Preferences Generator="OfficeDevPnP.Core, Version=2.26.1805.1, Culture=neutral, PublicKeyToken=5e633289e95c321a" />
<pnp:Templates ID="CONTAINER-DEFAULTPAGETEMPLATES">
<pnp:ProvisioningTemplate ID="DEFAULTPAGETEMPLATES" Version="0" Scope="RootSite">
<pnp:ClientSidePages>
<pnp:ClientSidePage Title="{parameter:PageTitle}" PageName="{parameter:PageName}" PromoteAsNewsArticle="false" Overwrite="true" EnableComments="false">
<pnp:Sections>
<pnp:Section Order="1" Type="TwoColumnLeft">
<pnp:Controls>
<%@ Page language="C#" Inherits="Microsoft.SharePoint.WebControls.ClientSidePage, Microsoft.SharePoint, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %><%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<html xmlns:mso="urn:schemas-microsoft-com:office:office" xmlns:msdt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"><head>
<!--[if gte mso 9]><SharePoint:CTFieldRefs runat=server Prefix="mso:" FieldList="PnPTextField,PnPChoiceField,FileLeafRef,ClientSideApplicationId,PageLayoutType,CanvasContent1,BannerImageUrl,BannerImageOffset,PromotedState,FirstPublishedDate,LayoutWebpartsContent,mb5ae19ff37c4effb60b89ff70e494c2,TaxCatchAllLabel"><xml>
<mso:CustomDocumentProperties>
<mso:PageLayoutType msdt:dt="string">Article</mso:PageLayoutType>
<mso:CanvasContent1 msdt:dt="string">&lt;div&gt;&lt;div data-sp-canvascontrol=&quot;&quot; data-sp-canvasdataversion=&quot;1.0&qu
@siata13
siata13 / EnableTaxonomyFeature.ps1
Created May 16, 2019 13:36
Enable taxonomy site feature
Enable-PnPFeature -Identity “73ef14b1-13a9-416b-a9b5-ececa2b0604c” -Scope Site
@siata13
siata13 / TaxonomyPrerequisite.xml
Last active June 24, 2019 10:15
TaxonomyPrerequisite.xml
<?xml version="1.0"?>
<pnp:Provisioning
xmlns:pnp="http://schemas.dev.office.com/PnP/2018/01/ProvisioningSchema">
<pnp:Preferences Generator="OfficeDevPnP.Core, Version=2.20.1711.0, Culture=neutral, PublicKeyToken=3751622786b357c2" />
<pnp:Templates ID="TaxonomyPrerequisite-TEMPLATES">
<pnp:ProvisioningTemplate ID="ValoPrerequisite-v-1.0" Version="1" Scope="RootSite">
<pnp:SiteFields>
<Field Type="LookupMulti" DisplayName="Taxonomy Catch All Column" StaticName="TaxCatchAll" Name="TaxCatchAll" ID="{f3b0adf9-c1a2-4b02-920d-943fba4b3611}" ShowInViewForms="FALSE" List="{parameter:TaxonomyHiddenListId}" WebId="{parameter:WebId}" Required="FALSE" CanToggleHidden="TRUE" ShowField="CatchAllData" SourceID="{484c8c59-755d-4516-b8d2-1621b38262b4}" Mult="TRUE" Sortable="FALSE" AllowDeletion="TRUE" Sealed="TRUE" Hidden="TRUE" />
<Field Type="LookupMulti" DisplayName="Taxonomy Catch All Column1" StaticName="TaxCatchAllLabel" Name="TaxCatchAllLabel" ID="{8f6b6dd8-9357-4019-8172-966fcd502ed2}"
$list = Get-PnPList -Identity "TaxonomyHiddenList";
$web = Get-PnPWeb;
$params = @{ "TaxonomyHiddenListId" = $list.Id; "WebId" = $web.Id }
Apply-PnPProvisioningTemplate -Path $templatePath -Parameters $params
@siata13
siata13 / OrgAssetsService.ts
Created September 10, 2019 05:55
Organisation Assets Service
import { WebPartContext } from "@microsoft/sp-webpart-base";
import { SPHttpClient } from "@microsoft/sp-http";
import { OrgAssetsData, CdnType, OrgAssetType, AddOrgAssetCdnRequest, ResourcePath } from "./OrgAssetsService.types";
import { Guid } from "@microsoft/sp-core-library";
export class OrgAssetsService {
private context: WebPartContext;
constructor(context: WebPartContext) {
this.context = context;