I am trying to update the plan details through Microsoft Graph API. My project is MVC .Net 4. GET and POST request are good but when I tried to update the details of the plan, IF-Match header was mandatory in the request so I am sending ETAG value in the if-match section but keep saying IF-Match Value is invalid and sometimes says quoted wrong. help me.
These are some responses once I build in the order out the requests below 1) Error in/Home/EditPlanAction: The format of value 'W/\"JzEtUGxhbiAgQEBAQEBAQEBAQEBAQEBATCc=\"' is invalid.
2 & 3) Error in/Home/EditPlanAction: { "error": { "code": "", "message": "The If-Match header contains an invalid value.", "innerError": { "request-id": "e7744797-f0ac-45c6-a1a6-73dcd3838759", "date": "2019-05-03T21:03:24" } } }
if (method != HttpMethod.Get && method != HttpMethod.Delete && method !=
HttpMethod.Post && method != HttpMethod.Put)
{
string uri1 = uri.Replace("/details", "");
HttpResponseMessage foretag = await
ServiceHelper.SendRequest(HttpMethod.Get, $"{graphV1Endpoint}{uri1}",
accessToken);
//EntityTagHeaderValue entityTagHeaderValue = new
EntityTagHeaderValue((foretag.Headers.ETag.Tag));
//JsonConvert.SerializeObject(entityTagHeaderValue, jsonSettings);
string etag1 = foretag.Headers.ETag.Tag;
string etag2 = etag1.Replace("\"", "");
//string etag3 = "W/\\\"" + etag2 + "\\\"";
`request.Headers.Add("If-Match", "W/\\\"" + etag2 + "\\\"");`
`request.Headers.Add("If-Match", "W/\"" + etag2 + "\"");`
`request.Headers.Add("If-Match", "\"" + etag2 + "\"");`
`request.Headers.Add("If-Match", "\\\"" + etag2 + "\\\"");`
`request.Headers.Add("If-Match", etag2 );`