Coder Social home page Coder Social logo

spreplicator's Introduction

SPReplicator

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

This module uses the SharePoint Client Side Object Model (CSOM) 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.

SPReplicator works with both on-prem and SharePoint Online and is currently in beta. 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

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 is included in the bin directory. More coming soon.

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

spreplicator's People

Contributors

potatoqualitee avatar cporteou avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.