简体   繁体   English

WSS 3.0站点供应

[英]WSS 3.0 Site Provisioning

Is there any way to do WSS 3.0 site provisioning? 有没有办法进行WSS 3.0站点配置? My client's requirement is attributes as variables that will be defined in XML format: Organization Name, Logo, Address, User and Role information. 我的客户要求是属性作为将以XML格式定义的变量:组织名称,徽标,地址,用户和角色信息。 The client should be able to install this web application to any WSS production server by just defining the attributes in the XML file. 客户端应该能够通过定义XML文件中的属性将此Web应用程序安装到任何WSS生产服务器。

Is it possible to to write a utility to parse that well defined XML and provision the site accordingly? 是否可以编写一个实用程序来解析定义良好的XML并相应地配置站点?

It's possible to provision sites from the object model, but creating entirely customized sites is beyond the scope of a single question. 可以从对象模型中配置站点,但创建完全自定义的站点超出了单个问题的范围。 To get you started, you should take a look at the SPWebCollection.Add as well as the SPSiteCollection.Add . 为了帮助您入门,您应该查看SPWebCollection.Add以及SPSiteCollection.Add

To create a site collection and some subsites into one of your web applications, you could use something like this: 要在您的某个Web应用程序中创建网站集和某些子网站,您可以使用以下内容:

var farm = SPFarm.Local;
var solution = farm.Solutions.GetValue<SPSolution>("YourSolution.wsp");
var application = solution.DeployedWebApplications.First();
var sites = application.Sites;
using(var site = sites.Add("/", "Root Site", "Description", 1033, "YOURTEMPLATE#1", "YOURDOMAIN\SiteCollectionAdmin", "Site Collection Admin", "admin@yourcompany.example")) {

    using(var rootWeb = site.RootWeb) {

        // Code customizing root site goes here

        using (var subSite = rootWeb.Webs.Add("SubSite", "Sub Site", "Description", 1033, "YOURTEMPLATE#2", false, false)) {

            // Code customizing sub site goes here

        }
    }
}

Yes, there are more than one. 是的,不止一个。

Take a look at SharePoint Solution Generator which is in Windows SharePoint Services 3.0 Tools: Visual Studio 2005 Extensions . 请查看Windows SharePoint Services 3.0工具中的SharePoint Solution Generator :Visual Studio 2005 Extensions

You may create a site with all requirements of yours (pages, lists, document libraries...) and then generate a VS project that will create a SharePoint feature with all of your site. 您可以创建一个包含您所有要求的网站(页面,列表,文档库......),然后生成一个VS项目,该项目将为您的所有站点创建SharePoint功能。 Then you may deploy that feature to any WSS production server. 然后,您可以将该功能部署到任何WSS生产服务器。

You may alter the VS project to implement the logic to read your attributes from an additional xml file. 您可以更改VS项目以实现逻辑以从其他xml文件中读取属性。

If the structure of your site is plain or you can save it as a template you may also write a small console application that reads the attribute xml file and create the site. 如果您的站点结构是普通的,或者您可以将其保存为模板,您还可以编写一个小型控制台应用程序,该应用程序读取属性xml文件并创建站点。

Create a regular solution, or use the aforementioned solution generator to generate the .wsp file. 创建常规解决方案,或使用上述解决方案生成器生成.wsp文件。 Then create a small console application, that expects the variables you mentioned as parameters. 然后创建一个小型控制台应用程序,它期望您提到的变量作为参数。 With the code listed above, provision the new sitecollection from that solution, and store the entered parameters (Company name etc.) in the site in a list, or in the SPSite.Properties propertybag, from which you can then read them in custom webparts etc.. 使用上面列出的代码,从该解决方案中提供新的sitecollection,并将输入的参数(公司名称等)存储在列表中的站点中,或者存储在SPSite.Properties属性包中,然后可以从中自定义webparts中读取它们等等..

CodePlex上提供的SharePoint数据填充工具允许您使用XML定义站点。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM