【发布时间】:2017-07-03 21:56:06
【问题描述】:
我尝试在 SharePoint 列表中创建包含元数据的项目。 其中一个元数据包含一个法语“ç”字符,它使共享点响应 500 错误,其中: 代码=-1,System.Text.DecoderFallbackException value=无法将索引 147 处的 Unicode 字符 [E7] 转换为指定的代码页。
using (var client = new SpWebClient("https://intranet/Gestion") { Credentials = CurrentNetworkCredential })
{
var payload = new JObject
{
["__metadata"] = new JObject { ["type"] = "SP.Data.ListeCommentaireGerantListItem" },
["Language"] = "Français (France)"
};
var requestUrl = $"/_api/web/lists/GetByTitle('{SHAREPOINT_LIST}')/items";
Dictionary<string, string> updateHeaders = null;
var r = client.ExecuteJsonWithDigest(requestUrl, "POST", updateHeaders, payload);
return Redirect("/");
}
spWebClient 定义为here,基本上它添加了所有需要的标头并在webclient 类中简化了身份验证。
我尝试在标题中添加“application/json; odata=verbose;charset=utf-8”,但同样的错误。
有什么帮助吗?
【问题讨论】:
标签: c# rest sharepoint