Skip to content

Instantly share code, notes, and snippets.

View rheid's full-sized avatar

Ralf Heid rheid

View GitHub Profile
@rheid
rheid / spSetCurrentUserField.js
Created March 16, 2015 13:55
SharePoint 2013 Set People Pick Field to CurrentUser (JQuery, SPServices)
(function () {
var ctx = {};
ctx.Templates = {};
ctx.Templates.Fields = {
'Schulungsteilnehmer': {
'NewForm': renderAssignedTo
}
};
SPClientTemplates.TemplateManager.RegisterTemplateOverrides(ctx);
@rheid
rheid / Export-SpSearchManagedProperties.ps1
Created March 14, 2015 12:34
Export SharePoint Managed Properties
#------------------------------------------------------------------------------------------------------
# Name: Export-SpSearchManagedProperties.ps1
# Description: This script will export create Crawled and Managed Properties from Enterprise Search
#
# Usage: Run the function with a required parameters
# By: Ivan Josipovic, Softlanding.ca
#------------------------------------------------------------------------------------------------------
Function Export-SpSearchManagedProperties([string]$SearchServiceApp,[string]$filename){
#Use This to ignore the out of the box managed properties
$IgnoreMappings = @("AboutMe","Account","AccountName","AssignedTo","Author","BaseOfficeLocation","BestBetKeywords","CategoryNavigationUrl","CollapsingStatus","Colleagues","contentclass","ContentsHidden","ContentSource","ContentType","CreatedBy","Department","Description","DisplayDate","DocComments","DocId","DocKeywords","DocSignature","DocSubject","DuplicateHash","EMail",
@rheid
rheid / Import-SpSearchManagedProperties.ps1
Created March 14, 2015 12:33
Import SharePoint Managed Properties
#------------------------------------------------------------------------------------------------------
# Name: Import-SpSearchManagedProperties.ps1
# Description: This script will Import create Crawled and Managed Properties from Enterprise Search
#
# Usage: Run the function with a required parameters
# By: Ivan Josipovic, Softlanding.ca
#------------------------------------------------------------------------------------------------------
Function Import-SpSearchManagedProperties([string]$SearchServiceApplication,[string]$FileName)
[System.Xml.XmlDocument] $xd = new-object System.Xml.XmlDocument
$xd.load(resolve-path($FileName))
@rheid
rheid / spRequestExecutor.js
Created March 12, 2015 14:26
Init SharePoint RequestExecutor
$(document).ready(function () {
var hostweburl;
var appweburl;
//Get the URI decoded URLs.
hostweburl = decodeURIComponent( getQueryStringParameter("SPHostUrl") );
appweburl = decodeURIComponent( getQueryStringParameter("SPAppWebUrl") );
// Load the .js files using jQuery's getScript function.
$.getScript(
@rheid
rheid / csproj.xml
Created March 12, 2015 10:44
TypeScript in Visual Studio For C#-style projects (.csproj):
<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
<TypeScriptTarget>ES5</TypeScriptTarget>
<TypeScriptIncludeComments>true</TypeScriptIncludeComments>
<TypeScriptSourceMap>true</TypeScriptSourceMap>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
<TypeScriptTarget>ES5</TypeScriptTarget>
<TypeScriptIncludeComments>false</TypeScriptIncludeComments>
<TypeScriptSourceMap>false</TypeScriptSourceMap>
</PropertyGroup>
@rheid
rheid / getsmtpServer.ps1
Created March 1, 2015 10:45
Returns SharePoint smtp server
///
/// Returns SharePoint smtp server
///
///
private string GetSmtpServer()
{
SPWebApplicationCollection spWebApplicationCollection = SPWebService.ContentService.WebApplications;
SPOutboundMailServiceInstance smtpServer = new SPOutboundMailServiceInstance();
if (spWebApplicationCollection != null)
@rheid
rheid / setupSMTPServer.ps1
Last active August 29, 2015 14:16
SharePoint Setup Outgoing SMTP Server
############################################################################################################################################
# Script to configure outgoing e-mail in SharePoint
# Required Parameters:
# ->$sSMTPServer: SMTP Server.
# ->$sFromEMail: From Address.
# ->$sReplyEMail: To Address.
# ->$sChartSet: Character Set.
############################################################################################################################################
If ((Get-PSSnapIn -Name Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue) -eq $null )
@rheid
rheid / remove-spsolution.ps1
Created February 24, 2015 11:14
Remove SP-Solution
Removing solution PowerShell cmd:
Remove-SPSolution -Identity solution.wsp -Force
Removing solution stsadm cmd:
stsadm -o deletesolution -name solution.wsp -override
Add Solution PowerShell cmd:
Add-SPSolution D:\solution.wsp
Add Solution stsadm cmd:
stsadm.exe -o addsolution -filename D:\solution.wsp
@rheid
rheid / updateListNoEvents.ps1
Created February 16, 2015 08:48
Update SharePoint List with PowerShell without Events
# open web
$web = Get-SPWeb http://yoursite
# get list
$list = $web.Lists["Your List"]
# get item
$item = $list.GetItemById(1)
# disable event firing
$myAss = [Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint");
$type = $myAss.GetType("Microsoft.SharePoint.SPEventManager");
@rheid
rheid / unpublischoct.ps1
Created February 13, 2015 15:40
SharePoint - Unpublish a published content type if the published content type no longer exists
Add-PSSnapIn Microsoft.SharePoint.PowerShell
if ($args.Count -ne 3)
{
Write-Host "UnpublishContentTypes.ps1 <web url> <content type hub url> <unpublish>"
exit
}
$webUrl = $args[0]
$ctUrl = $args[1]