I'm creating some reports using power shell. In one report, I get ItemId and SiteId, the ItemType is 'Document'. but, do not know which web it is in. How can I get the item's version?
It seems have to use $item.Versions ($item is the item in the list). However, in order to get the list, have to get the $web. then loop each list for each web to find the item by using the item id. Does this work? is there any simpler way?
thanks
$webs = $site.AllWebs
foreach ($web in $webs)
{
foreach ($list in $web.Lists)
{
if($list.EnableVersioning)
{
get item from the list by item id
if it is not null, then found the item
... do other work
}
}
}