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
<# .SYNOPSIS | |
Restrict Office 365 Groups creation | |
.DESCRIPTION | |
Restrict creation to only users in a specific Azure AD security group. Requires the Azure AD Preview PowerShell module to be installed (this or newer version): https://www.powershellgallery.com/packages/AzureADPreview/2.0.0.98 | |
.NOTES | |
Author : Are Flyen | |
.LINK | |
http://blog.areflyen.no | |
#> |
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
function addMigrationInfo(sender, args) { | |
SP.SOD.executeFunc('sp.js', 'SP.ClientContext', function() { | |
var statusId = SP.UI.Status.addStatus("This site has moved. Please update you bookmarks and visit the new location: <a href='" + url + "'>" + url + "</a>"); | |
SP.UI.Status.setStatusPriColor(statusId, 'yellow'); | |
}); | |
} | |
// Initialize the statusbar as late as possible, see: https://blog.josequinto.com/2015/06/16/custom-javascript-function-loaded-after-the-ui-has-loaded-in-sharepoint-2013/ | |
Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(addMigrationInfo); |
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
#region Configuration | |
$Url = "https://TENANTID.sharepoint.com" # URL of the site | |
$ListTemplateInternalName = "CorpMenu.stp" # Change this with your own list template | |
$ListName = "Menu" # Change this with the name of the list to be created | |
#endregion | |
#region Create list from template |
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
# Settings | |
$Username = "aflyen@northcorp.no" | |
# Connect to Azure AD | |
Connect-AzureAD | |
# Get user | |
$User = Get-AzureADUser -ObjectId $Username | |
Write-Host "Before: $($User.PreferredLanguage)" |
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
# Settings | |
$username = "aflyen@northcorp.no" | |
# Connect to Exchange Online | |
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri "https://outlook.office365.com/powershell-liveid/" -Credential $cred -Authentication Basic -AllowRedirection | |
Import-PSSession $Session | |
# Get current mailbox language settings | |
$Settings = Get-MailboxRegionalConfiguration -Identity $username | |
Write-Host "Before: $($Settings.Language)" |
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
# Connect to SharePoint Online site collection and get context | |
Connect-SPOnline -Url "https://TENANTID.sharepoint.com/sites/news | |
$Context = Get-SPOContext | |
$Web = $Context.Site.RootWeb | |
$Context.Load($Web) | |
Execute-SPOQuery | |
# Enable likes ratings | |
Enable-CustomLikesRatingsOnLibrary -Web $Web -ListRelativeUrl "Pages" |
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
function Enable-CustomLikesRatingsOnLibrary { | |
[CmdletBinding()] | |
Param( | |
[Parameter(Mandatory=$true)] | |
[Microsoft.SharePoint.Client.Web]$Web, | |
[Parameter(Mandatory=$true)] | |
[String]$ListRelativeUrl | |
) | |
# Get required fields |
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
# Configuration | |
$WebUrl = "http://teams.contoso.com/sites/team1" | |
$SiteAdminGroup = "CONTOSO\ContosoSiteAdmins" | |
# Set the AD group as site collection administrator | |
$Web = Get-SPWeb $WebUrl | |
$SiteAdminUser = $Web.EnsureUser($SiteAdminGroup) | |
$SiteAdminUser.IsSiteAdmin = $true | |
$SiteAdminUser.Update() |
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
$Context = Get-SPOContext | |
$Web = $Context.Site.RootWeb | |
$Context.Load($Web) | |
Execute-SPOQuery | |
Enable-CustomItemScheduling -Web $Web -PagesLibraryName "Pages" |
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
function Get-CustomLoadParameter { | |
[CmdletBinding()] | |
param( | |
[Parameter(Mandatory=$true)] | |
[Microsoft.SharePoint.Client.ClientObject]$Object, | |
[Parameter(Mandatory=$true)] | |
[string]$PropertyName | |
) | |
# Reference: http://sharepoint.stackexchange.com/questions/126221/spo-retrieve-hasuniqueroleassignements-property-using-powershell |