Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

We have a list with around 900 items, and recently the end-users decided to enable "Audience Targeting" on it. This added a new Audience Targeting column. The users now want to assign a default audience to many of the fields, and obviously they do not want to go through the entire collection and change them one by one. We tried to edit this column using a datasheet view without success (we got a nice "The selected cells are read-only" error -- I assume it is because the field type..)

Is it any way I could "batch update" that column in some of the items using a PowerShell script? Any other way to accomplish this?

Many thanks in advance,

Jose Parra

share|improve this question
    
Jose - did you determine a way to do this? I've tried using direct query via Access and cannot update the field. Thanks. –  user11136 Oct 4 '12 at 15:59
add comment

1 Answer 1

up vote 0 down vote accepted

You can update using powershell.

$context = Get-SPServiceContext $site
$am = New-Object Microsoft.Office.Server.Audience.AudienceManager($context)
$item = $list.Items[1]
#Setting audience
$item["Target Audiences"] = $am.GetAudience("MyAudiences").AudienceID.ToString() + ";;;;"
#Setting SPGroup
$item["Target Audiences"] = ";;;;Home Owners,Home Visitors"

Look at this post for more info.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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