Access denied to list created via ListTemplate in a feature
-
16-10-2019 - |
Question
I've created a feature to create an instance of a custom list. The provisioning part of my feature is:
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<ListTemplate
Name="ClientList"
Type="10001"
BaseType="0"
DisplayName="Client List"
Description="Templat for a list of clients."
/>
<ListInstance
Title="Client List"
Description="List of Clients."
TemplateType="10001"
Url="Lists/ClientList"
/>
</Elements>
The list seems to be created OK (if I check its settings, it has the correct content type and columns), but when I try to view it, I get the message:
Access denied. You do not have permission to perform this action or access this resource.
If I create the list through Central Administration, using the list template that I provisioned in the feature, I also get the Access denined message. If I create any other list, e.g. a Custom List, there's no problem. So I think something must be wrong with my list template, but I don't know what!
My schema.xml was produced by Imtech's list export stsadm command.
Solution
OK, I realised what the problem was -- I was missing the SecurityBits attribute from the ListTemplate definition.
With:
<ListTemplate
Name="ClientList"
Type="10001"
BaseType="0"
SecurityBits="11"
DisplayName="Client List"
Description="Template for a list of clients."
/>
the Access Denied issue goes away.