8

I wanted to check account who created list view in Sharepoint 2013

1
  • Please provide more information, like how do you want to get the account, programmatically or in UI, etc. Jan 20, 2016 at 7:01

2 Answers 2

7

You cannot get the information who a view created because it's not cover by the object model. The SPView object doesn't store a property for modified or created. To get the information all you can do is to get the information from the file. So for the view "All Items" you need to request the file allitems.aspx.

The SPFile object stores the "Created", "Created by", "Modified" and "Modified by" values.

The PowerShell Script looks like this:

# define variables for script
$SiteUrl = "http://yourserver/sites/yoursite"
$viewurl = "http://yourserver/sites/yoursite/Lists/customlist/AllItems.aspx  "

$targetUrl = Get-SPWeb -Identity $SiteUrl
if ($targetUrl -ne $null)
{
    $targetFile = $targetUrl.GetFile($viewurl)

    if($targetFile.Exists)
    {
        Write-Host "Created By: " $targetFile.Author
        Write-Host "Modified: " $targetFile.TimeLastModified
        Write-Host "Modified By: " $targetFile.ModifiedBy
        Write-Host "Created: " $targetFile.TimeCreated
    }
    else
    {
        Write-Host "File doesn't exist"
    }
}

Hope this helps ! Source

0
4

As you have tagged SharePoint Apps, You need the client side solution I guess. Following is the REST API solution.

@Bhaskar already mentioned that SPView does not store the info who has created it. But when we create a view, SP creates a file like viewName.aspx. We can get this file path by following request.

/_api/web/lists/getByTitle('List Name')/Views?$select=ServerRelativeUrl

It will return the ServerRelativeUrl's of all views. Now if we know the ServerRelativeUrl of a view, then we can find all information (Author, ModifiedBy) by following request

/_api/web/getfilebyserverrelativeurl('/Lists/ListName/AllItems.aspx')?$expand=Author

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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