Skip to content

[BUG]Object reference not set to an instance of an object. Calling Update-PnPTeamsUser -Team $TeamID -User $UserUPN -Role 'Member' -force  #4056

@MarkF26

Description

@MarkF26

Reporting an Issue

when executing the command below on certain Team objects the error message above is returned. The command is used to change an owner to a member (there is more than 1 owner on this object). Only certain teams for this user is failing. I haven't been able to find a common factor among the teams that fail with this command.

Update-PnPTeamsUser -Team $TeamID -User $UserUPN -Role 'Member' -force

Expected behavior

The user's membership should be changed to Member.

Actual behavior

It fails with the message below:
Object reference not set to an instance of an object

Steps to reproduce behavior

$UserUPN ='JDoe@mycompany.com'
$TeamID = "xxxxxxxx-yyyy-zzzz-aaaa-bbbbbbbbbbbb"
Update-PnPTeamsUser -Team $TeamID -User $UserUPN -Role 'Member' -force

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

2.5.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

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions