Okay, so Sharepoint has the "Content Types" which are basically DB Table Schemas. They tell you that a SP List is basically a SQL Table, and the ContentType defines the Columns, to a degree. A SP Content Type may be extended from one of the base types, but you get the idea.
The problem is when you want to put a Custom Action on something that is of that type and it should apply to only that type, i.e. not all Lists, or all Forms.
Knowing how to do that programatically is a pain, because you need to find the internal ID of the ContentType to put in an Elements.xml file for a Custom Action:
<CustomAction
Location="EditControlBlock"
RegistrationId="0x023429892348209804323"
RegistrationType="ContentType"
....>
So, The RegistrationType tells Sharepoint the context for RegistrationId. When it's a ContentType, where do you get the ID of the Content Type? It's virtually impossible given any tool from Sharepoint. However, you can get it, if you go to:
Site Actions > Site Settings > Galleries > Site Content Types >
and select the Content Type you want for viewing you will see the Content Type Id in the URL as the "ctype" argument.
http://sites/site/_layouts/ManageContentType.aspx?ctype=0x02342989234820980432&Source=http%3A%2F%2Fsite........
Now, isn't that neat? Guess how long it took me to figure that out!
Geez.
If you know a better way, please post below.
No comments:
Post a Comment