开发者

How to determine, from web part, if document's content type inherits from a specified base content type?

开发者 https://www.devze.com 2023-01-06 16:46 出处:网络
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 tha

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

0

精彩评论

暂无评论...
验证码 换一张
取 消