Modern audience in document library - updating audience in document library item from SPfX

Senior Member

We're building an SPX App to update audiences for documents stored in a library. We use modern audience.

 

We have succeeded with the following PowerShell approach (but we need the SPFx option for the app): 
Set-PnPListItem -List $listName -Identity 5 -Values @{"_ModernAudienceTargetUserField" = "18"}
Both Audiences ( _ModernAudienceTargetUserField) and IdAudiences (_ModernAudienceAadObjectIds) is updated with valid data.

 

However, we were unsuccessful when trying to update data in _ModernAudienceTargetUserField or OData__ModernAudienceTargetUserField from SPfx code. 

Is this type of approach even expected to be supported? 

What is the expected structure of the obect for Audience column? 

0 Replies