Skip to content

Instantly share code, notes, and snippets.

View arjancornelissen's full-sized avatar

Arjan Cornelissen arjancornelissen

View GitHub Profile
@arjancornelissen
arjancornelissen / ForceRenewalOfCT.ps1
Last active January 3, 2016 20:55
Blog Force renewal of Content Types
param
(
[Parameter(Mandatory=$true)]
[string]$siteurl,
[Parameter(Mandatory=$false)]
[bool]$OnlyThisSite
)
Function RemoveAllTimeStamps([Microsoft.SharePoint.SPSite] $site)
<#
.SYNOPSIS
This script can download slides, mp3, mp4 and high quality mp4 files from a Channel 9 RSS feed
Enter the feed like http://channel9.msdn.com/Events/SharePoint-Conference/2014.
This url can be found at the events homepage
.DESCRIPTION
The script itself will only print 'Hello World'. But that's cool. It's main objective is to show off the cool help thingy anyway.
@arjancornelissen
arjancornelissen / Add-SPTitle.ps1
Created January 3, 2016 21:00
Blog Change the default title within SharePoint
Add-PSSnapin Microsoft.SharePoint.PowerShell
$app = Get-SPWebApplication -Identity <webapplicationurl>
$markup = @"
<div id='javascript-breadcrumb' class='ms-core-brandingText'></div>
<script>
this.elm = document.getElementById('javascript-breadcrumb');
this.elm.innerHTML = _spPageContextInfo.webTitle;
</script>
@arjancornelissen
arjancornelissen / spDialog.html
Created January 3, 2016 21:13
Blog SharePoint page as Dialog
<script type="text/javascript">
//Below method will Open the page in Popup
function OpenPopup(PageUrl) {
var options = SP.UI.$create_DialogOptions();
options.title = "Services";
// Setting the URL of the page to be opened in Popup
options.url = PageUrl;
// Setting Height and Width of the Popup
options.width = 750;
@arjancornelissen
arjancornelissen / csrBasics.js
Last active January 3, 2016 21:30
Blog CSR basics
Type.registerNamespace('Arjan');
Arjan.Demo = Arjan.Demo || {};
Arjan.Demo.Templates = Arjan.Demo.Templates || {};
Arjan.Demo.Functions = Arjan.Demo.Functions || {};
Arjan.Demo.Templates.Header = function (context) {
return"";
}
Arjan.Demo.Templates.Footer = function (context) {
@arjancornelissen
arjancornelissen / csrItem.js
Created January 3, 2016 21:31
Blog CSR Item
Arjan.Demo.Templates.Item = function (context) {
var html = "<div faq='" + context.CurrentItem.Category + "' class='faqheader faqclose'>" + context.CurrentItem.Title;
html += "<div class='faqitem faqclose'>";
html += context.CurrentItem.Answer;
html += "</div>"
html += "</div>"
return html
}
@arjancornelissen
arjancornelissen / csrGroup.js
Last active January 3, 2016 21:32
Blog CSR Group
Arjan.Demo.Templates.Group = function (context, group, groupId, listItem, listSchema, level, expand) {
html = '<div level="' + groupId + level + '" group="' + group + '" groupvalue="' + listItem[group] + '" class="faqlevel">' + listItem[group] + ' : </div>';
}
@arjancornelissen
arjancornelissen / csrHeaderFooter.js
Last active January 3, 2016 21:32
Blog CSR Header and Footer
Arjan.Demo.Templates.Header = function (context) {
return"<strong>The FAQ list</strong><div view='" + context.view + "'>";
}
Arjan.Demo.Templates.Footer = function (context) {
return"</div>";
}
@arjancornelissen
arjancornelissen / CustomRetention.xml
Created January 3, 2016 21:58
Blog CustomRetentionPolicy XML
<PolicyResource xmlns='urn:schemas-microsoft-com:office:server:policy' id='Test-Policy-Resource' featureId='Microsoft.Office.RecordsManagement.PolicyFeatures.Expiration' type='DateCalculator'>
<Name>Test-Policy-Resource</Name>
<Description>A custom policy that calculates the expiration date based at the status field</Description>
<AssemblyName>$assembly</AssemblyName>
<ClassName>$class</ClassName>
</PolicyResource>
@arjancornelissen
arjancornelissen / Add-Policy.ps1
Created January 3, 2016 22:00
Blog CustomRetentionPolicy PowerShell
$MicrosoftOfficePolicy = [System.Reflection.Assembly]::Load("Microsoft.Office.Policy, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c")
[Microsoft.Office.RecordsManagement.InformationPolicy.PolicyResource]::ValidateManifest($policyResource)
#try to delete
try
{
[Microsoft.Office.RecordsManagement.InformationPolicy.PolicyResourceCollection]::Delete("Test-Policy-Resource")
}
catch{}
[Microsoft.Office.RecordsManagement.InformationPolicy.PolicyResourceCollection]::Add($policyResource)