PowerShell Script Workflow

Ryan Shrestha
2 min readJul 5, 2024

--

Welcome to the SharePoint Archiving Solution Series:

This blog is divided into multiple sections, each focusing on a crucial aspect of the migration process. Below are links to navigate directly to each section:

  1. Introduction
  2. Pre-requisites
  3. Application Registration and API Permissions
  4. PowerShell Script Workflow
  5. Understanding the PowerShell Script — Part 1
  6. Understanding the PowerShell Script — Part 2
  7. Understanding the PowerShell Script — Part 3
  8. Get Full Script from GitHub

PowerShell Script Workflow for Migrating SharePoint Items to OneDrive

This diagram illustrates the step-by-step workflow of a PowerShell script designed to automate the migration of SharePoint items to OneDrive.

  1. Start Exe: The execution of the PowerShell script begins.
  2. Site/Sub-Site: The script accesses the SharePoint site/subsite containing the items to be migrated.
  3. Get-SiteLibraries: The script retrieves all document libraries from the identified SharePoint sites.
  4. Get-Items (only Document Types): The script filters and retrieves only the document-type items from these libraries, excluding any other types of content.
  5. Set-Path: The script determines the paths of the SharePoint items and stores them in the $finalResult variable. It modifies these paths to create a hierarchical path structure appropriate for OneDrive and stores this information in the $FolderArray.
  6. Set-OneDriveFolder: The script extracts folder names from $FolderArray. It creates the corresponding folders in OneDrive if they do not already exist. The script retrieves the OneDrive folder IDs and stores them in the $FolderIDList.
  7. Move-SharePointFiles: The script uses the stored OneDrive folder IDs from $FolderIDList and the SharePoint item paths from $finalResult. It initiates the transfer of items from SharePoint to the corresponding OneDrive folders.
  8. End: The execution of the script concludes, completing the migration process.

This workflow ensures an efficient and organized transfer of documents from SharePoint to OneDrive, preserving the folder hierarchy and leveraging the automation capabilities of PowerShell.

< Previous1 2 3 4 5 6 7Next >

--

--

Ryan Shrestha
0 Followers

Diving into the ocean of Communicational Technologies.