pnp / PnP-PowerShell

SharePoint PnP PowerShell CmdLets
https://pnp.github.io/powershell
Other
987 stars 665 forks source link

Add-PnPFolder : shouldn't it return the created item #1892

Open kasperbolarsen opened 5 years ago

kasperbolarsen commented 5 years ago

In order to align behavior with Add-PnPField and similar commands I would expect this command to return the new object

Expected behavior

$newfold = Add-PnPFolder -Name FolderA -Folder Documents

Actual behavior

Add-PnPFolder returns nothing

Which version of the PnP-PowerShell Cmdlets are you using?

What is the version of the Cmdlet module you are running?

3.6.1902.2

How did you install the PnP-PowerShell Cmdlets?

skaggej commented 5 years ago

I'm having trouble building the latest bits, but my best guess is that we'll need to update the AddFolder.cs in the PowerShell solution to write the created folder to the pipeline. The PnP-Sites-Core solution returns the folder, but the PowerShell solutions doesn't write it to the pipeline at the moment.

Maybe something like this?

2019-03-02_8-56-44

bpringe commented 5 years ago

I second this. I am working on a script that creates folders based on a column value of files and moves them into those folders. However, some of the column values have characters that are not allowed in folder names, so in order to move the file into the new folder I need to manually create the target folder name to match what Add-PnPFolder created it as. It would be nice if the command returned at least the name of the folder (but of course more data would be useful).

jackpoz commented 4 years ago

I created a PR with the change at https://github.com/SharePoint/PnP-PowerShell/pull/2463

jackpoz commented 4 years ago

This issue can be closed now as the functionality is included in https://github.com/SharePoint/PnP-PowerShell/releases/tag/3.18.2002.0 release