Kentico体验事件-如何添加新事件



Kentico 13 MVC Core网站构建

成功安装:

  • Xperience.Core.Events.NET核心应用程序
  • NuGet
  • 伴侣package CMS
    application

事件被用于内网场景。寻找最佳方法,允许员工在不登录到Kentico CMS的情况下向日历添加新事件。(类似于Kentico 12 CMS门户引擎中的活动预订系统)

我在日历下面创建了一个带有事件字段的表单,但是无法找到填充下面所有表的插入语句:

  • 经验事件
  • CMS树
  • CMS文档

供参考:第一个MVC核心项目

Thanks-in-advance

查看NuGet包中包含的页面类型类和提供程序,您可以使用以下代码在Event Calendar页面下插入一个新页面。

var parentPage = EventCalendarProvider.GetEventCalendars()
.TopN(1)
.Culture("en-GB")
.Published()
.LatestVersion()
.FirstOrDefault();
var newEvent = new Event
{
EventName = "Test Event",
EventSummary = "Summary Text",
EventDescription = "Test Description",
EventLocation = "Somewhere",
EventStart = DateTime.Now,
EventIsAllDay = true,
// ...etc for the rest of the properties coming from the Kentico Form you've created.
};
newEvent.Insert(parentPage);

如果您还没有探索它,您可以使用BizFormItemEvents来拦截表单提交,并使用上面的代码插入一个页面。

最新更新