You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following sample give en empty wiki page markup while the web part presents on the page.
The following web parts are affected:
ScriptEditorWebPart
ListViewWebPart
There might be more as well, need to be checked.
using System;
using System.Collections.ObjectModel;
using System.Diagnostics;
using Microsoft.SharePoint;
using SPMeta2.BuiltInDefinitions;
using SPMeta2.Definitions;
using SPMeta2.Definitions.Webparts;
using SPMeta2.Enumerations;
using SPMeta2.Services;
using SPMeta2.SSOM.DefaultSyntax;
using SPMeta2.SSOM.Standard.Services;
using SPMeta2.Syntax.Default;
namespace listviewwebparttest
{
class Program
{
static void Main(string[] args)
{
var consoleUtils = new ConsoleUtils();
consoleUtils.WithSSOMContext(args[0], (site, web) =>
{
var ssomProvisionService = new StandardSSOMProvisionService();
consoleUtils.TraceDeploymentProgress(ssomProvisionService);
var model = SPMeta2Model.NewWebModel(webM =>
{
ListDefinition annualReviewsLibrary = new ListDefinition
{
Title = "Annual Reviews",
Description = "A document library.",
TemplateType = BuiltInListTemplateTypeId.DocumentLibrary,
Url = "m2AnnualReviews"
};
ListViewDefinition pool = new ListViewDefinition
{
Title = "Test",
Fields = new Collection<string>
{
BuiltInInternalFieldNames.ID,
BuiltInInternalFieldNames.Title
}
};
ListViewWebPartDefinition listView = new ListViewWebPartDefinition
{
Title = "Annual Reviews Default View by List Url",
Id = "m2AnnualReviewsView",
ZoneIndex = 10,
ZoneId = "Main",
ListUrl = annualReviewsLibrary.GetListUrl(),
ViewName = pool.Title
};
WikiPageDefinition pageFacilityManagementTickets = new WikiPageDefinition
{
Title = PageNames.FacilityTicket,
FileName = PageNames.FacilityTicket + ".aspx"
};
webM.AddList(annualReviewsLibrary, list =>
{
list.AddListView(pool);
});
webM.AddHostList(BuiltInListDefinitions.SitePages, list =>
{
list.AddWikiPage(pageFacilityManagementTickets, f =>
{
f.AddListViewWebPart(listView);
});
});
});
ssomProvisionService.DeployModel(SPMeta2.SSOM.ModelHosts.WebModelHost.FromWeb(web), model);
});
}
}
public partial class ConsoleUtils
{
public virtual void TraceDeploymentProgress(ProvisionServiceBase provisionService)
{
provisionService.OnModelNodeProcessed += (sender, args) =>
{
Console.WriteLine(string.Empty);
Console.WriteLine(string.Empty);
var message = string.Format("Processed: [{0}/{1}] - [{2:00.0} %] - [{3}] [{4}]",
new object[]
{
args.ProcessedModelNodeCount,
args.TotalModelNodeCount,
100d*(double) args.ProcessedModelNodeCount/(double) args.TotalModelNodeCount,
args.CurrentNode.Value.GetType().Name,
args.CurrentNode.Value
});
Trace.WriteLine(message);
Console.WriteLine(message);
};
}
}
public partial class ConsoleUtils
{
public virtual void WithSSOMContext(string siteUrl, Action<SPSite, SPWeb> action)
{
// just a little check on URL, saves some typos
new Uri(siteUrl);
SPSecurity.RunWithElevatedPrivileges(delegate()
{
using (var site = new SPSite(siteUrl))
{
using (var web = site.OpenWeb())
{
action(site, web);
}
}
});
}
}
public static class PageNames
{
public const string FacilityTicket = "Facility Management Tickets";
}
}
The text was updated successfully, but these errors were encountered:
SubPointSupport
changed the title
LIstViewWebPart provision on wiki page give empty markup
Some web part provision on wiki page give empty markup
Oct 23, 2015
The following sample give en empty wiki page markup while the web part presents on the page.
The following web parts are affected:
There might be more as well, need to be checked.
The text was updated successfully, but these errors were encountered: