I am getting an '“Input string was not in a correct format.” error after submitting the following POST call: any idea what I might be doing wrong here?
const addUserURL: string = newWeb + `/_api/web/sitegroups('${groupName}')/users`;
const userOpts: ISPHttpClientOptions = {
body: `{
"@odata.type": "SP.User",
"loginName": "${userKey}" // a.k.a.: "i:0#.f|membership|[email protected]"
}`
};
const addUserToGroupResponse: SPHttpClientResponse = this.props.context.spHttpClient.post(
addUserURL,
SPHttpClient.configurations.v1,
userOpts);
console.log("User has been successfully added to the security group.");
"@odata.type": "#SP.User",and check"loginName": "${encodeURIComponent(userKey)}"and check ? Ensure that theodata.typevalue is as in the previous comment