Skip to content

Commit

Permalink
onedrive tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnDuprey committed Jan 2, 2025
1 parent 671a548 commit 2406287
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ Function Invoke-ExecOneDriveShortCut {
Write-LogMessage -user $request.headers.'x-ms-client-principal' -API $APINAME -message 'Accessed this API' -Sev 'Debug'

Try {
$MessageResult = New-CIPPOneDriveShortCut -username $Request.body.username -userid $Request.body.userid -TenantFilter $Request.Body.TenantFilter -URL $Request.body.input -ExecutingUser $request.headers.'x-ms-client-principal'
$MessageResult = New-CIPPOneDriveShortCut -username $Request.Body.username -userid $Request.Body.userid -TenantFilter $Request.Body.tenantFilter -URL $Request.Body.siteUrl.value -ExecutingUser $request.headers.'x-ms-client-principal'
$Results = [pscustomobject]@{ 'Results' = "$MessageResult" }
} catch {
$Results = [pscustomobject]@{'Results' = "Onedrive Shortcut creation failed: $($_.Exception.Message)" }
$Results = [pscustomobject]@{'Results' = "OneDrive Shortcut creation failed: $($_.Exception.Message)" }
}

# Associate values to output bindings by calling 'Push-OutputBinding'.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ Function Invoke-ExecOneDriveProvision {
param($Request, $TriggerMetadata)

$APIName = $TriggerMetadata.FunctionName
$Params = $Request.Body ?? $Request.Query
try {
$State = Request-CIPPSPOPersonalSite -TenantFilter $Request.Query.TenantFilter -UserEmails $Request.Query.UserPrincipalName -ExecutingUser $request.headers.'x-ms-client-principal' -APIName $APINAME
$State = Request-CIPPSPOPersonalSite -TenantFilter $Params.TenantFilter -UserEmails $Params.UserPrincipalName -ExecutingUser $Request.Headers.'x-ms-client-principal' -APIName $APINAME
$Results = [pscustomobject]@{'Results' = "$State" }
} catch {
$ErrorMessage = Get-NormalizedError -Message $_.Exception.Message
Expand All @@ -24,5 +25,4 @@ Function Invoke-ExecOneDriveProvision {
StatusCode = [HttpStatusCode]::OK
Body = $Results
})

}

0 comments on commit 2406287

Please sign in to comment.