Article archive

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>    ...

Display attachments in list view

25/04/2018 17:22
here is content of JSLink file, attached directly to field in code behind via JSLink property   This code displays links to attachments directly in list view instead of clip icon and also changes clip column header to another title: Certifikat. Attachments are open in the other...

Set Search Results web part Fetched properties by PowerShell

15/02/2018 12:48
Once we made typo in Core Search Results (SP 2010) web part in Fetched properties xml. This caused error of whole page (not only web part), so page was not editable any more and web part properties couldn't be edited any more via UI. SharePoint Designer also didn't allow to edit this page with web...
Items: 1 - 10 of 382
1 | 2 | 3 | 4 | 5 >>