This file contains hidden or 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
| # Requires Azure AD PowerShell Module | |
| #Prompts user to login using Azure Credentials | |
| Connect-AzureAD | |
| $results = @() | |
| Get-AzureADApplication -All $true | %{ | |
| $app = $_ | |
| $owner = Get-AzureADApplicationOwner -ObjectId $_.ObjectID -Top 1 |
This file contains hidden or 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
| # Requires Azure AD PowerShell Module | |
| #Prompts user to login using Azure Credentials | |
| Connect-AzAccount | |
| #Set the page size to your need. | |
| $pgsize = 100; | |
| $pg = 0; | |
| $cnt = $null | |
| $results = @() |
This file contains hidden or 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
| <# | |
| DISCLAIMER | |
| ---------- | |
| The scripts is provided is not to be treated as an official recommendations from Microsoft. The information provided is as-is with no warranty and use at your personal risk. | |
| PURPOSE | |
| ------- | |
| Sample script to upload small to large files to SPO that uses the ACS (AppRegNew.aspx) based registered app. | |
| Example SPO ACS APP REGISTRATION (Using AppRegNew.aspx page) |
This file contains hidden or 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
| clear | |
| # The resource URI | |
| $resource = "https://graph.microsoft.com" | |
| # Your Client ID and Client Secret obainted when registering your WebApp | |
| $clientid = "GUID FOR APPID"; | |
| $clientSecret = "CLIENT SECRET FOR APP"; | |
| $redirectUri = "https://localhost" | |
| # UrlEncode the ClientID and ClientSecret and URL's for special characters | |
| Add-Type -AssemblyName System.Web |
This file contains hidden or 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
| clear | |
| # The resource URI | |
| $resource = "https://graph.microsoft.com" | |
| # Your Client ID and Client Secret obainted when registering your Azure AD (AAD) APP | |
| $clientid = "AAD APP ID"; | |
| $clientSecret = "AAD APP CLIENT SECRET"; | |
| $redirectUri = "https://localhost" | |
| # UrlEncode the ClientID and ClientSecret and URL's for special characters | |
| Add-Type -AssemblyName System.Web |
This file contains hidden or 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
| clear | |
| # Azure AD(AAD) Application (client) ID, tenant Name and secret | |
| $tenantName = "YOURTENANT.onmicrosoft.com" | |
| $clientId = "AAD APP ID"; | |
| $clientSecret = "AAD APP CLIENT SECRET"; | |
| $resource = "https://graph.microsoft.com/" | |
| $ReqTokenBody = @{ | |
| Grant_Type = "client_credentials" | |
| Scope = "https://graph.microsoft.com/.default" |
This file contains hidden or 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
| cls | |
| #Import-Module Microsoft.Online.SharePoint.PowerShell | |
| Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll" | |
| Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll" | |
| Add-Type -Path "C:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.DocumentManagement.dll" | |
| #Setting this to True will create new version for any DocSet it identifies that has zero versions existing | |
| $CreateNewVersion = $true | |
| $AdminPass = "password" | |
| $AdminPassword = ConvertTo-SecureString -string $AdminPass -AsPlainText -Force |
This file contains hidden or 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.SharePoint.Client; | |
| using System; | |
| using System.Collections.Generic; | |
| using System.Linq; | |
| using System.Security; | |
| using System.Text; | |
| using System.Threading.Tasks; | |
| namespace CSOM.ConsoleApp.Sample | |
| { |
This file contains hidden or 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
| ################################################# | |
| #Set $runconfig to one of the values below | |
| #"checkinfiles" -->Runs the code across all the site collections and subwebs and checks in the files | |
| #"checkinfilesselect" -->Runs the code on only those web urls that are supplied in the $websToProcess array | |
| $runconfig = "checkinfilesselect" #"checkinfiles" | |
| #Set $excludeLists array to library titles that needs to be excluded from processing | |
| [String[]]$excludeLists = @('Excel Docs', | |
| 'Form Templates', | |
| 'Site Assets', |
This file contains hidden or 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" | |
| az ad sp create --id $PnPPowerShellAppId | |
| #The guid 00000003-0000-0000-c000-000000000000 corresponds to Microsoft Graph | |
| az ad app permission grant --id $PnPPowerShellAppId --api 00000003-0000-0000-c000-000000000000 --scope User.Read.All,Group.ReadWrite.All | |
| #The guid 00000003-0000-0ff1-ce00-000000000000 corresponds to SPO | |
| az ad app permission grant --id $PnPPowerShellAppId --api 00000003-0000-0ff1-ce00-000000000000 --scope User.Read.All,Sites.FullControl.All |
OlderNewer