I'm trying to get all names of the personal views created by users for a list.

When I'm using the code

$views = $list.views
foreach($view in $views){
   Write-Host $view.Title       

It only lists the Public views so there is no point in using the condition $view.PersonalView.

Is there any way I can list all the views, including personal and public ones and then filter for only the personal ones?


I have never tried what @gautam-sheth has suggested... It may work although I assume you are running as an admin anyway?

Anyway what does work for me is to get the SPSite object with a user token as in the following function:

function Get-SPSiteWithToken {
    param (
    $site = New-Object Microsoft.SharePoint.SPSite($spSite, $userToken)
    $web = $site.OpenWeb($spWeb)
    $list = $web.Lists.TryGetList($spList)
    if ($list) {
        foreach ($view in $list.views) {
            if ($view.PersonalView) {
                Write-Host $view.Title
                #Do some stuff here

You then need to call it from something like:

$web = Get-SPWeb http://sharepoint/site/web
foreach ($user in $web.Users) {
    if (!$user.IsDomainGroup) {
        Get-SPSitewithToken "http://sharepoint/sites/sitecollection" "/relativeUrl/to/web" $user.UserToken "TargetListName"

Try using Run with elevated priviledges as below:

        $url = "https://sitecollectionurl"
        $web = Get-SPWeb -identity $url
        $list = $web.Lists["CustomList"]
        $viewCollection = $list.Views
        foreach($view in $viewCollection)
                Write-host "Personal View " + $view.Title 
                Write-host "Public View " + $view.Title 
  • No luck, it still shows only the views created by the System Admin Account. – kaz Feb 7 '17 at 9:08

Not the answer you're looking for? Browse other questions tagged or ask your own question.