SharePoint文档库中的负ItemCount [英] Negative ItemCount in SharePoint Document Library
问题描述
关于图书馆项目计数中的负数,该怎么办? ItemCount是一个只读属性,当它完全不正确时应该怎么办?
What can be done about negative numbers in library item counts? ItemCount is a read-only property, what are you supposed to do when it is drastically incorrect?
上周早些时候,我进行了一些测试,涉及将文件和文件夹从一个文档库复制和移动到另一个文档库.我将项目从我们的实际文档库转移到沙箱测试"库,在迁移到公共列表和库之前,该库用于运行各种对象模型和工作流测试.我注意到使用文件可以正常工作,但是当我复制其中包含文件的文件夹(使用SPFolder.CopyTo()
)时,测试库的项目计数实际上并未更新.由于此测试主要是在玩耍,因此我很少注意.
Earlier last week, I was doing some testing involving the copying and moving of files and folders from one document library to another. I was transfering the items from our actual document library to a sandbox "Test" library that I used to run all sorts of object model and workflow testing in before migrating to the public lists and libraries. I noticed that with files, things worked correctly, but when I copied a folder that had a file inside it (using SPFolder.CopyTo()
), the item count for the test library did not actually update. Since this testing was mostly playing around, I paid it little heed.
今天,我回到测试库中以测试其他工作流程(关于PDF转换).在那儿的时候,我决定删除上周离开的文件夹,因为我不再需要它了.到那时,我在所有网站内容"视图中看到列表的项目数降至-1.当我删除刚上传的新PDF时,它下降到-2!我什至用对象模型进行了检查...得到了库的实例,然后检查了ItemCount属性...瞧瞧它也是-2.
Today I was back in the test library to test a different workflow (regarding PDF conversion). While I was there, I decided to delete the folder I left last week since I didn't need it anymore. And that's when I saw the item count for the list drop to -1 in the All Site Content View. When I deleted the new PDF I had just uploaded, it then dropped to -2! I even checked with the object model... getting an instance of the library I checked the ItemCount property... lo and behold it was also -2.
是否有在后台运行的进程(类似于清理工作流历史的进程),该进程将纠正此类问题?还是希望程序员密切注意这种情况,并提出一些计算以补偿罚款"?
Is there any process which runs in the background, kinda like the one that cleans up workflow history, which will correct this kind of issue? Or is a programmer expected to keep watch for this kind of situation and come up with calculations to compensate the "count penalty", as it were?
推荐答案
网络上有很多与此类似的参考.例子: http://pholpar.wordpress.com/2008/03/15/negative-item-count-in-document-libraries/
There are lots of references on the web about similar things to this. Example: http://pholpar.wordpress.com/2008/03/15/negative-item-count-in-document-libraries/
您很可能会遇到SharePoint软件中的错误,或者您以MS从未打算的方式使用对象模型.
You are most likely running into bugs in the SharePoint software or you are using the Object Model in ways that MS never intended.
这篇关于SharePoint文档库中的负ItemCount的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!