Monday, December 15, 2014

SharePoint 2013 issue to configure audience - Rule context is not detected. This page needs to be loaded from Audience page.

When we configure audience targeting for SharePoint hybrid search on one of the 2013 farm, we got the following error when configure the audience rule.

"Rule context is not detected. This page needs to be loaded from Audience page."
This issue seems to be introduced by the latest 2014 October CU. We have no such issue on SP1 with August CU but have this issue after 2014 Oct CU installed. This issue will also impacting to update the audience. You will get same similar error.

Before this issue fixed by Microsoft November KBs, the workaround is to use powershell to add audience roles. Here is the example to create audience and add roles.

$spsite = New-Object Microsoft.SharePoint.SPSite("http://sharepoit.mycompony.com");       
$spcontext = [Microsoft.Office.Server.ServerContext]::GetContext($spsite);       
$audmanager = New-Object Microsoft.Office.Server.Audience.AudienceManager($spcontext);

$audcollection = $audmanager.Audiences;

$audname = "O365 Hybrid Users";
$auddesc = "Office 365 hybrid test user group";
$newaud = $audcollection.Create($audname, $auddesc);
$newaud.AudienceRules = New-Object System.Collections.ArrayList;

$property = "DL";
$operator = "Member of";
$value    = "CN=O365.Users,OU=Distribution Lists,OU=Exchange,DC=na,DC=mycompany,DC=com";
$newrule  = New-Object Microsoft.Office.Server.Audience.AudienceRuleComponent($property, $operator, $value);
[Void]$newaud.AudienceRules.Add($newrule);
$newaud.Commit();


This is working for us as workaround but you might need to apply the November fix in the future. Please note this workaround only create the roles for audience, you will still get error when to set the audience compiling schedule.

Another issue is if you compile the audience by clicking the compile audience link manually, you do not see the new users added to the audience. However, if the scheduled job runs, it will compile the new users. We could not change the compiling schedule and even we enter the all necessary information, it will still display error like below.


We could need to work with Microsoft to resolve this.

No comments:

Post a Comment