Sunday, January 26, 2014

Access SPList object using web.Lists or web.GetList

Accessing SPList Object using web.Lists method

                   SPList listObj = webObj.Lists["DataTypes"];
                    int itemcount = listObj.ItemCount;

Accessing SPList Object using web.GetList method            
                   
                    SPList listObj2 = webObj.GetList(webObj.ServerRelativeUrl.TrimEnd('/') + "/Lists/DataTypes");
                    int itemcount2 = listObj2.ItemCount;

Some times we may change the list name after creating the list. In that case web.Lists accessing method gives error. So better to adopt GetList method when accessing lists.
                   


No comments:

Post a Comment

Image noise comparison methods

 1. using reference image technique     - peak_signal_noise_ratio (PSNR)     - SSI 2. non-reference image technique     - BRISQUE python pac...