views:

419

answers:

2

When beginning to develop against SharePoint I did not fully understand all the ins and outs initially. I created a list definition (for a document library) and associated various custom actions to it. Unfortunately, I used the following for the list definition itself:

<ListTemplate...
...
Type="101"
...

And to register the CustomActions against the list:

<CustomAction...
...
RegistrationType="List"
RegistrationId="101"
...

Of course, this means that the custom actions are visible for all document libraries where the feature is activated which is undesirable behaviour. Also, there are lots of these document libraries that have been created from the above list definition in production.

What is the best way to fix this problem? My assumption is that I somehow need to change the "Type" attribute of the already existing lists, but I do not know how to do that. Can it be done via some direct SQL manipulation perhaps? Or is there a better way?

Note: I can see that the AllLists table has a column tp_ServerTemplate, is that the right thing to change?

A: 

From some quick initial testing it does look like changing the AllLists table does the trick.

So steps to resolve:

1) Change List Definition Type attribute to be a unique value (for example 11000)

2) Change the CustomAction RegistrationId attributes to be the same (11000)

3) Update the tp_servertemplate column in the AllLists table to be the new template Type (11000) for all the relevant lists.

zikoziko
bad idea. maybe it helped you this time but you might get burned in the future.
vitule
A: 

Modifying the SharePoint database is completely unsupported by Microsoft. Please do not do this on production!

Another option is to create a content type and associate the custom action with that. You may need to write a simple console application to iterate through your existing document libraries and add the content type so it is available for use. The existing documents that you'd like the custom action to apply to would need their content types changed as well.

Alex Angas