0x81020014一个或多个字段类型未正确安装。进入列表设置页面删除这些字段

发布于 2024-08-02 06:13:10 字数 1266 浏览 5 评论 0原文

在共享点中,当尝试更新列表时,我收到错误:

0x81020014One or more field types are not installed properly. Go to the list settings page to delete these fields.

正在创建的 Caml 是:

<Batch PreCalc='TRUE' OnError='Continue'>
    <Method ID='1' Cmd='Update'>
        <Field Name='ID'>4</Field>
        <Field Name='Flagged'>False</Field>
     </Method>
</Batch>

当我从 U2U 运行 Caml 时,它工作正常并且字段更新。当我在 VS 中调试代码时,出现上述错误。

创建和调用 Batch 的代码如下:

var ws = new com.freud.intranet.lists.Lists {
  Url = WebServiceHelper.wsContactsList,
  Credentials = WebServiceHelper.AdminCredentials
};
var batch = "<Batch PreCalc='TRUE' OnError='Continue'><Method ID='1' cmd='Update'><Field Name='ID'>" + contactID
            + "</Field><Field Name='Flagged'>" + flag + "</Field></Method></Batch>";
var document = new XmlDocument();
var stringReader = new StringReader(batch);
var xmlReader = XmlReader.Create(stringReader);
var node = document.ReadNode(xmlReader);
ws.UpdateListItems("Master Contact Joining Table", node);

为什么 caml 在 U2U 中工作而不是在 VS 中工作?

从谷歌搜索来看,问题可能是因为我没有使用内部名称,但它确实在 U2U 中运行,这就是我感到困惑的原因。

In sharepoint when trying to update a list I am getting the error:

0x81020014One or more field types are not installed properly. Go to the list settings page to delete these fields.

The Caml that is being created is:

<Batch PreCalc='TRUE' OnError='Continue'>
    <Method ID='1' Cmd='Update'>
        <Field Name='ID'>4</Field>
        <Field Name='Flagged'>False</Field>
     </Method>
</Batch>

When I run the Caml from U2U it works fine and the field updates. When I debug my code in VS I get the error above.

The code creating and calling the Batch is below:

var ws = new com.freud.intranet.lists.Lists {
  Url = WebServiceHelper.wsContactsList,
  Credentials = WebServiceHelper.AdminCredentials
};
var batch = "<Batch PreCalc='TRUE' OnError='Continue'><Method ID='1' cmd='Update'><Field Name='ID'>" + contactID
            + "</Field><Field Name='Flagged'>" + flag + "</Field></Method></Batch>";
var document = new XmlDocument();
var stringReader = new StringReader(batch);
var xmlReader = XmlReader.Create(stringReader);
var node = document.ReadNode(xmlReader);
ws.UpdateListItems("Master Contact Joining Table", node);

Why would the caml work in U2U and not in VS?

From Googling the problem could be because I am not using the intrnal names however it does run in U2U which is why I am confused.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

烟凡古楼 2024-08-09 06:13:10

