在sharepoint开发中经常遇到 自定义网站栏、内容类型,页面布局和模板页也会遇到,遇到机会就相对比较小。
首先新建一个空的sharepoint项目:
1)创建网站兰:
修改SiteColumns\Elements.xml文件如下:
<?xml version="1.0" encoding="utf-8"?> <Elements xmlns="http://schemas.microsoft.com/sharepoint/"> <Field ID="{76C140E1-D827-433B-AD38-257F9594B846}" Name="BenefitProvider" DisplayName="Provider Name" Group="Human Resources" Type="Text" Required="FALSE"/> <Field ID="{A1758D70-B479-469C-90BB-C3038ED42B15}" Name="BenefitProviderLogo" DisplayName="Provder Logo" Group="Human Resources" Type="Image" Required="FALSE"/> <Field ID="{5F516D92-969C-4661-81B9-C9210E2A2FDC}" Name="BenefitType" DisplayName="Benefit Category" Group="Human Resources" Type="Choice" Required="FALSE"> <CHOICES> <CHOICE>Medical</CHOICE> <CHOICE>Dental</CHOICE> <CHOICE>Vision</CHOICE> <CHOICE>Insurance</CHOICE> </CHOICES> </Field> <Field ID="{521D5F12-16BC-4E82-997C-F28933ABE59E}" Name="BenefitDescription" DisplayName="Benefit Description" Group="Human Resources" Type="HTML" RichText="TRUE" RichTextMode="FullHtml" Required="FALSE"/> </Elements>
2)创建内容内型
修改ContentTypes\Elements.xml文件如下:
<?xml version="1.0" encoding="utf-8"?> <Elements xmlns="http://schemas.microsoft.com/sharepoint/"> <!-- Parent ContentType: 文章页面 (0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF3900242457EFB8B24247815D688C526CD44D) --> <ContentType ID="0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF3900242457EFB8B24247815D688C526CD44D0086e87a8467684813ad2d89881b6da33d" Name="Benefits Information Page" Group="Human Resources" Description="Benefits Information page layout content type" Inherits="TRUE" Version="0"> <FieldRefs> <FieldRef ID="{76C140E1-D827-433B-AD38-257F9594B846}" Name="BenefitProvider"/> <FieldRef ID="{A1758D70-B479-469C-90BB-C3038ED42B15}" Name="BenefitProviderLogo"/> <FieldRef ID="{5F516D92-969C-4661-81B9-C9210E2A2FDC}" Name="BenefitType"/> <FieldRef ID="{521D5F12-16BC-4E82-997C-F28933ABE59E}" Name="BenefitDescription"/> </FieldRefs> </ContentType> </Elements>