Skip to content

Instantly share code, notes, and snippets.

@VenkateshKadiri66
VenkateshKadiri66 / CreateLargeList.ps1
Created December 18, 2017 09:39
Creates a large list
#Add SharePoint PowerShell Snapin which adds SharePoint specific cmdlets
Add-PSSnapin Microsoft.SharePoint.PowerShell -EA SilentlyContinue
# Script settings
$webUrl = "http://weburl"
$listName = "Large List"
$numberOfItemsToCreate = 6000
$itemNamePrefix = "SWIFT "
# Open web and library
$cert = New-Object System.Security.Cryptography.x509Certificates.x509Certificate2 ("E:\Kadiri\ADFS_TokenSigning.cer")
### Create SP Trusted Root Authority ###
New-SPTrustedRootAuthority -Name "Token Signing Cert" -Certificate $cert
### Claim Mappings #####
$upnClaimMap = New-SPClaimTypeMapping -IncomingClaimType "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn" -IncomingClaimTypeDisplayName "UPN" -SameAsIncoming
$cnNameMap = New-SPClaimTypeMapping -IncomingClaimType "http://schemas.xmlsoap.org/claims/CommonName" -IncomingClaimTypeDisplayName "Display Name" -SameAsIncoming
#################################################################################################################################
# SharePoint Trusted Identity Token Issuer Realm Configuration for Web Applications #
# #
# Usage - This script is used to add/remove a realm and url to or from an existing Trusted Identity Token Issuer #
# #
# Parameters #
# $Realm - This is the realm name given by or agreed by the ping team for this connection. #
# SP team will decide what the realm should be #
# $Identity - This is the name given to the base trusted identity Token Issuer, which is shown #
# under claims providers in SP. #
<Where>
<Or>
<Eq>
<FieldRef ID=’Assigned To’ />
<Value Type=’Integer’><UserID/></Value>
</Eq>
<Membership Type=’CurrentUserGroups’>
<FieldRef Name=’AssignedTo’ />
</Membership>”;
</Or>
@VenkateshKadiri66
VenkateshKadiri66 / UpdateSiteColumn_and_Propagate_changes.ps1
Created October 13, 2017 10:58
Updates the site column and propagates the changes to lists.
Update Site Column
=======================
$site = Get-SPSite -Identity "site url"
$web = $site.RootWeb
$field = $web.Fields["Field Display Name"] #Display name of the field, Internal name didn't work for me. Don'tthe reason
$field.Title = "New Value" #new display name
$field.Update($true)
@VenkateshKadiri66
VenkateshKadiri66 / Update_CType_and_Propagate_changes.ps1
Last active October 13, 2017 10:54
Column(Field) references in Content Types are not updated when site columns are updated. CType needs to be updated speparatley and optionally change should be propagated to the lists. Check this link http://paulryan.com.au/2013/ct-field-props/ to know why CTypes are not updatd when site columns are updated.
$Web= Get-SPWeb "root web url"
$pageCT = $web.ContentTypes["CType name"]
$field = $pageCT.FieldLinks["Column"]
$field.Title = "New Display Name"
$pageCT.Update($true)