I am trying to add a web Part to a page in a program. I am able to
add the web part to the page. However, IsIncluded is always false.
Thus, the web part cannot be displayed. Any suggestions on this?
Thanks a lot,
Ricahrd
Code segment used for this:
SPSite mySiteCollection = new SPSite( siteURL );
SPWeb myRootSite = mySiteCollection.RootWeb;
SPWebPartCollection wpCollection = myRootSite.GetWebPartCollection(
aPageName, Microsoft.SharePoint.WebPartPages.Storage.Shared);
WebPart loginWP = new LoginWP.LoginWebPart();
loginWP.Title = "LoginWP";
loginWP.IsIncluded = true;
loginWP.IsVisible=true;
loginWP.Width="450px";
System.Guid guid = wpCollection.Add( loginWP );
wpCollection.SaveChanges( guid );
myRootSite.Update();
Do you know someone who can help? Share a link to this thread on twitter, or facebook.