S开发者_运维知识库harePoint newbie here.
I have a web part that is attached to SharePoint's edit page [EditForm.aspx]. How do I determine if the document being edited is linked to a content type that inherits, at any level of its inheritance chain, from a specified base type?
For instance, I have a base content type called "Document Base". I want this web part to take action if and only if the document being edited ultimately derives from this base type. How can I determine this from within my web part?
SPContentType wantedBase = web.ContentTypes["Document Base"]; if (listItem.ContentType.Id.IsChildOf(wantedBase.Id)) // Yes this is a child
精彩评论