• Stars
    star
    36
  • Rank 711,618 (Top 15 %)
  • Language
    PowerShell
  • License
    MIT License
  • Created almost 6 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

β™» Replicates SharePoint Lists

SPReplicator

SPReplicator logoSPReplicator is a PowerShell module that helps replicate SharePoint list data.

This module uses the SharePoint Client Side Object Model (CSOM), the PnP.PowerShell module and all required libraries and dlls are included. Installing the SharePoint binaries is not required for the replication to work πŸ‘ Thank you Microsoft for the redistributable nuget and PnP.PowerShell.

SPReplicator works with both on-prem and SharePoint Online and is currently in beta. It also works on .NET Core, so it's cross-platform, and supports Windows, macOS and Linux.

Please report any issues to [email protected].

Installer

SPReplicator is now in the PowerShell Gallery. Run the following from an administrative prompt to install SPReplicator for all users:

Install-Module SPReplicator

Or if you don't have administrative access or want to save it locally (just for yourself), run:

Install-Module SPReplicator -Scope CurrentUser

If you're scheduling tasks via Task Schedule or SQL Server agent, installing the module with administrative privileges is best because it will ensure all users have access via Program Files.

Command Reference

For more details about commands, visit the wiki or use Get-Help.

Usage scenarios

This module can be used for replicating data in a number of ways.

  • Between air gapped (offline) servers that do not have direct access to each other
  • Directly from SharePoint site collection to SharePoint site collection
  • From SQL Server to SharePoint
  • From SharePoint to SQL Server
  • From CSV to SharePoint
  • From SharePoint to CSV
  • From On-prem to SharePoint Online and back

Usage examples

SPReplicator has a number of commands that help you manage SharePoint lists. You can view, delete, and add records easily and there's even a command that makes it easy to see internal column names and datatypes.

Export from SharePoint List

Export-SPRListItem -Site https://intranet -List Employees -Path \\nas\replicationdata\Employees.csv

Establish a session to the SharePoint site

You can specify -Site and -Credential with every command. Or you can establish a connection and not worry about specifying the Site or Credentials in subsequent command executions.

There is no need to assign the output to a variable, as it creates a reusable global variable $global:spsite.

# using your own account credentials
Connect-SPRSite -Site https://intranet

# specifying other credentials
Connect-SPRSite -Site https://intranet -Credential ad\otheruser

# using your own account credentials and SP Online
Connect-SPRSite -Site https://corp.sharepoint.com -Credential otheruser@corp.onmicrosoft.com

# using MFA
Connect-SPRSite -Site https://corp.sharepoint.com -AuthenticationMode WebLogin

# using app login
Connect-SPRSite -Site https://corp.sharepoint.com -AuthenticationMode AppOnly -Credential 1e36c5cc-5281-4235-a84f-c94dc2de8800

Import to SharePoint List

Now that we've established a connection via Connect-SPRSite, we no longer need to specify the Site.

We can import data two ways, using Import-SPRListItem or Add-SPRListItem

# Import from CSV
Import-SPRListItem -List Employees -Path \\nas\replicationdata\Employees.csv

# Import from SQL Server
Invoke-DbaQuery -SqlInstance sql2017 -Query "Select fname, lname where id > 100" | Add-SPRListItem -List emps

# Import any PowerShell object, really. So long as it has the properly named columns.
Get-ADUser -Filter * | Select SamAccountName, whateverelse | Add-SPRListItem -List ADList

# Didn't have time to create a good SharePoint list? Use -AutoCreateList
Get-ADUser -Filter * | Add-SPRListItem -List ADList -AutoCreateList

Find out more

This was just a subset of command examples. For more command examples, visit the wiki or use Get-Help.

Selected screenshots

Connect to a site

image

Add a generic object to a list

image

Add SQL data to a list and auto create the list if it doesn't exist

image

This is what it looks like!

image

Get details about columns to help you format your input/output

image

Results of built-in logger (New-SPRLogList and -LogToList)

image

Power BI

A Power BI Template can be downloaded from here.

image

