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
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
<# .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
<# .SYNOPSIS | |
Title of the script | |
.DESCRIPTION | |
Description of the script | |
.NOTES | |
Author : Are Flyen | |
Date : 23.03.2023 | |
.LINK | |
https://www.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
# Configuration | |
$TenantUrl = "https://contoso.sharepoint.com" | |
$Username = "danj@contoso.com" | |
$Password = "Password1" | |
$SiteTitle = "My Communication Site 1" | |
$SiteUrl = "https://contoso.sharepoint.com/sites/mycomsite1" # Note this URL must be available (check with "/_api/GroupSiteManager/GetValidSiteUrlFromAlias") | |
$SiteTemplate = "" # "Topic" => leave empty (default), "Showcase" => "6142d2a0-63a5-4ba0-aede-d9fefca2c767" and "Blank" => "f6cc5403-0d63-442e-96c0-285923709ffc" | |
# Communication site creation request |
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 | |
$SiteUrl = "https://TENANTID.sharepoint.com" | |
$TermGroupName = "Contoso" | |
$TermSetName = "Document Types" | |
$TermName = "Reports" | |
$TermLcid = 1033 | |
$TermGuid = "2bdb40fd-02e4-4604-914e-9f8012685be0" | |
# Get correct termset | |
Connect-PnPOnline -Url $SiteUrl -Credentials $GlobalCredentialsId |
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
# Connects to Azure Active Directory to authenticate and retrieve a valid access token using a Client ID and secret | |
function Get-CorpMicrosoftGraphAccessToken | |
{ | |
param( | |
[string] $TenantId, | |
[string] $ClientId, | |
[string] $ClientSecret | |
) | |
$AccessToken = "" |
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
# Log event to file | |
function Add-CorpLog | |
{ | |
param( | |
[Parameter(Mandatory=$true)] | |
[string]$Message | |
) | |
if ($CorpWriteLogToConsole -eq $True) | |
{ |
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-PnPOnline -Url "https://contoso.sharepoint.com/sites/teamsite1" | |
$Web = Get-PnPWeb -Includes SupportedUILanguageIds,Language | |
$AvailableLanguages = Get-PnPAvailableLanguage | |
# Enable multi language support | |
$Web.IsMultilingual = $true | |
# Add UI support for additional languages | |
foreach ($AvailableLanguage in $AvailableLanguages) | |
{ |
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 siteUri = new Uri("https://contoso.sharepoint.com/sites/teamsite1"); | |
string realm = TokenHelper.GetRealmFromTargetUrl(siteUri); | |
var accessToken = TokenHelper.GetAppOnlyAccessToken(TokenHelper.SharePointPrincipal, siteUri.Authority, realm).AccessToken; | |
using (var clientContext = TokenHelper.GetClientContextWithAccessToken(siteUri.ToString(), accessToken)) | |
{ | |
var web = clientContext.Web; | |
clientContext.Load(web, w => w.SupportedUILanguageIds, w => w.Language, w => w.RegionalSettings.InstalledLanguages); | |
clientContext.ExecuteQuery(); |