Powershell PnP - accesso a Sharepoint online e scaricare file

0

Domanda

Sto cercando di accesso a Sharepoint Online con PnP. La cosa è una volta che io uso le credenziali mi chiede di selezionare le credenziali di windows e mentre cerco di utilizzare weblogin:

Connect-PnPOnline -Url "https://somesite.sharepoint.com" -UseWebLogin

Tenta automaticamente di registro di me con il mio currrent Utente di Windows.

Quello che cerco di ottenere è l'autenticazione con utente/password è il codice e scaricare file da Sharepoint in background.

C'è un modo per realizzarlo con PnP?

1

Migliore risposta

0

Si prega di provare il codice riportato di seguito

# Variable - Change the parameter as it need  
$O365ServiceAccount = "[email protected]"  
$O365ServiceAccountPwd = "Test123$"  
$SharePointSiteURL = "https://abc.sharepoint.com/sites/Test"  
# Change this SharePoint Site URL  
$SharedDriveFolderPath = "C:\Users\kumavini\Documents\FolderA"  
# Change this Network Folder path  
$SharePointFolderPath = "Shared Documents/FolderA"  
# Change the Document Library and Folder path  
#Ends[SecureString] $SecurePass = ConvertTo - SecureString $O365ServiceAccountPwd - AsPlainText - Force[System.Management.Automation.PSCredential] $PSCredentials = New - Object System.Management.Automation.PSCredential($O365ServiceAccount, $SecurePass)  
#Connecting to SharePoint site  
Connect - PnPOnline - Url $SharePointSiteURL - Credentials $PSCredentials  
$Files = Get - PnPFolderItem - FolderSiteRelativeUrl $SharePointFolderPath - ItemType File  
foreach($File in $Files) {  
    Get - PnPFile - Url $File.ServerRelativeUrl - Path $SharedDriveFolderPath - FileName $File.Name - AsFile  
}   
2021-11-24 05:55:38

In altre lingue

Questa pagina è in altre lingue

Русский
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................