Skip to content

Instantly share code, notes, and snippets.

Niels Vrolijk Niels-V

Block or report user

Report or block Niels-V

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Niels-V
Niels-V / FileCheck.cs
Last active Oct 29, 2015
PDF Check in a filestream
View FileCheck.cs
using System;
using System.IO;
using System.Text;
namespace Example
{
public class FileCheck
{
/// <summary>
/// Determines whether the specified file stream is a valid PDF.
@Niels-V
Niels-V / CustomUnobtrusiveValidator.cshtml
Last active Sep 3, 2015
Custom jQuery unobtrusive validator to check if either a input is filled or a checkbox is checked.
View CustomUnobtrusiveValidator.cshtml
@{
ViewBag.Title = "Contact";
}
<h2>@ViewBag.Title.</h2>
<h3>@ViewBag.Message</h3>
@using (Html.BeginForm())
{
<input type="hidden" class="include-validation" name="test" data-val="true" data-val-requiredoptout="verplicht veld"
data-val-requiredoptout-optoutfieldselector="#testcheck" data-val-requiredoptout-requiredfieldselector="#test2" />
@Niels-V
Niels-V / AddDependentLookup.cs
Last active Aug 29, 2015
Provision additional lookup fields with CSOM
View AddDependentLookup.cs
private void AddDependantLookup(List parentList, List targetList, Guid lookupFieldId, Field primaryLookupField, string displayName)
{
Field toField = parentList.Fields.GetById(lookupFieldId);
_clientContext.Load(toField);
_clientContext.Load(targetList);
_clientContext.ExecuteQuery();
Field dependantField = targetList.Fields.AddDependentLookup(displayName, primaryLookupField,
toField.StaticName);
FieldLookup dependantFieldLookup = _clientContext.CastTo<FieldLookup>(dependantField);
dependantFieldLookup.LookupField = toField.StaticName;
@Niels-V
Niels-V / UpdateWebPartTitles.cs
Created Feb 19, 2014
Change all webpart titles in a specific SP2010 pages library by CSOM.
View UpdateWebPartTitles.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using Microsoft.SharePoint.Client;
using Microsoft.SharePoint.Client.WebParts;
namespace UpdateWebPartTitles
{
@Niels-V
Niels-V / Execute-Tests.ps1
Last active Dec 31, 2015
Lightweight PowerShell monitoring solution. Write simple test in stand alone test cmdlets, and schedule the test runner with the Task Scheduler to receive a daily email with the test results.
View Execute-Tests.ps1
Import-Module .\Tests\TestModule.psm1
Start-Tests -testContainer C:\Example\Tests
You can’t perform that action at this time.