Which version of SPMeta2 do you use? Use the following code snippet for your convenience. It shows all the details on SPMeta2 and SharePoint runtime used.
Optionally, provide SPMeta2 model in which issue occurs. That helps to identify the issue and provide the solution as far as we can.
/// your SPMeta2 definitions and model here
we have web parts that we add to the page. seems that webparts AuthorizationFilter property has been ignored and we have to develop a workaround like this - i did not see a similar code in the spmeta2 csom sources:
public static void FixAudienceTargeting(Microsoft.SharePoint.Client.File file,
SPMeta2.Definitions.WebPartDefinition webPartDefinition)
{
var ctx = file.Context;
var lwpm = file.GetLimitedWebPartManager(PersonalizationScope.Shared);
var webParts = lwpm.WebParts;
ctx.Load(webParts);
ctx.ExecuteQueryWithIncrementalRetry();
foreach(var wp in webParts)
{
ctx.Load(wp.WebPart, x => x.Title);
}
ctx.ExecuteQueryWithIncrementalRetry();
var theWebPart = webParts.ToArray().Where(x => x.WebPart.Title == webPartDefinition.Title).First();
theWebPart.WebPart.Properties["AuthorizationFilter"] = webPartDefinition.AuthorizationFilter;
theWebPart.SaveWebPartChanges();
file.Update();
ctx.ExecuteQueryWithIncrementalRetry();
}
Hello,
Brief description
Please provide short description covering two areas:
SharePoint API
Which version of SharePoint runtime do you use?
SPMeta2 API
Which version of SPMeta2 do you use? Use the following code snippet for your convenience. It shows all the details on SPMeta2 and SharePoint runtime used.
https://www.nuget.org/packages/SPMeta2.CSOM.Foundation-v16/1.2.140?_src=template
SPMeta2 model
Optionally, provide SPMeta2 model in which issue occurs. That helps to identify the issue and provide the solution as far as we can.
we have web parts that we add to the page. seems that webparts AuthorizationFilter property has been ignored and we have to develop a workaround like this - i did not see a similar code in the spmeta2 csom sources: