Create sitefinity admin page

Posted by Community Admin on 04-Aug-2018 11:55

Create sitefinity admin page

All Replies

Posted by Community Admin on 02-May-2013 00:00

Hi all,

I'd want to add a sitefinity admin page to end of this : 
Dashboard Pages Content Design Administration XXXX

Also want to add an user control in this page. Can somebody show me how to do this in C#?

Thanks...

Posted by Community Admin on 03-May-2013 00:00

Hi Ozkan,

Sitefinity gives the possibility to manage your backend pages the same way you manage your frontend pages. This is done through the Sitefinity backend:
Administration->Backend Pages

Also you can install and take a look at our Sitefinity SDK.

Here is a code snippet which you can adapt to fit your needs:

PageManager pageManager = PageManager.GetManager();
 
var pageName = "Test page";
var pageId = Guid.NewGuid();
var pagaDataId = Guid.NewGuid();
 
// Get the parent node Id
var parentPageNodeId = SiteInitializer.SitefinityNodeId;
var pageGroupName = "Test Page Group";
var pageGroupGuid = Guid.NewGuid();
 
// Create the page
App.WorkWith().Page().GetManager().Provider.SuppressSecurityChecks = true;
App.WorkWith().Page()
.CreateNewPageGroup(parentPageNodeId, pageGroupGuid).Do(p =>
    
        p.Title = pageGroupName;
        p.UrlName = Regex.Replace(pageGroupName.ToLower(), @"[^\w\-\!\$\'\(\)\=\@\d_]+", "-");
    
)
.Done()
.CreateNewStandardPage(pageGroupGuid, pageId, pagaDataId)
.Do(p =>
    p.Title = pageName;
    p.Name = pageName;
    p.Description = pageName;
    p.UrlName = Regex.Replace(pageName.ToLower(), @"[^\w\-\!\$\'\(\)\=\@\d_]+", "-");
    p.ShowInNavigation = true;
    p.DateCreated = DateTime.UtcNow;
    p.LastModified = DateTime.UtcNow;
    p.Page.UIStatus = ContentUIStatus.Published;
    p.Page.HtmlTitle = pageName;
    p.Page.Title = pageName;
    p.Page.Description = pageName;
)
.CheckOut().Publish()
.SaveChanges();           
 
var createdPage = App.WorkWith().Page(pageId).Get();
if (createdPage != null)
    createdPage.ApprovalWorkflowState = "Published";
    App.WorkWith().Pages().SaveChanges();
 
var master = pageManager.EditPage(pagaDataId);
if (master != null)
    // Replace with the desired controll to add on the page
    var control = new Control();
 
    var pageControl = pageManager.CreateControl<PageDraftControl>(control, "Content");
    pageControl.Caption = "Caption";
    pageManager.SetControlDefaultPermissions(pageControl);
    master.Controls.Add(pageControl);
    master = pageManager.PagesLifecycle.CheckIn(master);
    pageManager.PagesLifecycle.Publish(master);
    master.ApprovalWorkflowState.Value = "Published";
    pageManager.SaveChanges();

Hope this helps. Greetings,
Boyko Nistorov
the Telerik team
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

This thread is closed