Article archive

Set react state dynamically in typescript

09/10/2020 21:15
Set react state dynamically in typescript   1. define interface for state and state keys 2. use dynSetState method in handleChange handler   export interface IMasterFormState {     currentStep: number;     email?: string | null | undefined;  ...

Run powershell script in react on build action in package.json

09/10/2020 12:45
Here is an example which creates copy of index.html file from build folder (created by npm run build from index.html in public folder) and replaces server paths to enable open file in browser from file system. After running npm run build, postbuild action is called, our powershell is executed...

Set content type field order programmaticaly

07/11/2019 14:11
Method reorder is used. Following method covers the scenario, when we already have content type, we are adding fields later and need them to put in specific position, because they would be at the end of edit form.   internal static void SetFieldPositionInContentType(SPContentType ct, string...

Add additional lookup to SharePoint field programmatically

07/11/2019 14:07
Primary field is the existing lookup field in list. It shows value from target field, but if we want to display another field, we can use dependent or additional lookup field. Here is a method to add it. Primary field is lookup field.   public static SPFieldLookup...

Remove HTML entities from text

17/10/2019 12:33
Sometimes we get text from user with html formatting (e. g. when text was copy pasted). Following method shoud remove this formatting using System; using System.Text.RegularExpressions; using System.Web;   public static string CleanFromHtml(string input) { var tagsRemoved =...

Set field value in New form via JSLink

16/10/2019 11:03
We needed to prefill text field value (InstanceIdField) in SharePoint new form based on query string parameter in new form url. If query string is not there, use default new form behavior (without prefilling value) In script below, when only new value is returned, it's not saved, so we get original...

Set application page as welcome page programmatically

02/08/2019 10:25
By design, setting application page as welcome page is not possible, you can only choose page inside the web. Code below does following steps   1. Creates standard page (web part page) in Site Pages list on web 2. Adds Script Editor web part to the page 3. Adds javascript to Script Editor...

Get Timer Job history by Powershell

02/10/2018 11:00
Add-PSSnapin Microsoft.sharepoint.powershell   $TimerJobName = "Immediate Alerts" $webApplicationUrl = "https://mywebappurl/";   #custom date range #$StartTime = "09/26/2015 01:00:00 AM"  # mm/dd/yyyy hh:mm:ss #$EndTime = "09/26/2015 01:30:00...

Convert .cer file to .pfx

22/05/2018 12:12
There is cool article on https://blog.jayway.com/2014/09/03/creating-self-signed-certificates-with-makecert-exe-for-development/ how to make self signed certificate using makecert and pvk2pfx commands. But for access pvk2pxf you will need to instal Windows Driver Kit or some extensions...

SharePoint DateTimeControl validation

26/04/2018 12:12
In case of SharePoint:DateTimeControl validation there is special string needed for assign to ControlToValidate attribute: controlID$controlIDDate   <tr>                 <td class="formlabel">Absolvoval dňa *</td>    ...
Items: 1 - 10 of 384
1 | 2 | 3 | 4 | 5 >>