3

I have a SharePoint survey configured to "Show user names in survey results = No". I need to run a report showing the name of each person who responded to the survey. I do not need to know who provided each response, I just need an overall collection of user names who responded. Since I have the survey configured to not show names, I only see "***" when using the PowerShell code below to lookup Created By details. I know I can go into the site settings and change "Show user names in survey results" back to Yes, and then get the list of names. However, this will also allow anyone with access to this site to see the names. I cannot allow others to see this.

Since changing this one setting from No to Yes would immediately show the name of each survey responder, I know this information is still stored somewhere and that each survey entry has something that ties to wherever this information is stored. Does anyone know where this is at?

Does anyone have other ideas for how I (the owner/admin of the page) can get the list of users without anyone else seeing the list of users?

PowerShell code:
$web = Get-SPWeb "http://team.company.com/sites/mysurvey"
$list = $web.Lists["survey1"]
$listItemCollection = $list.Items
foreach ($listItem in $listItemCollection) {
    write-host $listItem["Created By"]   
}

1 Answer 1

2

You could try this:

$web = Get-SPWeb "http://team.company.com/sites/mysurvey"
$list = $web.Lists["survey1"]
$list.ShowUser = $true
$list.Update()
$listItemCollection = $list.Items
foreach ($listItem in $listItemCollection) {
    write-host $listItem["Created By"]   
}
$list.ShowUser = $false
$list.Update()

Obviously the users would be visible while the powershell is running.

Alternatively you could go after the properties:

$listItem.Properties.vti_author

or

$listItem.Properties._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.