1

I'm trying to use SPSecurityTrimmedControl element to show/hide the Add new item link in a SitePage DataView Web Part:

<td class="ms-addnew" style="padding-bottom: 3px">
    <SharePoint:SPSecurityTrimmedControl runat="server" Permissions="AddListItems" PermissionContext="CurrentList">
        <span style="height:10px;width:10px;position:relative;display:inline-block;overflow:hidden;" class="s4-clust">
            <img src="/_layouts/images/fgimg.png" alt="" style="left:-0px !important;top:-128px !important;position:absolute;" />
        </span>
        <xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime">&amp;nbsp;</xsl:text>

        <a class="ms-addnew" id="idHomePageNewItem" href="/GCP/_layouts/listform.aspx?PageType=8&amp;ListId={$listId}&amp;RootFolder=" onclick="javascript:NewItem2(event, &quot;/GCP/_layouts/listform.aspx?PageType=8&amp;ListId={$listId}&amp;RootFolder=&quot;);javascript:return false;" target="_self">Add new notice</a>
    </SharePoint:SPSecurityTrimmedControl>
</td>

As I understand it, this should display the link if the logged in user has permission to add items to the list, i.e. based on Permissions="AddListItems". Unfortunately the link remains hidden. It will display however if I sign on using my admin account so I know the element is working.

The user belongs to a SharePoint group that has Contribute permission for the list and if I navigate (as that user) to the list itself, the Add new item link is displayed and I can add a new item to the list.

I looked at the AllItems.aspx page definition for the list and the display of the Add new item link is controlled by a test:

<xsl:if test="$ListRight_AddListItems = '1' and (not($InlineEdit) or $IsDocLib)"></xsl>

I believe this is the ListView equivalent of the SPSecurityTrimmedControl I've defined above. What am I missing?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.