This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copy and paste this into the Console window in any browser debugging tool to edit the Alternate CSS for a site | |
var context = SP.ClientContext.get_current() | |
var web = context.get_web() | |
web.set_alternateCssUrl('assets/test.css') | |
web.update() | |
context.executeQueryAsync( | |
function(){ | |
alert('CSS Updated') | |
}, | |
function() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copy and paste this into the Console window in any browser debugging tool to show the Alternate CSS for a site | |
var context = SP.ClientContext.get_current() | |
var web = context.get_web() | |
context.load(web) | |
context.executeQueryAsync( | |
function(){ | |
alert('Value is: ' + web.get_alternateCssUrl()) | |
}, | |
function() { | |
alert('Error') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copy the current entry to a new (called No Hyper-V) | |
bcdedit /copy {current} /d "No Hyper-V" | |
# Note the Id from the command result above | |
bcdedit /set <ID> hypervisorlaunchtype off | |
# Set the default one to the newly created entry | |
bcdedit /default /ID <ID> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var context = SP.ClientContext.get_current() | |
var web = context.get_web() | |
var lists = web.get_lists() | |
var list = lists.getByTitle('Test') // Replace with title of list | |
var cols = list.get_fields() | |
var col = cols.getByInternalNameOrTitle('XYZ') // replace with title or internal name of column | |
col.deleteObject() | |
context.executeQueryAsync( | |
function(){ | |
alert('Done') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Modify the lines with TODO comments below | |
Type.registerNamespace('Wictor') | |
Wictor.Demos = Wictor.Demos || {}; | |
Wictor.Demos.Functions = Wictor.Demos.Functions || {} | |
Wictor.Demos.OnPostRender = function (context) { | |
var wpTable = $get("Hero-" + context.wpq); | |
if (wpTable != null) { | |
var children = wpTable.getElementsByTagName("a"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
asnp *sh* | |
get-spsite -limit all| select url, @{label="Size in MB";Expression={$_.usage.storage/1MB}}, @{label="Content Database"; Expression={$_.ContentDatabase.Name}}, @{label="Quota Max"; expression={$_.Quota.StorageMaximumLevel/1MB}}, @{label="Created"; expression={$_.RootWeb.Created}} | Sort-Object -Descending -Property "Size in MB" | ConvertTo-Csv | Set-Content c:\temp\scsize.csv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://support.microsoft.com/kb/260729 | |
# 0x0000 0 Do not log | |
# 0x0001 1 Log error messages | |
# 0x0002 2 Log warnings | |
# 0x0004 4 Log informational and success events | |
Set-ItemProperty HKLM:\System\CurrentControlSet\Control\SecurityProviders\SCHANNEL -Name "EventLogging" -Value "4" | |
Write-Host -ForegroundColor Red "You need to reboot the server" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
asnp microsoft.sharepoint.powershell | |
Get-SPServer | ?{$_.Role -eq "Application"} | %{ | |
Write-Host -ForegroundColor Green "Updating $_ ..." | |
Invoke-Command -ComputerName $_.Name { | |
Stop-Service SPTimerV4 | |
Stop-Service SPAdminV4 | |
Get-ChildItem $env:ALLUSERSPROFILE\Microsoft\SharePoint\Config | ?{$_.Name.Contains("-")} | Get-ChildItem | ?{$_.Extension -eq ".xml"} | Remove-Item | |
$ini = Get-ChildItem $env:ALLUSERSPROFILE\Microsoft\SharePoint\Config | ?{$_.Name.Contains("-")} | Get-ChildItem | ?{$_.Extension -eq ".ini"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var spContext = SharePointContextProvider.Current.GetSharePointContext(HttpContext); | |
List<OfficeGraphResult> graphResult = new List<OfficeGraphResult>(); | |
using (var clientContext = spContext.CreateUserClientContextForSPHost()) | |
{ | |
if (clientContext != null) | |
{ | |
var keywordQuery = new KeywordQuery(clientContext) | |
{ | |
QueryText ="*", | |
RowLimit = 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string resourceId = "<resource id>"; | |
// Can be: | |
// For SharePoint (CSOM), tenant Url: https://tenant.sharepoint.com | |
// For Azure AD Graph: https://graph.windows.net | |
// For Office 365 Discovery: https://api.office.com/discovery/ | |
// For Exchange Online: https://outlook.office365.com/ | |
string secret = "<App client secret>"; // a generated guid | |
Uri redirectUri = new Uri("<App redirect Uri>"); // for instance app://my-app |
OlderNewer