我正在尝试更新上传到共享点列表的文件的列值。
下面是我的代码。我有“ Content-Type”标头,但我不断收到此错误
HTTP标头Content-Type丢失或其值无效。
我在做什么错了?
var request = new RestRequest(Method.POST);
string jsonBody = String.Format("{{'__metadata': {{ 'type': '{0}' }}, '{1}': '{2}', '{3}': '{4}', '{5}': '{6}', '{7}': '{8}', '{9}': '{10}', '{11}': '{12}' }}", listType, headerName, newValue, headerName1, newValue1, headerName2, newValue2, headerName3, newValue3, headerName4, newValue4, headerName5, newValue5);
request.Resource = String.Format("web/lists(guid'{0}')/items", GUID);
request.AddHeader("X-Http-Method", "POST");
request.AddHeader("IF-MATCH", "*");
request.AddHeader("X-RequestDigest", DigestValue);
request.AddHeader("Accept", "application/json;odata=verbose");
request.AddHeader("Content-Type", "application/json;odata=verbose");
request.AddParameter("$filter", "(" + filter + " " + condition + " '" + filterValue + "')");
request.RequestFormat = DataFormat.Json;
request.AddParameter("application/json;odata=verbose", jsonBody, ParameterType.RequestBody);
Console.WriteLine(request.ToString());
IRestResponse response = _client.Execute(request);
return response.Content;