Skip to content

Instantly share code, notes, and snippets.

@Na0mir
Na0mir / SP.IsCurrentUserMemberOfGroup.Example.js
Created February 2, 2016 14:44 — forked from vgrem/SP.IsCurrentUserMemberOfGroup.Example.js
Determine if current user is a member of Group via CSOM(JavaScript) in SharePoint 2010/2013
//Usage
function IsCurrentUserWithContributePerms()
{
IsCurrentUserMemberOfGroup("Members", function (isCurrentUserInGroup) {
if(isCurrentUserInGroup)
{
// The current user is in the [Members] group
}
});
@Na0mir
Na0mir / JSLinkRenderPercentage.js
Last active February 2, 2016 11:32
Display status % as a Progress bar
// List view, display, add and edit – Percent Complete Sample
// Muawiyah Shannak , @MuShannak
(function () {
// Create object that have the context information about the field that we want to change it's output render
var percentCompleteFiledContext = {};
percentCompleteFiledContext.Templates = {};
percentCompleteFiledContext.Templates.Fields = {
// Apply the new rendering for Status % field on List View and Display forms
@Na0mir
Na0mir / EditView.ps1
Last active September 18, 2015 11:02
Edit all views in a single site collection
# ----------------------------------------------
# Author: Romain Blanchard
# Date: 11.08.2015
# Description: Edit all views in a single site collection
# ----------------------------------------------
Add-PSSnapin Microsoft.SharePoint.Powershell
$SiteUrl = "http://mycpdintg.intg2013.dpgp.emea.loreal.intra/sites/ipanel"
$ViewName = "Published Folders"
@Na0mir
Na0mir / AddSampleData.ps1
Last active August 29, 2015 14:21
Add sample data to SharePoint list
# ----------------------------------------------
# Author: Romain Blanchard
# Date: 13.05.2015
# Description: Add sample data to GDoc application
# ----------------------------------------------
param(
[String]$SiteUrl=$(throw 'Parameter -SiteUrl is missing!')
)
@Na0mir
Na0mir / CleanMetadataProperties.ps1
Last active August 29, 2015 14:21
Delete all Managed Metadata Properties from default Search Service application
# ----------------------------------------------
# Author: Romain Blanchard
# Date: 21.05.2015
# Description: Delete all Managed Metadata Properties from default Search Service application
# ----------------------------------------------
$searchapp = Get-SPEnterpriseSearchServiceApplication
$mp = Get-SPEnterpriseSearchMetadataManagedProperty -SearchApplication $searchapp | Where {$_.Name -like "gdoc*"}
$mp | % { Get-SPEnterpriseSearchMetadataMapping -SearchApplication $searchapp -ManagedProperty $_ | Remove-SPEnterpriseSearchMetadataMapping -Confirm:$false }
$mp | Remove-SPEnterpriseSearchMetadataManagedProperty -Confirm:$false
@Na0mir
Na0mir / BingMapIntegration.html
Last active September 25, 2015 15:08
Integrate BingMap into HTML page.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<script type="text/javascript" src="/_layouts/1033/init.js"></script>
<script type="text/javascript" src="/_layouts/MicrosoftAjax.js"></script>
<script type="text/javascript" src="/_layouts/sp.core.js"></script>
<script type="text/javascript" src="/_layouts/sp.runtime.js"></script>
<script type="text/javascript" src="/_layouts/sp.js"></script>
@Na0mir
Na0mir / AddUsersToCommunitySite.ps1
Last active August 29, 2015 14:18
Add SharePoint users to community site (SPWebtemplate). Based on XML input file.
# ----------------------------------------------
# Author: Romain Blanchard
# Date: 02.07.2014
# Description: Add SharePoint users to community site (SPWebtemplate). Based on XML input file.
# ----------------------------------------------
# -- Script -- #
# Foreach Community
Select-Xml -Path "users.xml" -Xpath "/config/community" | ForEach-Object {
@Na0mir
Na0mir / ExportLocalFilesProperty.ps1
Last active August 29, 2015 14:18
Export local file's property to CSV file.
# ----------------------------------------------
# Author: Romain Blanchard
# Date: 22.03.2013
# Description: Export local file's property to CSV file.
# ----------------------------------------------
# -- Options -- #
$LocalPath = "files"
$logfile = "output-filename.csv"
$count = 0
@Na0mir
Na0mir / GetDiskStatus.ps1
Created March 30, 2015 12:33
Get local computer disks status
# ----------------------------------------------
# Author: Romain Blanchard
# Date: 28.06.2012
# Description: Get local computer disks status
# ----------------------------------------------
# -- Script -- #
write-host ""
write-host "---------- Disk status ----------" -ForegroundColor Yellow
@Na0mir
Na0mir / ExportWSPSolutions.ps1
Last active August 29, 2015 14:18
Download all SharePoint wsp solutions from SharePoint farm.
# ----------------------------------------------
# Author: Romain Blanchard
# Date: 10.04.2013
# Description: Download all SharePoint wsp solutions from SharePoint farm.
# ----------------------------------------------
# -- Initialize -- #
Add-PSSnapin Microsoft.SharePoint.PowerShell –erroraction SilentlyContinue
# -- Options -- #