Repository navigation
Description
Attempting to run the following results in an error:
Update-MgOrganizationSettingItemInsight -OrganizationId "" -DisabledForGroup ""
Error returned is:
Update-MgOrganizationSettingItemInsight_UpdateViaIdentityExpanded: Object reference not set to an instance of an object.
Microsoft.Graph.Identity.Organization module is at version 0.9.1. Using Fiddler to monitor requests this is failing locally (appears to be an issue with hashtable conversion based on below) before it can even query Microsoft Graph. Performing the same request in Graph Explorer with a PATCH is successful. Let me know if need any additional logs or repro steps.
Full error output::
Exception :
Type : System.NullReferenceException
TargetSite :
Name : HashTableToDictionary
DeclaringType : Microsoft.Graph.PowerShell.Runtime.DictionaryExtensions,
Microsoft.Graph.Identity.Organization.private, Version=0.9.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
MemberType : Method
Module : Microsoft.Graph.Identity.Organization.private.dll
StackTrace :
at Microsoft.Graph.PowerShell.Runtime.DictionaryExtensions.HashTableToDictionary[V](Hashtable hashtable,
IDictionary`2 dictionary)
at Microsoft.Graph.PowerShell.Cmdlets.UpdateMgOrganizationSettingItemInsight_UpdateExpanded.ProcessRecordAsync()
Message : Object reference not set to an instance of an object.
Source : Microsoft.Graph.Identity.Organization.private
HResult : -2147467261
CategoryInfo : NotSpecified: (:) [Update-MgOrganizati…ight_UpdateExpanded], NullReferenceException
FullyQualifiedErrorId : Microsoft.Graph.PowerShell.Cmdlets.UpdateMgOrganizationSettingItemInsight_UpdateExpanded
InvocationInfo :
MyCommand : Update-MgOrganizationSettingItemInsight_UpdateExpanded
ScriptLineNumber : 1
OffsetInLine : 1
HistoryId : 10
Line : Update-MgOrganizationSettingItemInsight -OrganizationId "5774927f-fdea-49cc-ba30-a7216215f9cd"
-DisabledForGroup "45bca0af-7dbd-4a50-9637-cef4fadebeb1" -IsEnabledInOrganization
PositionMessage : At line:1 char:1
+ Update-MgOrganizationSettingItemInsight -OrganizationId "5774927f-fde …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
InvocationName : Update-MgOrganizationSettingItemInsight
CommandOrigin : Internal
ScriptStackTrace : at Update-MgOrganizationSettingItemInsight, C:\Users\brianja\Documents\PowerShell\Modu
les\Microsoft.Graph.Identity.Organization\0.9.1\exports\v1.0-beta\ProxyCmdletDefinitions.ps1: line 5796
at , : line 1
PipelineIterationInfo :
Activity
peombwa commentedon Aug 14, 2020
Brian T. Jackett (@BrianTJackett) Thanks for reporting this client. This is a bug cause by the code generator, AutoREST should always default
AdditionalPropertiesparameter an empty HashTable.A temporary workaround is to call
Update-MgOrganizationSettingItemInsightwith a-BodyParameterparameter like this:, or pass an empty
-additionalPropertiesparameters like thisBrianTJackett commentedon Aug 15, 2020
Thanks for the confirmation. I had a feeling it was something wrong with one of the defaults for a hashtable. Will use the workarounds suggested.
peombwa commentedon Oct 29, 2020
Closing since this has been fixed in v1.1.0 . Use
Update-Module Microsoft.Graphto update.