Meilleur auteur de réponses
Script PowerShell - CSV Sharepoint Online

Question
-
Bonjour à tous !
Je dois faire un script qui doit importer un annuaire LDAP vers une liste Sharepoint Online...
J'ai fais mon script pour mon LDAP (création d'un fichier CSV) il me manque la partie importation vers une liste Sharepoint Online...
Cette liste alimente une application PowerApps...
Pouvez vous m'aider ?
Merci à tous
Cordialement
Réponses
-
Salut Thomas,
Tu peux utiliser le FrameWork Pnp Powershell (https://github.com/SharePoint/PnP-PowerShell)
Et voilà un code d'exemple:
$currentPath = Get-Location # Adresse de ton site $UrlSite = Connect-PnPOnline -Url "<Ton URL>" -Credential (Get-Credential) # Path de ton fichier CSV $TonCSV= "$currentPath\CsvConfig\toncsv.csv" $CSV = import-csv $TonCSV -Delimiter ";" -Encoding UTF8 # Ajout dans la liste foreach ($additem in $CSV) { # https://docs.microsoft.com/en-us/powershell/module/sharepoint-pnp/add-pnplistitem?view=sharepoint-ps Add-PnPListItem -List "Demo List" -ContentType "Company" -Values @{"Title" = $additem.Title; "Category"=$additem.Category} }
Bàt.
- Modifié Ostefn mercredi 4 juillet 2018 09:53
- Marqué comme réponse Mahinc Thomas vendredi 6 juillet 2018 14:34
Toutes les réponses
-
Salut Thomas,
Tu peux utiliser le FrameWork Pnp Powershell (https://github.com/SharePoint/PnP-PowerShell)
Et voilà un code d'exemple:
$currentPath = Get-Location # Adresse de ton site $UrlSite = Connect-PnPOnline -Url "<Ton URL>" -Credential (Get-Credential) # Path de ton fichier CSV $TonCSV= "$currentPath\CsvConfig\toncsv.csv" $CSV = import-csv $TonCSV -Delimiter ";" -Encoding UTF8 # Ajout dans la liste foreach ($additem in $CSV) { # https://docs.microsoft.com/en-us/powershell/module/sharepoint-pnp/add-pnplistitem?view=sharepoint-ps Add-PnPListItem -List "Demo List" -ContentType "Company" -Values @{"Title" = $additem.Title; "Category"=$additem.Category} }
Bàt.
- Modifié Ostefn mercredi 4 juillet 2018 09:53
- Marqué comme réponse Mahinc Thomas vendredi 6 juillet 2018 14:34
-
-