none
Office Dev PnP Instantiate Default Webpart missing for Modern Team Sites RRS feed

  • Question

  • Dear all,

    Recently I've been involved on developing a custom program to deploy some functionalities on the new Modern Team Sites and I've been looking around the OfficeDevPnP library wich let me to do so many things using a simple console app.

    The problem I have is that I want to add on my new page under the modern team sites a Document Library view wich is possible to add from the UI but, unfortunately, not from the console app.

    My main question is that if anybody knows when will be available this Client Side Webpart from the library of if it's an alternative way to do what I want to do.

    I'm using a guide found on the dev forum here and also a official training channel from Microsoft has a video showing the possibilities of this library. Here is my main method:

    static void Main(string[] args)
            {
                string siteUrl = "xxx";
                string userName = "xxx";
                SecureString password = GetSecureString("Password");
    
                AuthenticationManager am = new AuthenticationManager();
                using (var cc = am.GetSharePointOnlineAuthenticatedContextTenant(siteUrl, userName, password))
                {
                    // Read existing page and add a Library control
                    ClientSidePage HomePage = ClientSidePage.Load(cc, "Home.aspx");                
                    var listWebPart = HomePage.InstantiateDefaultWebPart(DefaultClientSideWebParts.???);
                    
                    HomePage.AddControl(listWebPart);
                    HomePage.Save("HomePage.aspx");
                }
            }

    Thanks in advance for any help,

    Cheers,

    Marc

    Monday, August 28, 2017 2:29 PM

All replies

  • Hi Marc

    I'm also trying to achieve the same thing.

    Have you got any work around.?

    Appreciate your comment on this.

    Thank you

    ananda


    ananda

    Wednesday, April 17, 2019 1:12 PM