Forum Discussion
Rest API Error:"The parameter Members does not exist in method AddTenantTheme"
The call reaches AddTenantTheme, but the request body does not match the method contract. In the shown script, themeJson references $jsonBody, yet that variable is never created from $colorPairs. Build the legacy theme object with isInverted and palette properties, convert that complete object to compressed JSON, and pass the resulting string as themeJson. The outer body for AddTenantTheme must contain name and themeJson, then be serialized once before the POST. Microsoft’s REST sample follows that exact pattern. If your data is actually in the newer color-pair format, use AddTenantThemeAdvanced and include shouldParseColorPair instead. The supported PowerShell alternative is Add-SPOTheme with the palette hashtable, which avoids manually constructing the REST payload. Also make the call against the tenant’s primary geography; Microsoft documents that tenant theme administration is not supported from a satellite geography. After correcting the object, inspect the final body to confirm themeJson contains a JSON string rather than null.
- AmarDhanJul 26, 2026Copper Contributor
Yes, I tried all what you suggested but for some reason I couldn't get Invoke-PnPSPRestMethod to work.
Strangely, I was able to get it to work when I used REST api directly but couldn't get it to work using
Invoke-PnPSPRestMethod in powershell.