I must use a list in a webpart and display some data/graph/etc based on the list content (notice: this is simplified, so please do not give it much importance).
To be used the list must have a precise structure: it must contain a set of fields with the expected types, some specific properties should be set (example: versioning, retention ecc). Problem is that some user can decide to modify the list without comunicate it (classical problem, and already happened in the past) or otherwise performs some sort of tampering (nice string column here, let's make it a number), thus giving the need for some sort of check that would validate the list to have all required caratteristic.
I am therefore wondering if I am stuck manually validating each element I need to with some custom logic or some better solution exists. Manual validation would mean browse all expectedfield and types, validate single settings one by one and such... which could be less than desiderable if the number of lists and aspect to check grows.
I am thinking that maybee I can do something like this with some creative use of the list xml schema, but no simple way comes to mind. Has anyone worked with this problem in the past? There is some simplier method tho achieve this? Any idea?
PS: if it can help, I am currently using SP 2010, so fell free to suggest solutions that won't work on 2007.
To answer to the suggestions that were posted. My precise obiective here is to find a way (assuming it exists) to avoid the need to check each "aspect" of the list that needs to be validated manually. So, to be clear, looping on the list of fields an check the types one by one is what I am trying to prevent.
Also, about a content type option, sorry if I didn't added this before but I cannot use them as now. Even if I could, then I would only have a check "I am still using the expected content type" which would not ensure that the content type hasn't been tampered (may sound paranoic, but structure tampering is exactly the problem that I am trying to resolve).
To further elaborate: if the list was a simple table, I could somehow store the metadata info for the table and then check if at runtime the table still match the metadata. Some framework actually provide ways to do this (nhibernate should have something, entity framework also provide basic checks) and would return me an error message with the differences found. Does SharePoint allow for something similar? Can somehow I use the list schema to check if the structure match the expected one? I have had a look at it but didn't found any pratical solution.