0

I've been recently working a lot of scripting with Powershell 2.0 towards SharePoint 2010, tasked with building various scripts that would for example print some information about 10,000 lists, as a part of a migration process. One of the requirements is to even get the size of those lists for us to have an idea about how big data we are really working with.

Now, getting the size of a document (file) from a SharePoint library is not my issue, I'm talking about the size of a list item (not document) from a SharePoint list (not library). Powershell did not seem to do the work, or? However, I switched to C# and I'm still having hard time getting it work. I'm pasting a screenshot of the relevant piece of code which does not work as one would expect:

enter image description here

The code is NOT written by me, would happily refer to the author but I have unfortunately not saved the links!

Is it even possible to get the size of an SPListItem?

  • There is no file associated with a custom list item. Hence the property is null. – Amal Hashim May 30 '16 at 14:07
0

As per my understanding there is no direct way to get the size of a custom list.

One option is to calculate each field size (Using SPField DisplaySize) and then multiplying that with total item count.

  • Thanks Amal! I agree with your comment. As per your answer, what Microsoft says about SPField.DisplaySize property is really nothing: msdn.microsoft.com/en-us/library/… Correct me if I'm wrong, this property does not seem to return what I need, in terms of the actual size of the field, it actually gets or sets the maximum numbers of characters allowed in the field. – Eliya Amanoeel May 31 '16 at 9:19
  • 1
    Yes that is what you need. The size bytes are already allocated irrespective if you have data in the field or not. – Amal Hashim May 31 '16 at 9:21
  • Let me give it a try and come back to you – Eliya Amanoeel May 31 '16 at 9:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.