Pester tested

This module comes with integration tests! If you'd like to see how I test the commands, check out Integration.Tests.ps1

image

Learn more

To find out more about any command, including additional examples, use Get-Help.

Get-Help Get-SPRColumnDetail -Detailed

More Repositories

1

eol-dr

A crowd-sourced guide to help techs help their non-tech spouses / partners / parents / kids when we are at the end-of-life
1,394
star
2

kbupdate

πŸ›‘ KB Viewer, Saver, Installer and Uninstaller
PowerShell
288
star
3

modules

Modules like Invoke-CsvSqlcmd
PowerShell
46
star
4

discordrpc

Discord Rich Presence Client written in PowerShell
PowerShell
41
star
5

mssqlsuite

A GitHub Action that automatically install SQL Server suite of tools
PowerShell
38
star
6

tentools

πŸ’™ tenable.sc / nessus / acas powershell module
PowerShell
36
star
7

psmodulecache

This action makes caching PowerShell modules from the PowerShell Gallery easy for Linux, Windows and macOS runners.
PowerShell
27
star
8

fossilize

Mastodon Backup GitHub Action
PowerShell
19
star
9

psu-themes

Themes for PowerShell Universal
PowerShell
14
star
10

twitch

πŸ€– twitch.tv API client and chatbot written in PowerShell
PowerShell
14
star
11

nowcastnotify

cute lil thing for june
PowerShell
11
star
12

SqlImportSpeedTest

Join in! Goal is 500k, now at 232k.
PowerShell
11
star
13

exodus

Helps Twitter communities find members on Mastodon. Searches lists, hashtags, account followers and more for Mastodon links and exports them to an importable CSV file.
PowerShell
8
star
14

postprofile

Faster PowerShell Profiles
PowerShell
7
star
15

scripts

Various scripts like Invoke-Locate.ps1
PowerShell
6
star
16

dbatools-demo

just a lil demo
PowerShell
6
star
17

finetuna

An OpenAI Fine Tuner written in PowerShell
PowerShell
6
star
18

cl

⚑ simplified config and logging for PowerShell
5
star
19

PSPostgres

PowerShell binary module for Postgres
C#
5
star
20

stigiis

πŸ¦… DISA STIG automation module for IIS
PowerShell
4
star
21

MSConnect

Scripts and CSVs relating to connect.microsoft.com/SQLServer and twitter.com/closedasfixed
PowerShell
4
star
22

disarepotools

πŸ¦… DISA Patch Repository Tools - List, download files and install files from DISA patch repositories using your smartcard
PowerShell
4
star
23

devcontainers

Dev Containers, Codespaces and more for Azure PowerShell Function Apps
PowerShell
4
star
24

azuright

GitHub Action that installs azurite
PowerShell
3
star
25

influx

Import CSV files to Mastodon for follows, mutes, bookmarks and more
PowerShell
3
star
26

vscode-filename-searcher

Adds a searchable sidebar to VS Code that lists files in your workspace and lets you open them in a new window.
TypeScript
3
star
27

release

manual releases
3
star
28

pastel

PowerShell Crescendo module for pastel
PowerShell
3
star
29

xevents-demo

PowerShell
2
star
30

potatoqualitee

2
star
31

psonlinux

2
star
32

vscode-dbatools-search

πŸ”Ž Search dbatools for selected text from VS Code
TypeScript
2
star
33

ogimage

Generates Open Graph images (OG:Image) to give your links more context on social media shares.
PowerShell
2
star
34

releases

automatic releases
1
star
35

bin

Supporting files for modules
PowerShell
1
star
36

mastodon-alias

Sample GitHub Pages repo to show how to alias a domain
1
star
37

api-demo

The demo for the Beautiful API presentation I did.
PowerShell
1
star
38

disatools

πŸ¦… DISA STIG automation toolkit
1
star
39

azfun

PowerShell
1
star
40

pspublish

Update module version and Publish to the PowerShell Gallery
1
star
41

psplaywright

JavaScript
1
star
42

stigtools

HTML
1
star