I am trying to do a post request via graph in a webpart - it keeps returning either fetch failed or 403. Can anyone please point in either a sample post request or how to fix
Ive confirmed via graph exploper that the api and post properties are correct and work. Just when I put in the webpart it fails :-(
this.props.context.msGraphClientFactory
.getClient()
.then((client: MSGraphClient): void => {
client
.api("sites/MYSITEID/lists/MYLISTID/items")
.version("v1.0")
.post(MYFIELDS, (err, res, success) => {
if (err) {
console.error(err);
return;
}
if (success)
{
console.log("success");
}
alert('Added');
})//closes
});