Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/sharepoint/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C#:更新SharePoint库CSOM的项目_C#_Sharepoint_Csom - Fatal编程技术网

C#:更新SharePoint库CSOM的项目

C#:更新SharePoint库CSOM的项目,c#,sharepoint,csom,C#,Sharepoint,Csom,我想修改SharePoint网站中库项的值 这是我的代码: try { List list = myWeb.Lists.GetByTitle(comboBox1.Text); CamlQuery caml = CamlQuery.CreateAllItemsQuery(); ListItemCollection items = list.GetItems(caml); CTX.Load(items); CTX.ExecuteQuery(); fo

我想修改SharePoint网站中库
项的值

这是我的代码:

try
{
    List list = myWeb.Lists.GetByTitle(comboBox1.Text);
    CamlQuery caml = CamlQuery.CreateAllItemsQuery();
    ListItemCollection items = list.GetItems(caml);
    CTX.Load(items);
    CTX.ExecuteQuery();

    foreach (ListItem item in items)
    {           
        item["SEM_x0020_Modif_x0020_in_x0020_the_x0020_server"] = s;
        item.Update(); 
    }

    CTX.ExecuteQuery();
    AutoClosingMessageBox.Show("Done", "SharePoint", 20000);
}
catch
{
    AutoClosingMessageBox.Show(" Error ", "Error", 10000);
}

有时此代码工作正常,有时此代码不更新
。我做错了什么?

将ctx.executequery移动到for循环中,然后选中OK,我将尝试添加System.Threading.Thread.Sleep(1000);我测试了它,但仍然无法正常工作。将ctx.executequery移动到for循环中并选中OK,我将尝试添加System.Threading.Thread.Sleep(1000);我测试了它,但仍然不能正常工作