使用列表的技巧是获取正确的 Web 服务位置,将引用的 Web 服务中的 URL 设置为正确的位置,并使用列表中定义的字段名称。

    private void ReadTaskandAddtask()
    {
        try
        {
            tcfifsharepoint.Lists listServiceBase = new tcfifsharepoint.Lists();

            // SharePoint Web Serices require authentication
            listServiceBase.Credentials = System.Net.CredentialCache.DefaultCredentials;
            listServiceBase.Url = "http://SPServer/Site/_vti_Bin/lists.asmx";

            String newIssueTitle = "Programmatically added issue 3";

            String listGUID = "FC519894-509A-4B66-861E-2813DDE14F46";
            String activeItemViewGUID = "C93FFC02-368B-4D06-A8AE-3A3BA52F4F0C";
             listGUID = "{FC519894-509A-4B66-861E-2813DDE14F46}";
             activeItemViewGUID = "{DCF35B63-F85C-463B-B1A1-716B4CF705C5}";

            // first check if item is already in the list
            XmlNode activeItemData = listServiceBase.GetListItems(listGUID, activeItemViewGUID, null, null, "", null, "");
            if (!activeItemData.InnerXml.Contains(newIssueTitle))
            {
                //*********************This is Working *********************************
                StringBuilder sb_method = new StringBuilder();
                sb_method.Append("<Method ID=\"1\" Cmd=\"New\">");
                sb_method.Append("<Field Name=\"Title\">Some Title 14</Field>");
                sb_method.Append("<Field Name=\"AssignedTo\">Name to assign</Field>");
                sb_method.Append("<Field Name=\"Status\">In Progress</Field>");
                sb_method.Append("<Field Name=\"Priority\">(3) Low</Field>");
                sb_method.Append("<Field Name=\"DueDate\">");
                sb_method.Append(DateTime.Parse(DateTime.Now.ToString()).ToString("yyyy-MM-ddTHH:mm:ssZ"));

                sb_method.Append("</Field>");
                sb_method.Append("<Field Name=\"PercentComplete\">.34</Field>");
                sb_method.Append("<Field Name=\"Body\">Something entered into the description field.</Field>");
                sb_method.Append("<Field Name=\"Author\">Your Author</Field>");
                sb_method.Append("<Field Name=\"Editor\">This is Modified By</Field>");
                sb_method.Append("</Method>");

                XmlDocument x_doc = new XmlDocument();

                XmlElement xe_batch = x_doc.CreateElement("Batch");
                xe_batch.SetAttribute("OnError", "Return");
                xe_batch.InnerXml = sb_method.ToString();

                XmlNode xn_return = listServiceBase.UpdateListItems("Task List Name", xe_batch);
        }
        catch (Exception e)
        {
            string sMessage = e.Message;

        }
    }

通过选择“设置”下拉菜单并选择“列表设置”项,您可以查看 SharePoint 列表中列表项(列)使用的内部名称。
进入“列表设置”后,单击一列,然后查看 URL 以查看“Field=Name”。这是您创建字段时需要使用的名称。

The trick to working with a List is to get the Web Service Location correct, the URL in the referenced web Service set to the correct location, and use the names of the fields as they are defined in the List.

    private void ReadTaskandAddtask()
    {
        try
        {
            tcfifsharepoint.Lists listServiceBase = new tcfifsharepoint.Lists();

            // SharePoint Web Serices require authentication
            listServiceBase.Credentials = System.Net.CredentialCache.DefaultCredentials;
            listServiceBase.Url = "http://SPServer/Site/_vti_Bin/lists.asmx";

            String newIssueTitle = "Programmatically added issue 3";

            String listGUID = "FC519894-509A-4B66-861E-2813DDE14F46";
            String activeItemViewGUID = "C93FFC02-368B-4D06-A8AE-3A3BA52F4F0C";
             listGUID = "{FC519894-509A-4B66-861E-2813DDE14F46}";
             activeItemViewGUID = "{DCF35B63-F85C-463B-B1A1-716B4CF705C5}";

            // first check if item is already in the list
            XmlNode activeItemData = listServiceBase.GetListItems(listGUID, activeItemViewGUID, null, null, "", null, "");
            if (!activeItemData.InnerXml.Contains(newIssueTitle))
            {
                //*********************This is Working *********************************
                StringBuilder sb_method = new StringBuilder();
                sb_method.Append("<Method ID=\"1\" Cmd=\"New\">");
                sb_method.Append("<Field Name=\"Title\">Some Title 14</Field>");
                sb_method.Append("<Field Name=\"AssignedTo\">Name to assign</Field>");
                sb_method.Append("<Field Name=\"Status\">In Progress</Field>");
                sb_method.Append("<Field Name=\"Priority\">(3) Low</Field>");
                sb_method.Append("<Field Name=\"DueDate\">");
                sb_method.Append(DateTime.Parse(DateTime.Now.ToString()).ToString("yyyy-MM-ddTHH:mm:ssZ"));

                sb_method.Append("</Field>");
                sb_method.Append("<Field Name=\"PercentComplete\">.34</Field>");
                sb_method.Append("<Field Name=\"Body\">Something entered into the description field.</Field>");
                sb_method.Append("<Field Name=\"Author\">Your Author</Field>");
                sb_method.Append("<Field Name=\"Editor\">This is Modified By</Field>");
                sb_method.Append("</Method>");

                XmlDocument x_doc = new XmlDocument();

                XmlElement xe_batch = x_doc.CreateElement("Batch");
                xe_batch.SetAttribute("OnError", "Return");
                xe_batch.InnerXml = sb_method.ToString();

                XmlNode xn_return = listServiceBase.UpdateListItems("Task List Name", xe_batch);
        }
        catch (Exception e)
        {
            string sMessage = e.Message;

        }
    }

You can see the internal names used for the list items(Columns) in the SharePoint list by selecting the "Settings" pull down and selecting the "List Settings" Item.
Once in the List Settings click on a column and then look at the URL to see the "Field=Name". That is the name you need to be using when you create your fields.

心碎无痕… 2024-08-09 06:13:10

我在代码中使用了错误的列表,因此出现了错误。

I was using the wrong List in the code hence the error.

人事已非 2024-08-09 06:13:10

此外,您还可以尝试打开 SharePoint Designer 并查看任何给定的列表表单或视图。

如果您稍微寻找一下,您会发现“列表 GUID”、“查看 GUID”以及后面的所有列表列。当使用 GetListItems 检索列表项并且需要使用“ows_”+ ColumnName 解析 XML 时,查看 SPD 特别有用。

Also, you can try opening up SharePoint Designer and taking a peek at any given list form or view.

If you hunt around a little while you will find the List GUID, View GUID, and following that all of the list columns. Looking in SPD is particularly useful when retrieving list items using GetListItems and you need to parse the XML using "ows_" + ColumnName.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文