Ievgen
Ievgen

Reputation: 4443

Why my SharePoint web ContentTypes collection is empty?

I have default sharepoint web site. In events reciever of Pages library i can access my current web:

var web=properties.Web;

And i got very strange problem. web.ContentTypes collection is emtpy. I cannot get and access any content type there! When via website i see all content types for current web.

Why this ContentTypes collection is empty?

Upvotes: 2

Views: 894

Answers (1)

ErikE
ErikE

Reputation: 867

Try web.AvailableContentTypes.

It contains all content types that can be used on the site, rather than just the ones defined on this particular site.

See:

SPWeb.ContentTypes on MSDN

Upvotes: 2

Related Questions