AL.Sharepoint.Core.Utils.SPUtils.ElevatedQueryOp C# (CSharp) Method

ElevatedQueryOp() public static method

public static ElevatedQueryOp ( string webUrl, string listName, Action op ) : void
webUrl string
listName string
op Action
return void
        public static void ElevatedQueryOp(string webUrl, string listName, Action<SPListItemCollection> op)
        {
            WebOpElevated(webUrl, web =>
            {
                SPList list = web.Lists[listName];
                if (list == null)
                    throw new ApplicationException(string.Format("List '{0}' cannot be found in '{1}' web", listName, webUrl));

                SPListItemCollection listItems = list.GetItems(new SPQuery());
                if (listItems == null)
                    throw new ApplicationException(string.Format("ListItemCollection '{0}' cannot be found in '{1}' web", listName, webUrl));

                op(listItems);
            });
        }