Hi,
I'm trying to add a webpart programmatically to a webpage.
Overally, it works well but I'm experiencing a weird issue when I'm trying to "embed" a discussion list into a page.
Usually, when I add programmatically a list or document library webpart into a page, it displays the page correctly with the html body and the webpart is added at the top or bottom of the page.
When I add programmatically a discussion list webart into a page, the result is different. When I open the page, I'm redirected to the discussion library instead of displaying the page with the webpart inside.
ex: I open https://siteremoved.com/migration/_layouts/15/start.aspx#/SitePages/Home.aspx
and it opens instead https://siteremoved.com/migration/_layouts/15/start.aspx#/Lists/Recent%20Announcements/AllItems.aspx
I tried tons of code during a few days, tons off different approaches and the result is always the same.
Most opf the code comes from https://github.com/OfficeDev/PnP/blob/master/Samples/Core.ModifyPages/ModifyPagesWeb/LabHelper.cs
I'm running out of ideas.
Can someone guide me to the right direction?
Thanks.
-- Emmanuel Dreux http://www.cloudiway.com