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
$PnPPowerShellAppId = "31359c7f-bd7e-475c-86db-fdb8c937548e" | |
# Connect to you Azure AD, use Global admin or equivalent account | |
Connect-AzAccount | |
# get graph access token for current user --need Global admin | |
$accessTokenInformation = Get-AzAccessToken -ResourceUrl "https://graph.microsoft.com" | |
$token = $accessTokenInformation.Token | |
# Create a new service prinicpal |
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
AllSites.FullControl | |
User.Read.All | |
TermStore.ReadWrite.All | |
ServiceHealth.Read | |
ActivityFeed.Read | |
Team.Create | |
TeamsAppInstallation.ReadWriteForUser | |
ChannelMember.ReadWrite.All | |
TeamMember.ReadWrite.All | |
TeamSettings.ReadWrite.All |
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
Add-Type -Path (Resolve-Path "$env:CommonProgramFiles\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll") | |
Add-Type -Path (Resolve-Path "$env:CommonProgramFiles\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll") | |
#Site collection URL | |
$siteurl = "https://tenantname.sharepoint.com/sites/testsitecollection" | |
$userName ="user.name@tenantname.com" | |
$password ="password" | |
#client context object and setting the credentials |
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
using Microsoft.Online.SharePoint.TenantAdministration; | |
using Microsoft.SharePoint.Client; | |
using Newtonsoft.Json.Linq; | |
using OfficeDevPnP.Core; | |
using OfficeDevPnP.Core.Framework.Provisioning.Model.Configuration; | |
using OfficeDevPnP.Core.Framework.Provisioning.ObjectHandlers; | |
using OfficeDevPnP.Core.Framework.Provisioning.Providers.Xml; | |
using System; | |
using System.Collections.Generic; | |
using System.Linq; |
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
$tenant = "tenant.onmicrosoft.com" | |
# Create Azure AD app | |
$psa = Initialize-PnPPowerShellAuthentication -ApplicationName TestTeamsApp -Tenant $tenant -Store CurrentUser | |
# Connect to SPO+Graph using certificate authentication | |
Connect-PnPOnline "https://tenant-admin.sharepoint.com/" -Tenant $tenant -ClientId $psa.AzureAppId | |
-Thumbprint $psa.'Certificate Thumbprint' | |
# Store the extracted template somwhere | |
Get-PnPTenantTemplate -Out "TeamTemplate.xml" -Configuration "ExtractTeam.json" |
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
{ | |
"$schema": "https://aka.ms/sppnp-extract-configuration-schema", | |
"tenant": { | |
"teams": { | |
"teamSiteUrls": ["https://your-tenant-name.sharepoint.com/sites/HRTeam"], | |
"includeGroupId": false, | |
"includeMessages": false | |
} | |
}, | |
"handlers": [ |
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 webUrl = "https://tenant-name.sharepoint.com/sites/test/"; | |
string username = "user.name@tenantname.onmicrosoft.com"; | |
string password = "password"; | |
SecureString secureString = new SecureString(); | |
password.ToList().ForEach(secureString.AppendChar); | |
var credentials = new SharePointOnlineCredentials(username, secureString); | |
using (ClientContext ctx = new ClientContext(webUrl)) | |
{ |
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
using Microsoft.Online.SharePoint.TenantAdministration; | |
using Microsoft.SharePoint.Client; | |
using Newtonsoft.Json.Linq; | |
using OfficeDevPnP.Core; | |
using OfficeDevPnP.Core.Framework.Provisioning.Connectors; | |
using OfficeDevPnP.Core.Framework.Provisioning.Model; | |
using OfficeDevPnP.Core.Framework.Provisioning.ObjectHandlers; | |
using OfficeDevPnP.Core.Framework.Provisioning.Providers; | |
using OfficeDevPnP.Core.Framework.Provisioning.Providers.Xml; | |
using System; |
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 "https://<tenant-name>.sharepoint.com/" -Scopes "User.ReadWrite.All" | |
Apply-PnPTenantTemplate -Path .\AddAzureADUser.xml |
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
<pnp:Provisioning xmlns:pnp="http://schemas.dev.office.com/PnP/2019/09/ProvisioningSchema" | |
Author="Blade runner" | |
Generator="Human being ?" | |
Version="1.0" | |
Description="A sample Provisioning document" | |
DisplayName="Sample Provisioning" | |
ImagePreviewUrl="https://sharepointpnp.com/ImagePreview.png"> | |
<pnp:Preferences Author="Blade runner" Version="1.0" Generator="Human being, am I ?"> | |
<pnp:Parameters> |
NewerOlder