IPage.AddControl does not recieve Pnp.Framework.Modernization.CientSideText as parameter

Copper Contributor

Hi,

 

I am trying to execute this code in the new Pnp.core framework because I would like to insert a client side text to a page. So, I found this code in a demostration from the old OfficeDevPnP.Core:

 

  using var clientContext = await _httpClientFactory.CreateSharePointClientContext(siteUrl);
            var page = clientContext.Web.AddClientSidePage(pageUrl + ".aspx", true);
            page.AddSection(CanvasSectionTemplate.OneColumn, 0);
            page.Save();

            //page.AddControl

            var section = page.Sections[0];
            
            var pageConent = new CientSideText() { Text = text };

            page.AddControl(pageConent, section, 0);
            page.Save();
            page.Publish();

 

 

For some reason, I got an error on line 12:

jlsuarezcabrera_0-1639032751231.png

So, I wa swondering if there is a new method to achieve this or Is there any way to add client side text to a page using these methods?

 

Thank you!

Jose Luis

0 Replies