2009-09-22 65 views
0

我需要将ASP.NET应用程序页面从程序集部署到/ Lists /(http://server/Lists)文件夹。以编程方式在/ Lists文件夹中部署aspx页面

  • 如何从装配好的页面中获取“物理”页面对象 ?

Project tree http://img17.imageshack.us/img17/4242/ss20090922150130.png

  • 我如何部署此页面模块 或FeatureReceiver? “Physycally”文件夹列表不存在。

感谢您的协助。

编辑:我想通过点击此按钮到底该怎么做SharePoint设计是这样做的: SharePoint Designer http://img121.imageshack.us/img121/5163/ss20090923160323.png

+0

你是不是想以编程方式创建一个页面?你想把这个页面放在一个列表中? – 2009-09-23 12:10:00

+0

不,页面不是以编程方式创建的 - 它驻留在程序集中。不过,我想以编程方式将该页面添加到共享点虚拟文件系统。 – 2009-09-23 13:01:52

回答

1

我不知道你是什么之后,但我猜你想创建一个页面并检查它的名单?

这段代码确实是在MOSS出版页:

using (SPWeb web = siteCollection.RootWeb) 
{ 
    PublishingSite publishingSite = new PublishingSite(siteCollection); 
    PublishingWeb publishingWeb = PublishingWeb.GetPublishingWeb(web); 

    // Article Page content type 
    SPContentTypeId articleContentTypeID = new SPContentTypeId("0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF3900242457EFB8B24247815D688C526CD44D"); 

    PageLayout[] layouts = publishingWeb.GetAvailablePageLayouts(articleContentTypeID); 
    PageLayout articlePageLayout = layouts[0]; 

    string pageName = "LegalInformation.aspx"; 

    SPQuery query = new SPQuery(); 
    query.Query = string.Format("" + 
    "<Where>" + 
    "<Eq>" + 
     "<FieldRef Name='FileLeafRef' />" + 
     "<Value Type='File'>{0}</Value>" + 
    "</Eq>" + 
    "</Where>" + 
    "", pageName); 

    // Does the file already exists ? 
    PublishingPageCollection pageColl = publishingWeb.GetPublishingPages(query); 
    if (pageColl.Count > 0) 
    { 
    return; 
    } 

    PublishingPage newPage = publishingWeb.GetPublishingPages().Add(pageName, articlePageLayout); 

    newPage.ListItem[FieldId.Title] = "This page title"; 
    newPage.ListItem[FieldId.PublishingPageContent] = "<P style='MARGIN-TOP: 20px'>Your content here</P>""; 

    newPage.Update(); 

    // Check in file 
    if (newPage.ListItem.File.CheckOutStatus != SPFile.SPCheckOutStatus.None) 
    { 
    newPage.ListItem.File.CheckIn(string.Empty); 
    } 

    // Publish file 
    newPage.ListItem.File.Publish(string.Empty); 
} 
+0

其实不是。感谢你的代码片断,也许有一天。但是,请参阅编辑的问题。 – 2009-09-23 13:04:50

+0

对于MOSS来说它确实有效,所以我会接受 – 2011-04-04 07:39:35

相关问题