SharePoint 2010 ECM Code Sample: Content Type Based Metadata
Use this SharePoint 2010 code sample to learn how to apply metadata based on a specified content type.
마지막 수정 날짜: 2011년 4월 20일 수요일
적용 대상: SharePoint Server 2010
Microsoft SharePoint Server 2010 includes metadata defaults based on columns, lists, and folders. However, there may be cases where you want to apply metadata based on a specified content type. For example, if you have a view where you want to order and group content types, you would want to apply metadata by content type.
In this Content Type Based Metadata code sample, some content types and a Grouping column are hard-coded. All of the content types have the Grouping column, and this column should be marked hidden so that users cannot edit it. When a new item is uploaded or edited, the Grouping column is set to the appropriate value.
When items of specified content types are uploaded, a specific column is updated. You can use the Grouping column in views to group items. There may be other cases where metadata should be applied based on the specified content type of an item.
이 항목에서 설명하는 SharePoint 2010 예제 코드는 코드 갤러리에서 다운로드할 수 있습니다.
Test this project on your development or test site.
Create a folder named Microsoft.SDK.Server.Samples, and then locate the ContentTypeBasedMetadata.zip file in the path C:\Program Files\Microsoft SDKs\SharePoint 2010\Samples, and unzip the sample code into the Samples folder.
In Microsoft Visual Studio 2010, open the ContentTypeBasedMetadata.sln file that is now located in the folder that you created in step 1.
In the Properties window, specify the site URL value of the absolute address of your development or test site (for example, http:///mysite/.) Ensure that you include the closing forward slash.
If it is not already present, add a reference to the following assembly to the project:
- Microsoft.SharePoint.dll
On the Build menu, click Deploy Solution. After the build completes, the solution is installed on your development or test site.
When items of the specified content type are uploaded, the event receiver is triggered and data in the Grouping column is refreshed.
Enterprise Content Management (ECM) Code Samples for SharePoint Server 2010
Managing Enterprise Metadata in SharePoint Server 2010 (ECM)
SharePoint 2010 ECM Code Sample: Managing Managed Metadata Dependencies