Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 25064

How to check list safety when iterating through Microsoft.SharePoint.Client.List collection

$
0
0

I'm re-using some code and adapting it for CSOM for a SharePoint app.

What I want to do, is to show a user all of the lists of a certain type on request. The problem is, if you don't check if a user has permissions for a list ahead of time, you'll get an exception.

I've figured out how to do this for Web objects, but haven't put the pieces together for List objects. Code follows:

                returnList.AddRange(from List oList in rootWebLists
                                    where oList.DoesUserHavePermissions(SPBasePermissions.ViewListItems) &&
                                    where oList.BaseTemplate == (int)ListTemplateType.Announcements
                                    select new SPListMeta(oList));

This line is the invalid one:

where oList.DoesUserHavePermissions(SPBasePermissions.ViewListItems)

What's the new way to do this?


Viewing all articles
Browse latest Browse all 25064

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>