Skip to content

[BUG] Add-PnPFile - Modified/ Editor field assignment fails with "specified user could not be found." #2767

@gottabeoutdoors

Description

@gottabeoutdoors

Reporting an Issue or Missing Feature

With the Add-PNPFile command I cannot set a specific editor.

Expected behavior

To set a specific person in editor field by the Add-PNPFile command

Actual behavior

Add-PnPFile : The specified user could not be found.

(note the double space where the user is referenced)

Steps to reproduce behavior

If I do:
$PNPId = Get-PnPUser | ? Email -eq $FQN |select Id

I properly get '3' as the user Id stored into $PNPId

But when I immediately use that Id for the Editor value, I get the "specified user could not be found." error.

Add-PnPFile -path $SmallLocalFile -folder $DestinationOneDriveSiteRelativePath -Values @{Modified="1/1/2016"; Created="1/1/2017"; Editor=$PNPId}

Add-PnPFile : The specified user could not be found.

If I remove the Editor argument and just leave the two dates, the command executes successfully and my file is properly uploaded. here is the working command:

Add-PnPFile -path $SmallLocalFile -folder $DestinationOneDriveSiteRelativePath -Values @{Modified="1/1/2016"; Created="1/1/2017"}

I really need to be able to set the Editor field, though. Is this a bug or something wrong with my code/approach?

NOTE: This seems similar to closed issue #673, but they seem to indicate that the command succeeds but the Editor value just isn't set. In my case I am flat out failing with the "specified user could not be found." error.

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

1.12.0

Which operating system/environment are you running PnP PowerShell on?

  • Windows
  • Linux
  • MacOS
  • Azure Cloud Shell
  • Azure Functions
  • Other : please specify

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions