SharePoint REST服务创建列表项错误缺少所需的WcfDataServices版本。

时间:2015-02-27 06:39:27

标签: rest sharepoint-2013

我正在尝试使用SharePoint Web服务将项目插入列表(只是带有标题列的基本自定义列表)。这是我正在使用的代码

function GetItemTypeForListName(name) {
        return "SP.Data." + name.charAt(0).toUpperCase() + name.slice(1) + "ListItem";
    }


        var itemType = GetItemTypeForListName(lisNameTitle);
        var item = {
            '__metadata': { 'type': itemType },
            'Title': 'another item check if works'
        };
        var jsonItem = JSON.stringify(item);
        alert(jsonItem);

        $http({
            method: "POST",
            url: reportDownloadSubmitDataUrl,
            contentType: "application/json;odata=verbose",
            data: jsonItem,
            headers: {
                "Accept": "application/json;odata=verbose",
                "X-RequestDigest": $("#__REQUESTDIGEST").val()
            }
        })

当我执行此代码时,在SharePoint端日志中出现以下错误

"缺少所需的WcfDataServices版本。有关详细信息,请参阅http://go.microsoft.com/fwlink/?LinkId=321931。"串

缺少WcfDataServices 5.6。

我的服务器上安装了SharePoint 2013 Service Pack 1.

1 个答案:

答案 0 :(得分:1)

我发现问题是由于$ http(Angularjs中的方法。当我直接使用jquery发布结果($ .ajax)时,它运行正常。