fix: Correct URI construction and ensure proper function exports/imports
This commit is contained in:
parent
529c0f3982
commit
83895edac4
@ -5,7 +5,8 @@ Import-Module Microsoft.Graph.Files
|
|||||||
|
|
||||||
# Import our components
|
# Import our components
|
||||||
. "$PSScriptRoot\GraphConfig.ps1"
|
. "$PSScriptRoot\GraphConfig.ps1"
|
||||||
. "$PSScriptRoot\SharePointFunctions.ps1"
|
$SharePointFunctions = "$PSScriptRoot\SharePointFunctions.ps1"
|
||||||
|
Import-Module $SharePointFunctions -Force
|
||||||
. "$PSScriptRoot\EventHandlers.ps1"
|
. "$PSScriptRoot\EventHandlers.ps1"
|
||||||
|
|
||||||
# Create main form
|
# Create main form
|
||||||
|
|||||||
@ -1,5 +1,18 @@
|
|||||||
# SharePointFunctions.ps1
|
# SharePointFunctions.ps1
|
||||||
|
|
||||||
|
$script:config = $null # Initialize config variable
|
||||||
|
|
||||||
|
# Export functions that will be called from other scripts
|
||||||
|
Export-ModuleMember -Function @(
|
||||||
|
'Load-Config',
|
||||||
|
'Save-Config',
|
||||||
|
'Get-FolderBrowser',
|
||||||
|
'Connect-SharePoint',
|
||||||
|
'List-XlsFiles',
|
||||||
|
'Convert-Files',
|
||||||
|
'Move-Files'
|
||||||
|
)
|
||||||
|
|
||||||
# Load configuration from config.json
|
# Load configuration from config.json
|
||||||
function Load-Config {
|
function Load-Config {
|
||||||
try {
|
try {
|
||||||
@ -441,7 +454,7 @@ function Convert-Files {
|
|||||||
|
|
||||||
# Construct the download URI
|
# Construct the download URI
|
||||||
$encodedPath = [System.Web.HttpUtility]::UrlEncode($relativePath).Replace("+", "%20")
|
$encodedPath = [System.Web.HttpUtility]::UrlEncode($relativePath).Replace("+", "%20")
|
||||||
$downloadUri = "https://graph.microsoft.com/v1.0/drives/$($drive.Id)/root:/$encodedPath:/content"
|
$downloadUri = "https://graph.microsoft.com/v1.0/drives/$($drive.Id)/root:/$($encodedPath):/content"
|
||||||
|
|
||||||
# Download the file
|
# Download the file
|
||||||
Invoke-MgGraphRequest -Uri $downloadUri -Method GET -OutFile $downloadPath
|
Invoke-MgGraphRequest -Uri $downloadUri -Method GET -OutFile $downloadPath
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user