If the
lists items inherits permission or doesn’t inherit permission from the parent list
or site, then the list items(including Sub folders) will have a same “ScopeID”
Based on the ACL i.e permissions, the scopeID displays a number
For Full Control permission, the below program returns the number 15.
For View Only permission, the below program returns the number 1.
Sample code:-
using (SPSite site = new SPSite("SiteURL"))
{
using (SPWeb web = site.OpenWeb())
{
SPList list = web.Lists["List_Name"];
Console.WriteLine("List name = {0}", list.Title);
SPQuery query = new SPQuery();
query.ViewFields = "";
query.ViewAttributes = "Scope='RecursiveAll'";
SPListItemCollection items = list.GetItems(query);
foreach (SPListItem item in items)
{
Console.WriteLine("{0} --> {1}",item["Title"],item["ScopeId"]);
}
Console.ReadKey();
}
}
Based on the ACL i.e permissions, the scopeID displays a number
For Full Control permission, the below program returns the number 15.
For View Only permission, the below program returns the number 1.
Sample code:-
using (SPSite site = new SPSite("SiteURL"))
{
using (SPWeb web = site.OpenWeb())
{
SPList list = web.Lists["List_Name"];
Console.WriteLine("List name = {0}", list.Title);
SPQuery query = new SPQuery();
query.ViewFields = "";
query.ViewAttributes = "Scope='RecursiveAll'";
SPListItemCollection items = list.GetItems(query);
foreach (SPListItem item in items)
{
Console.WriteLine("{0} --> {1}",item["Title"],item["ScopeId"]);
}
Console.ReadKey();
}
}
No comments:
Post a Comment