2

リストを更新しようとするとsharepointでエラーが発生します:

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 でコードをデバッグすると、上記のエラーが発生します。

バッチを作成して呼び出すコードは次のとおりです。

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 が VS ではなく U2U で機能するのはなぜですか?

グーグルでは、内部名を使用していないために問題が発生する可能性がありますが、U2Uで実行されるため、混乱しています。

4

3 に答える 3

2

リストを操作するコツは、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" を確認します。これは、フィールドを作成するときに使用する必要がある名前です。

于 2009-09-16T19:53:24.723 に答える
1

コードで間違ったリストを使用していたため、エラーが発生しました。

于 2009-08-19T15:48:56.113 に答える
0

また、SharePoint Designer を開いて、特定のリスト フォームまたはビューを覗いてみることができます。

少し調べてみると、List GUID、View GUID、およびそれに続くすべてのリスト列が見つかります。GetListItems を使用してリスト アイテムを取得し、"ows_" + ColumnName を使用して XML を解析する必要がある場合、SPD で検索すると特に便利です。

于 2010-01-07T20:49:08.913 に答える