简体   繁体   English

在线 Sharepoint 中的 StackOverflow 异常

[英]StackOverflow Exception in Sharepoint online

I am trying to add new column value in share-point online using multiple threads.我正在尝试使用多个线程在线共享点中添加新列值。 But I am get a stackoverflow exception.但我得到一个stackoverflow异常。 Can you please help me.你能帮我么。 This is my code:这是我的代码:

try
{
    foreach (Microsoft.SharePoint.Client.ListItem item in listCol)
    {
        if (item.FileSystemObjectType == FileSystemObjectType.File)
        {
            if (!item["FileLeafRef"].ToString().Contains(".tmd"))
            {

                item[propertyName] = propertyValue;  // this line is cause of error
                item.Update();                       // this line is cause of error                     
            }
        }
    }
    ExecuteQueryWithRetry(clientContext);
}
catch (StackOverflowException ex)
{
    Logger.LogException(ex, "Adding Values", "CMM " + "Adding Values");
}

I tested the code snippet below to update file items' Title property in my side, it's working as expected:我测试了下面的代码片段来更新我身边的文件项的 Title 属性,它按预期工作:

            using (ClientContext ctx = new ClientContext("https://tenant.sharepoint.com/sites/dev/"))
            {

                ctx.Credentials = new SharePointOnlineCredentials(account, secret);
                ctx.Load(ctx.Web);
                ctx.ExecuteQuery();

                List targetList = ctx.Web.Lists.GetByTitle("Documents");
                ListItemCollection ItemCol = targetList.GetItems(CamlQuery.CreateAllItemsQuery());
                ctx.Load(ItemCol);
                ctx.ExecuteQuery();
                foreach (Microsoft.SharePoint.Client.ListItem item in ItemCol)
                {
                    if (item.FileSystemObjectType == FileSystemObjectType.File)
                    {
                        if (!item["FileLeafRef"].ToString().Contains(".tmd"))
                        {

                            item["Title"] = "TestTitle";  
                            item.Update();                       

                        }
                    }
                    ctx.ExecuteQuery();
                }
             }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM