Question

I want to get all the items of SharePoint list, but not the default columns data.

Basically, I want all the editable SharePoint list items that are displayed to user.

How can i do that using CAML Query and C#?

Was it helpful?

Solution

You can use this code snippet to determine if field is editable or not:

 public static bool IsFieldEditableInSP2010(SPField spField)
        {
            SPList spList = spField.ParentList;

            SPFieldLookup fldLookup = spField as SPFieldLookup;
            bool bCountRelated = fldLookup != null && fldLookup.CountRelated;
            bool bMcolLookup = fldLookup != null && fldLookup.IsDependentLookup &&
                                            fldLookup.LookupList != "Docs";

            SPFieldType t = spField.Type;
            if (t == SPFieldType.Computed ||
                t == SPFieldType.File ||
                t == SPFieldType.Recurrence ||
                t == SPFieldType.CrossProjectLink ||
                t == SPFieldType.AllDayEvent)
            {
                return false;
            }

            if (!spField.Reorderable &&
                !bCountRelated &&
                !(spField.ReadOnlyField && spField.Type == SPFieldType.User) &&
                !(bMcolLookup && !spField.Hidden) &&
                !spList.HasExternalDataSource)
            {
                return false;
            }


            if ((spField.ReadOnlyField && !bCountRelated && !bMcolLookup) ||
                spList.HasExternalDataSource)
            {
        if(spField.Type == SPFieldType.Calculated || spField.Type == SPFieldType.User)
            return true;

            }
            else
                return true;

            return false;
        } 
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top