I have tried to set target audience property with the lines code:

#Create client context
$ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteUrl);
$ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Admin, (convertto-securestring $AdminPassword -asplaintext -force));

#Get current web
$spoWeb = $ctx.Web

#Get task list
$tasklist = $ctx.Web.Lists.GetByTitle("ABCTasks")

#Get hide view pages of the task
$taskpages = $tasklist.RootFolder.Files

#Get view taskpages of the task list
foreach($taskpage in $taskpages){
    #Write-Host $taskpage.Name
    if($taskpage.Name -eq "ABCUserView.aspx"){

#Get webpart manager from the task page
$wpm = $taskpage.GetLimitedWebPartManager("Shared")

#Get all of webpart of the task page
$webparts = $wpm.WebParts

#Get webpart and set target audience for the view
$webpart = $webparts[0]

$webpart.WebPart.Properties["AuthorizationFilter"] = "ABC User Group;;"


After execute the lines code and open the ABCUserView.aspx page, this page is blank. The list view webpart doesn't display with the current user and users of ABC User Group was targeted and I don't know why.


Try it as below:

$webpart.WebPart.Properties["AuthorizationFilter"] = ";;ABC User Group"


$webpart.WebPart.Properties["AuthorizationFilter"] = ";;;;ABC User Group"
  • It doesn't work. I have ever try it like that.
    – LazyCatIT
    Mar 17 '17 at 7:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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