Filtering out lists that are not SharePoint libraries

The best way to filter out SharePoint lists when iterating the collection of lists is by Template ID.  However it’s not that easy to get the template ID.  Interestingly, GUIDs are somewhat less than random when generated by Microsoft for their internal products. For example, the Feature ID GUID’s last 3 digits is actually the Template ID:

$GUID = $list.TemplateFeatureId.ToString()
$TemplateID = $GUID.substring($guid.length-3)
if ($TemplateID -ne "101")
{
write-host "skipping non-DocLib List $($list.title)"
continue;
}

Leave a comment