Skip to content

Instantly share code, notes, and snippets.

@hemache
hemache / script.js
Created April 22, 2016 13:07
SharePoint people picker prevent select everyone group
function PreSaveAction() {
try {
var selectedValues = JSON.parse($('[id*="$ClientPeoplePicker_HiddenInput"]').val()),
returnValue = true;
for(i=0; i < selectedValues.length; i++){
var selectedValue = selectedValues[i];
if(selectedValue.IsResolved && (selectedValue.ProviderName == "AllUsers" || selectedValue.Key == "c:0(.s|true")){
returnValue = false;
}
if(!selectedValue.IsResolved && (selectedValue.Key.toLowerCase() == "tout le monde" || selectedValue.Key == "الجميع")){
# variables
$siteUrl = "http://www.example.ma"
$defaultPageFileName = "Home.aspx"
Add-PSSnapin Microsoft.SharePoint.PowerShell -EA SilentlyContinue
$web = GetSPWeb -Identity $siteUrl
if([Microsoft.SharePoint.Publishing.PublishingWeb]::IsPublishingWeb($web)) {
$publishingWeb = [Microsoft.SharePoint.Publishing.PublishingWeb]::GetPublishingWeb($web)
$publishingWeb.DefaultPage = ($publishingWeb.PagesList.Items | Where-Object { $_.File.Name -eq $defaultPageFileName }).File
$publishingWeb.Update()
public override void FeatureActivated(SPFeatureReceiverProperties properties)
{
SPWeb web = properties.Feature.Parent as SPWeb;
web.AllowUnsafeUpdates = true;
try
{
f(Microsoft.SharePoint.Publishing.PublishingWeb.IsPublishingWeb(web))
{
var publishingWeb = Microsoft.SharePoint.Publishing.PublishingWeb.GetPublishingWeb(web);
foreach(SPListItem item in publishingWeb.PagesList.Items)
{
"wine": {
"name": "Canto dei Mori Castellani Chianti Classico Riserva 2010",
"image": "https:\/\/admin.wtso.com\/images\/56c33e5041b93.jpg",
"short_description": "Comprised of 100% Sangiovese from the extraordinary 2010 vintage, this Chianti Classico Riserva offers up intense aromas of red berries, plum, balsamic, herbs, leather, and minerals. Over-delivering on the palate, the wine is full-bodied and velvety, balanced by bright acidity and culminating in a lengthy finish bursting with fruit. Pair it with lamb or rabbit rag\u00f9, mushroom ravioli, or homemade pizzas topped with arugula and prosciutto for a deliciously memorable meal!",
"long_description": "Print \n Canto dei Mori Castellani Chianti Classico Riserva 2010\n\u00a0\n\u00a0\n \n\nBy Canto dei Mori\u00a0\nChianti Classico Riserva 2010\n\u00a0\nTechnical Details\nRegion: Tuscany\u00a0\nAlcohol: 13.00%\u00a0\nGrapes: 100% Sangiovese \u00a0\n\nVinification and Refinement\u00a0\nWe produce this Chianti Classico from selec