For most attribute types, you'll need to know how much space they take up (e.g. that an Option Set is 4 bytes), which you can really only do by investigation in SQL of an OnPremise implementation. Text fields have a specific maximum length that you can get
from the AttributeMetadata (though note that all strings are stored as Unicode, so 2 bytes per character).
Some other things to note:
- The AttributeMetadata includes virtual columns (e.g. for the name of lookup attributes), which you should exclude
- PartyList attributes are stored in the ActivityParty entity, and can have any number of values, so can't be simply summed
- Almost all attributes are nullable, and strings are nvarchars, so any calculation is at best the maximum possible space, rather than the amount any individual record takes up
Microsoft CRM MVP - http://mscrmuk.blogspot.com/ http://www.excitation.co.uk