Skip to content

Instantly share code, notes, and snippets.

$.ajax({
async: false,
url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists(guid'listID')/fields?$top=1000",
method: "GET",
headers: {
Accept: "application/json; odata=verbose",
},
success: function (data) {
var colStr = [];
var elements = {};
New-SPSite -ContentDatabase WSS_Content_NewDB -URL https://siteAddress -Template pwa#0 -OwnerAlias domain\username
Enable-SPFeature pwasite -URL https://siteAddress
$(document).ready(function () {
SP.SOD.executeFunc('sp.init.js', 'SP.ScriptHelpers', GetCurrentItemAttachments);
});
function GetCurrentItemAttachments() {
var url = document.location.href;
if (url.toLowerCase().indexOf("dispform.aspx") > -1) {
var attachments = $('#idAttachmentsTable a');
$(this).mask("#.##0,00", {
byPassKeys: [188, 189, 109],
reverse: true,
placeholder: "0,00",
translation: {
'#': {
pattern: /-|\d/,
recursive: true
}
},
@cmd64
cmd64 / sp-change-anonymous-perm-mask.ps1
Last active August 19, 2021 13:28
[Powershell] Anonymous Users cannot open XLSX files from a document library
[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
$siteUrl = "<site collection URL>";
$site = New-Object Microsoft.SharePoint.SPSite($siteurl);
$web = $site.OpenWeb();
$enumPerms = [Microsoft.SharePoint.SPBasePermissions];
Write-Host $web.AnonymousPermMask64;
$web.AnonymousPermMask64 = $enumPerms::ViewListItems -bor $enumPerms::ViewVersions -bor $enumPerms::ViewFormPages -bor $enumPerms::Open -bor $enumPerms::ViewPages -bor $enumPerms::UseClientIntegration -bor $enumPerms::OpenItems
$web.Update();
Write-Host $web.AnonymousPermMask64;
$web.Dispose();
// ==UserScript==
// @name Download Artwork From Apple Music
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Download best resolution artwork from Apple Music!
// @author CM
// @match https://music.apple.com/*
// @require https://code.jquery.com/jquery-3.4.1.min.js
// @grant GM_download
// ==/UserScript==
@cmd64
cmd64 / Get All Sites.ps1
Last active August 19, 2021 13:27
[Powershell] Get all site collections on farm.
Get-SPSite -Limit All | Get-SPWeb -Limit All | Select-Object -Property Title, Url | Format-Table *
#Only Root Webs
Get-SPSite -Limit All | Get-SPWeb -Limit All | Where { $_.IsRootWeb } | Select-Object -Property Title, Url | Format-Table *
@cmd64
cmd64 / YTDecrypt.cs
Last active May 15, 2019 02:09
Youtube Decrypt Chipher
using System;
using System.Net;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace CM.Youtube.Library
{
public class YTDecrypt
{
private static string GetPlayerJS(string videoUrl)
@cmd64
cmd64 / SharePoint Merge Log File
Created April 25, 2019 14:39
SharePoint get log files from all servers
if ((Get-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue) -eq $null)
{
Add-PSSnapin "Microsoft.SharePoint.PowerShell"
}
#Merges the log data for last one hour
Merge-SPLogFile -Path "C:\FarmMergedLog.csv" -Overwrite -Level Critical
#Merges the log data for particular time range, which is culture-specific to windows timezone.
Merge-SPLogFile -Path "C:\FarmMergedLog2.csv" -Overwrite -Level Critical -StartTime "01.04.2019 00:00" -EndTime "25.04.2019 00:00"
@cmd64
cmd64 / Download SP 16 Pre Req Files For Offline.ps1
Last active August 19, 2021 12:54
[Powershell] SharePoint 2016 Download Prerequisite Files For Offline Installer.ps1
Import-Module BitsTransfer
$destPath = "C:\SP16PreReqFiles"
$destPath = $destPath.TrimEnd('\')
function validatePath($destFolder){
## Check that the path entered is valid
If (!(Test-Path $destFolder -Verbose)) {
New-Item -Path $destFolder -ItemType Directory
}