문제

I have a Document Library definition that I added to the solution. I want to include multiple content types for this Document Library: one that inherits from Folder and one that inherits from Document. I did search on Google but found nothing worthy. I also need this to be inside the Visual Studio project. I can add them manually in the interface just fine, but I have to do it each time I deploy the solution.

도움이 되었습니까?

해결책

Assuming that you already have the content types defined in your project you can do like below.

In your schema.xml, set the attribute EnableContentTypes to TRUE on <List /> element. Then declare the content types you want to use like below

<ContentTypes>
  <ContentTypeRef ID="0x01Contenttypeid1"></ContentTypeRef>
  <ContentTypeRef ID="0x01Contenttypeid2"></ContentTypeRef>
  <ContentTypeRef ID="0x01Contenttypeid3"></ContentTypeRef>
</ContentTypes>
<Fields>
   <! --List all your fields -->
<Fields>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 sharepoint.stackexchange
scroll top