1

我想请教专家。有谁知道如何使用 REST (ListData.svc) 更新文档属性?

我可以使用波纹管代码更新列表项属性。但是在将波纹管用于文档库时出现 500 内部错误。

        HttpClientHandler handler = new HttpClientHandler();
        handler.CookieContainer = _cookieContainer;
        HttpClient cl = new HttpClient(handler);

        cl.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
        cl.DefaultRequestHeaders.IfMatch.Add(System.Net.Http.Headers.EntityTagHeaderValue.Any);

        JsonObject updateObj = new JsonObject();
        updateObj["title"] = JsonValue.CreateStringValue("titletest");
        updateObj["column01"] = JsonValue.CreateStringValue("columntest01");
        HttpContent jsonContent = new StringContent(updateObj.Stringify(), Encoding.UTF8, "application/json");

        HttpResponseMessage res = cl.PutAsync("http://xxxxx.sharepoint.com/_vti_bin/ListData.svc/announcements(1)", jsonContent).Result;
4

0 回答 0