0

在远程客户端上,我正在尝试在共享点站点中创建一个新列表。现在,我正在构建一个 CAML 字符串并通过 http post 将其发送到我的共享点站点。我已经使用此方法更新列表项并创建 dws 文件夹,但我似乎无法让 AddList 工作。我收到一个错误“删除服务器返回错误:NotFound。”

这是我的 CAML:

        string soapEnv =
        "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
        "<soap:Envelope " + "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance" +
        "xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"" +
        " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" +
        "<soap:Body>" +
        "<AddList xmlns=\"http://schemas.microsoft.com/sharepoint/soap\">" +
            "<listName>" + listName + "</listName>" +
            "<description>" + "A Test list" + "</description>" +
            "<templateID>100</templateID>" +
        "</AddList>" +
        "</soap:Body>" +
        "</soap:Envelope>";
        return soapEnv; 

我使用以下设置在 http Post 中发送此内容:

        uri = "[my sharepoint site]/_vti_bin/lists.asmx";
        WebClient client = new WebClient();
        client.Headers["SOAPAction"] = "http://schemas.microsoft.com/sharepoint/soap/";
        client.Headers["content-type"] = "text/xml; charset=utf-8";
        client.Encoding = Encoding.UTF8;
        client.UploadStringCompleted += UploadStringCompleted;
        try
        {
            client.UploadStringAsync(new Uri(uri, UriKind.Absolute), "POST", CAML);
        }
        catch (Exception ex)
        {
            MessageBox.Show("Error in upload string async: " + ex.Message);
        }

有任何想法吗?我很确定这不是身份验证问题,因为我在同一个程序中使用了完全相同的方法来执行前面提到的功能。我要添加列表的共享点站点是一个测试站点,我在其中具有完整的读/写功能。

4

1 回答 1

0

哦!
肥皂的这一部分:信封标记:“xmlns:xsi=\” http://www.w3.org/2001/XMLSchema-instance “我有 XMLSchema-instance”而不是 XMLSchema \“ ”。
我需要额外的括号来完成那个字符串......

于 2010-03-05T18:31:02.967 回答