Sharepoint 以编程方式在/Lists文件夹中部署aspx页面

Sharepoint 以编程方式在/Lists文件夹中部署aspx页面,sharepoint,deployment,sharepoint-2007,Sharepoint,Deployment,Sharepoint 2007,我需要将ASP.NET应用程序页从程序集部署到/Lists/()文件夹 如何获取“物理”页面对象 从汇编中生成的页面开始 如何将此页面部署为模块 还是按功能接收器?“物理”文件夹列表不存在 谢谢你的帮助 编辑:我希望通过单击此按钮完全执行SharePoint Designer正在执行的操作: 我不确定您到底想要什么,但我猜您想创建一个页面并将其签入列表 此代码段对MOSS中的发布页面执行以下操作: using (SPWeb web = siteCollection.RootWeb) {

我需要将ASP.NET应用程序页从程序集部署到/Lists/()文件夹

  • 如何获取“物理”页面对象 从汇编中生成的页面开始

  • 如何将此页面部署为模块 还是按功能接收器?“物理”文件夹列表不存在
谢谢你的帮助

编辑:我希望通过单击此按钮完全执行SharePoint Designer正在执行的操作:

我不确定您到底想要什么,但我猜您想创建一个页面并将其签入列表

此代码段对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);
}
使用(SPWeb=sitecolection.RootWeb)
{
PublishingSite PublishingSite=新的PublishingSite(siteCollection);
PublishingWeb PublishingWeb=PublishingWeb.GetPublishingWeb(web);
//文章页面内容类型
SPContentTypeId articleContentTypeID=新的SPContentTypeId(“0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF3900242457EFB8B24247815D68C526CD44D”);
PageLayout[]layouts=publishingWeb.GetAvailablePageLayouts(articleContentTypeID);
PageLayout Article PageLayout=布局[0];
字符串pageName=“合法信息.aspx”;
SPQuery query=新建SPQuery();
query.query=string.Format(“”)+
"" +
"" +
"" +
"{0}" +
"" +
"" +
“”页名);
//文件是否已经存在?
PublishingPageCollection pageColl=publishingWeb.GetPublishingPages(查询);
如果(pageColl.Count>0)
{
返回;
}
PublishingPage newPage=publishingWeb.GetPublishingPages().Add(pageName,articlePageLayout);
newPage.ListItem[FieldId.Title]=“此页面标题”;
newPage.ListItem[FieldId.PublishingPageContent]=“这里有您的内容”

”; Update(); //签入文件 if(newPage.ListItem.File.CheckOutStatus!=SPFile.SPCheckOutStatus.None) { newPage.ListItem.File.CheckIn(string.Empty); } //发布文件 newPage.ListItem.File.Publish(string.Empty); }
您正在尝试以编程方式创建页面吗?是否要将此页面放入列表中?不,该页面不是以编程方式创建的-它位于程序集中。但是,我希望以编程方式将该页面添加到sharepoint虚拟文件系统。实际上不是。感谢您提供代码片段,也许有一天会提供。不过,请参阅编辑后的问题。