Building a mvc app for sharepoint.

Anyone know how to programmatically add a twitter feed on modern page in sharepoint?

1 Answer 1

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());

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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