Skip to content

Instantly share code, notes, and snippets.

View estruyf's full-sized avatar
:octocat:
Front Matter CMS

Elio Struyf estruyf

:octocat:
Front Matter CMS
View GitHub Profile
cls
Write-Host "Loading SharePoint Commandlets"
Add-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue
Write-Host -ForegroundColor Green " Commandlets Loaded ..."
Write-Host
## Global Functions
function Get-ScriptDirectory {
$Invocation = (Get-Variable MyInvocation -Scope 1).Value
Split-Path $Invocation.MyCommand.Path
$site = Get-SPSite -Identity "http://YourSiteCollectionUrl"
try {
$site | Get-SPWeb -limit all | ForEach-Object {
$_.CustomMasterUrl = $site.RootWeb.CustomMasterUrl
$_.AllProperties["__InheritsCustomMasterUrl"] = "True"
$_.MasterUrl = $site.RootWeb.MasterUrl
$_.AllProperties["__InheritsMasterUrl"] = "True"
$_.AlternateCssUrl = $site.RootWeb.AlternateCssUrl
$_.AllProperties["__InheritsAlternateCssUrl"] = "True"
New-ItemProperty HKLM:\System\CurrentControlSet\Control\Lsa -Name "DisableLoopbackCheck" -Value "1" -PropertyType dword
$site = Get-SPSite -Identity "http://YourSiteCollectionUrl"
# Retrieve used SharePoint groups
$groupsInUse = $site.AllWebs | % {$_.RoleAssignments | Select-Object Member}
$groupsInUse = $groupsInUse | % {$_.member.Tostring()}
$groupsInUse = $groupsInUse | Sort-Object | Get-Unique
$groupsInUse = $groupsInUse | ? {$_ -notmatch '\\' -and !$_.ToString().StartsWith('c:0(.s|') }
# Retrieve all SharePoint groups
$allGroups = $site.RootWeb.SiteGroups | Select-Object name
$farm = Get-SPFarm
$solution = $farm.Solutions.Item("YourSolution.wsp").SolutionFile
$solution.SaveAs("c:\temp\YourSolution.wsp")
@estruyf
estruyf / gist:b7c7603d33c902860e9f
Last active August 29, 2015 14:08
MVC ACS Redirection (OWA and Rich Client)
using System;
using System.Configuration;
using System.Threading.Tasks;
using System.Web.Mvc;
using Microsoft.IdentityModel.Clients.ActiveDirectory;
namespace Demo_DemoFinal_MVC5.Controllers
{
public class HomeController : Controller
{
/* Long Version */
$(".list li").sort(asc_sort).appendTo('.list');
// ascending sort
function asc_sort(a, b){
return ($(b).text().toUpperCase()) < ($(a).text().toUpperCase()) ? 1 : -1;
}
// descending sort
function desc_sort(a, b){
@estruyf
estruyf / Item_Intellisense.html
Created December 3, 2014 08:12
SPSUK Demo Intellisense (item template)
<html xmlns:mso="urn:schemas-microsoft-com:office:office" xmlns:msdt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882">
<head>
<title>Intellisense</title>
<!--[if gte mso 9]><xml>
<mso:CustomDocumentProperties>
<mso:TemplateHidden msdt:dt="string">0</mso:TemplateHidden>
<mso:ManagedPropertyMapping msdt:dt="string">'Link URL'{Link URL}:'Path','Line 1'{Line 1}:'Title','Line 2'{Line 2}:'','FileExtension','SecondaryFileExtension'</mso:ManagedPropertyMapping>
<mso:MasterPageDescription msdt:dt="string">This Item Display Template will show a small thumbnail icon next to a hyperlink of the item title, with an additional line that is available for a custom managed property.</mso:MasterPageDescription>
<mso:ContentTypeId msdt:dt="string">0x0101002039C03B61C64EC4A04F5361F385106603</mso:ContentTypeId>
@estruyf
estruyf / Item_List_Item.html
Created December 3, 2014 08:15
SPSUK Demo Sorting (Item template)
<html xmlns:mso="urn:schemas-microsoft-com:office:office" xmlns:msdt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882">
<head>
<title>List Table Item</title>
<!--[if gte mso 9]><xml>
<mso:CustomDocumentProperties>
<mso:TemplateHidden msdt:dt="string">0</mso:TemplateHidden>
<mso:ManagedPropertyMapping msdt:dt="string">ListID','ListItemID','ContentTypeId','Link URL':'Path','Property 1':'Title','Property 2':'','Property 3':'','Property 4:'','Property 5':'','Property 6':'','Property 7':'','Property 8':'','Property 9':'','Property 10':'','FileExtension','SecondaryFileExtension'</mso:ManagedPropertyMapping>
<mso:MasterPageDescription msdt:dt="string">This is the item row template, use this template in combination with the List Table Control template.</mso:MasterPageDescription>
<mso:ContentTypeId msdt:dt="string">0x0101002039C03B61C64EC4A04F5361F385106603</mso:ContentTypeId>
@estruyf
estruyf / Control_List_Table.html
Created December 3, 2014 08:16
SPSUK Demo Sorting (Control template)
<html xmlns:mso="urn:schemas-microsoft-com:office:office" xmlns:msdt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882">
<head>
<title>List Table Control</title>
<!--[if gte mso 9]><xml>
<mso:CustomDocumentProperties>
<mso:TemplateHidden msdt:dt="string">0</mso:TemplateHidden>
<mso:MasterPageDescription msdt:dt="string">This is the table layout control template.</mso:MasterPageDescription>
<mso:ContentTypeId msdt:dt="string">0x0101002039C03B61C64EC4A04F5361F385106601</mso:ContentTypeId>
<mso:TargetControlType msdt:dt="string">;#Content Web Parts;#</mso:TargetControlType>