I have a SharePoint 2010 documents library that contains about 50 .aspx pages. I want to break inheritance on about 6 pages and set them to specific permissions.
I am able to get a page by numerical index but not by indexing with the page name. I know I can iterate through all the pages and look for a matching name/title field, but I was wondering if I was missing a way to use the known page name directly as an indexer.
For example:
$site = Get-SPSite http://website
$web = $site.RootWeb
$library = $web.Lists["MyPages"]
$page1 = $library.items[0]
$page2 = $library.items[12]
$page3 = $library.items[15]
etc.
If page1 is MyPage1.aspx I was looking for a way to get it like this:
$page1 = $library.items["MyPage1.aspx"]
(or something similar).