Repository navigation
Stream Support Improvements - #433
Merged
Merged
Conversation
Peter Ombwa (peombwa)
requested review from
Darrel (darrelmiller),
DeVere Dyett (ddyett) and
George (georgend)
October 16, 2020 23:00
Contributor
|
is this correct? shouldn't it be infile? Upload drive item content.Set-MgDriveItemContent -DriveId $driveId -DriveItemId $itemId -OutFile "c:\tmp\updatedDoc.docx" |
Contributor
|
do we need this support for Invoke-GraphRequest too? |
DeVere Dyett (ddyett)
approved these changes
Oct 22, 2020
Contributor
IGR had it baked in, however, I can run the tests Peter Ombwa (@peombwa) has run and confirm all is well. |
George (georgend)
approved these changes
Oct 22, 2020
Member
Author
This should be InFile. |
Merged
|
Peter Ombwa (@peombwa) What is $itemid in the above examples? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR proposes the following changes to properly handle file upload and download with the generated commands.
Adds
FileUploadCmdletclass. This will be the base class for all cmdlets that upload files i.e.-BodyParameteris of typeStreamand name starts withSet-*.FileUploadCmdletclass performs the following :-InFileparameter to all cmdlets that derive fromFileUploadCmdlet.GetFileAsStreamhandles getting a resolved path to the file and returns a thread safe stream.Adds
PSCmdletExtensionsclass. This class provides helper methods that handle retrieval of valid paths and writing of streams to a file on disk.Adds directives to replace broken file upload and download logic in generated cmdlets.
For file download, the directive:
WriteToFileinPSCmdletExtensions.For file upload, the directive:
FileUploadCmdlet.bodyParameteroptional sinceFileUploadCmdletadds a mandatory-InFileparameter.GetFileAsStreamin `FileUploadCmdlet.Updates modules mapping tags and onpremisespublishingprofile directives.
Proposed Usage
These changes we tested against the OpenAPI docs in staging. Thanks Irvine Sunday (@irvinesunday)!
Closes #54 and #182