Building a mvc app for sharepoint.
Anyone know how to programmatically add a twitter feed on modern page in sharepoint?
var availableComponents = page.AvailableClientSideComponents();
//get twitter webpart by guid
ClientSideComponent clientSideComp = availableComponents.Where(t => t.Id == "f6fdf4f8-4a24-437b-a127-32e66a5dd9b4").FirstOrDefault();
if (clientSideComp != null)
{
ClientSideWebPart twitterWebPart = new ClientSideWebPart(clientSideComp);
//set twitter props
dynamic json = JObject.Parse(twitterWebPart.Properties.ToString());
json["term"] = @"@microsoft" /*twitter name*/;
page.AddControl(twitterWebPart, page.Sections.First().Columns.Last());
}