all scripts
This commit is contained in:
55
sharepoint_Api.ps1
Normal file
55
sharepoint_Api.ps1
Normal file
@@ -0,0 +1,55 @@
|
||||
#install module if neccesary
|
||||
#Install-Module -Name PnP.PowerShell -RequiredVersion 1.12.0
|
||||
|
||||
# Variables
|
||||
$NewRfcClientId = "ac13078d-5621-4e28-81db-f5501d222e5d"
|
||||
$NewRfcClientSecret = "BQOHS6LoESeBku+HIszR7cYvDMJp7EhGLhgkp369NAE="
|
||||
$NewRfcUrl = "https://thalesdk.sharepoint.com/sites/SMO/TM/"
|
||||
$ListTitle = "RFC"
|
||||
|
||||
$OldRfcClientId = "c3c3817d-8c3d-49fa-91cb-bdd498e2cc52"
|
||||
$OldRfcClientSecret = "csXug7EEB3AQ71S+srSCZHOzVPoUxbazkDLvw/Mb8Bw="
|
||||
$OldRfcUrl = "https://thalesdk.sharepoint.com/DriftsPortal/"
|
||||
$ListTitle = "RFC"
|
||||
|
||||
|
||||
#new RFC
|
||||
Connect-PnPOnline -Url $OldRfcUrl -ClientId $OldRfcClientId -ClientSecret $OldRfcClientSecret
|
||||
$items1 = Get-PnPListItem -List 'RFC' -Fields 'ChangeTitle','Status','Environmentimpacted','TypeofChange'
|
||||
$result1 = foreach($item1 in $items1) {
|
||||
$obj1 = [pscustomobject]@{}
|
||||
|
||||
foreach($key1 in $item1.FieldValues.Keys) {
|
||||
$obj1 = $obj1 | Add-Member -MemberType NoteProperty -Name $key1 -Value $item1.FieldValues[$key1] -PassThru
|
||||
}
|
||||
|
||||
Write-Output $obj1
|
||||
}
|
||||
|
||||
|
||||
|
||||
#Old RFC
|
||||
Connect-PnPOnline -Url $OldRfcUrl -ClientId $OldRfcClientId -ClientSecret $OldRfcClientSecret
|
||||
$items = Get-PnPListItem -List 'RFC' -Fields 'Title','Status','Milj_x00f8_','System','Beskrivelse','Kontakt_x0020_person_x003f_','Tidspunkt_x0020_for_x0020_udf_x0','Attachments','IBM_x0020_Change_x0020_nummer'
|
||||
$result = foreach($item in $items) {
|
||||
$obj = [pscustomobject]@{}
|
||||
|
||||
|
||||
foreach($key in $item.FieldValues.Keys) {
|
||||
|
||||
if ($key -notin @("ScopeId","FileRef","MetaInfo","_ModerationStatus","_Level","ID","UniqueId","owshiddenversion","FSObjType")) {
|
||||
$obj = $obj | Add-Member -MemberType NoteProperty -Name $key -Value $item.FieldValues[$key] -PassThru
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$obj.Kontakt_x0020_person_x003f_ = $obj.Kontakt_x0020_person_x003f_.LookupValue
|
||||
Write-Output $obj
|
||||
}
|
||||
|
||||
|
||||
#grab fields
|
||||
#$fields = Get-PnPField -List "RFC"
|
||||
#Write-Output $fields.InternalName
|
||||
|
||||
|
||||
Reference in New Issue
Block a user