如何以编程方式确定 SharePoint 列表的大小

发布于 2024-08-21 18:46:18 字数 401 浏览 7 评论 0原文

我在 sharepoint 中有一个 SPList 项目,我想找出该列表在磁盘上的大小。是否可以不遍历列表中的每个项目并尝试找出大小?

更新

下面是我认为如果我确实需要获取每个项目可以使用的代码:

        long listSize = 0;
        foreach (SPListItem item in list.Items)
        {
            listSize += item.File.Length;
        }

更新

我认为我需要仔细检查每个项目来计算出尺寸。您建议如何这样做?我需要获取文件大小、字段大小中的任何数据以及所保存的附加版本。

I have an SPList item in sharepoint and I want to find out the size on disk of the list. Is it possible without going through each item in the list and trying to find out the size?

Update

Below is the code I think I can use if I do need to get each item:

        long listSize = 0;
        foreach (SPListItem item in list.Items)
        {
            listSize += item.File.Length;
        }

Update

I think I will need to go through each item to work out the size. How would you recommend doing this? I need to get the file size, any data in the fields size and and additions versions held.

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

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

发布评论

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

评论(1

从﹋此江山别 2024-08-28 18:46:18

您可以执行 CAML 查询并检索所有列表项的文件大小。这样,您可以将返回的字段限制为文件大小,然后将结果 DataTable 中的所有文件大小相加。

本文 可以让您对使用 SharePoint 对象模型的 CAML 查询有一个很好的概述。

免责声明:我还没有尝试过这个,但我已经使用过 CAML,并且我看不出有任何理由这不起作用。

You could do a CAML query and retrieve all of the list item's file sizes. That way, you can constraint the returned fields to just the file size, and just add up all the file sizes in the resultant DataTable.

This article can give you a nice overview on CAML queries using the SharePoint object model.

Disclaimer: I've haven't tried this, but I have worked with CAML, and I don't see any reason why this wouldn't work.

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