Skip to content

Instantly share code, notes, and snippets.

@NielsGregers
Created January 26, 2021 14:26
Show Gist options
  • Save NielsGregers/b338183ae2fb891b010ccfc447939c71 to your computer and use it in GitHub Desktop.
Save NielsGregers/b338183ae2fb891b010ccfc447939c71 to your computer and use it in GitHub Desktop.
. "$PSScriptRoot\.hexatown.com.ps1"
$hexatown= Init $MyInvocation $false
RefreshSharePointList $context
ShowState "Importing missing items"
$items = loadFromJSON $context.datapath "items"
$list = CreateDictionary $hexatown "items.sharepoint"
foreach ($item in $items) {
if (!$list.ContainsKey($item)){
$body = @{
Title = $item
}
$item = PostSharePointListItem $hexatown.token $hexatown.site $schema.lists.items (@{fields=$body} | ConvertTo-Json)
Write-Host "Imported item " $item.fields.id
}
}
Done $hexatown
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment