Scenario:
So many time I have been asked for a way where Contributors are allowed to reply or edit the existing item but should not be able to add any new entry.
User should be able reply to the discussion but not able to create a new one.
Workaround:
This is a no code workaround as users can still find a way to bring the New form back. Using DataView webpart we will hide the form for all the users except Administrators.
You should enable Content Approval to be able to control it fully.
Steps:
1. Create a new file with the name 'Information.webpart'
2. Paste the WebPart definition into the file and save it.
3. Now navigate to Site Action > Site Settings > WebPart Gallery
4. Upload the new webpart file here. ( There is a reason why you will need to do it this way, as you will not able to import this webpart using import option )
5. Now go to the list you want with restricted new item.
6. Click on new item and enter into Edit mode
( I know Edit page is missing but you need paste following command javascript:MSOLayout_ToggleLayoutMode(); into your browser address bar and hit enter to get the edit mode )Check Srini's post on how to toggle
7. Add the new webpart from the WebPart picker popup as 2nd Webpart on the page. Make sure new webpart is the 2nd webpart.Otherwise it will not work.
8. Exit Edit mode and now test it using visitor account.
WebPart Definition File:
<webParts>Configure:
<webPart xmlns="http://schemas.microsoft.com/WebPart/v3">
<metaData>
<type name="Microsoft.SharePoint.WebPartPages.DataFormWebPart, Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<importErrorMessage>Cannot import this Web Part.</importErrorMessage>
</metaData>
<data>
<properties>
<property name="MissingAssembly" type="string">Cannot import this Web Part.</property>
<property name="FireInitialRow" type="bool">True</property>
<property name="TitleIconImageUrl" type="string" />
<property name="HelpMode" type="helpmode">Modeless</property>
<property name="CacheXslStorage" type="bool">True</property>
<property name="ViewContentTypeId" type="string" />
<property name="Description" type="string" />
<property name="DataSourcesString" type="string" />
<property name="AllowZoneChange" type="bool">True</property>
<property name="ParameterBindings" type="string" null="true" />
<property name="PageSize" type="int">-1</property>
<property name="TitleUrl" type="string" />
<property name="ViewFlag" type="string" />
<property name="Xsl" type="string">
<xsl:stylesheet version="1.0" exclude-result-prefixes="rs z o s ddwrt dt msxsl" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:SharePoint="Microsoft.SharePoint.WebControls" xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer" xmlns:asp="http://schemas.microsoft.com/ASPNET/20" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" xmlns:o="urn:schemas-microsoft-com:office" xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema" xmlns:ddwrt2="urn:frontpage:internal"><xsl:output method="html" indent="no" /><xsl:decimal-format NaN="" />
<xsl:template match="/" xmlns:SharePoint="Microsoft.SharePoint.WebControls" xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer" xmlns:asp="http://schemas.microsoft.com/ASPNET/20">
<xsl:if test="not(ddwrt:IfHasRights(9223372036854775807))">
<script type="text/javascript" >
var div2 = document.getElementById('WebPartWPQ2');
div2.style.display = 'none';
</script>
You dont have permissions to create a new announcement.
</xsl:if>
</xsl:template>
</xsl:stylesheet>
</property>
<property name="NoDefaultStyle" type="string" null="true" />
<property name="Direction" type="direction">NotSet</property>
<property name="UseSQLDataSourcePaging" type="bool">True</property>
<property name="ListName" type="string" null="true" />
<property name="Hidden" type="bool">False</property>
<property name="DisplayName" type="string" />
<property name="SampleData" type="string" null="true" />
<property name="HelpUrl" type="string" />
<property name="ChromeType" type="chrometype">Default</property>
<property name="CatalogIconImageUrl" type="string" />
<property name="Height" type="string" />
<property name="DataFields" type="string" />
<property name="Default" type="string" />
<property name="ChromeState" type="chromestate">Normal</property>
<property name="DataSourceID" type="string" />
<property name="AllowClose" type="bool">True</property>
<property name="CacheXslTimeOut" type="int">86400</property>
<property name="AllowMinimize" type="bool">True</property>
<property name="AllowEdit" type="bool">True</property>
<property name="XslLink" type="string" null="true" />
<property name="Title" type="string">Information</property>
<property name="Width" type="string" />
<property name="ShowWithSampleData" type="bool">False</property>
<property name="ExportMode" type="exportmode">All</property>
<property name="AllowHide" type="bool">True</property>
<property name="AllowConnect" type="bool">True</property>
</properties>
</data>
</webPart>
</webParts>
1. You can edit the webpart to change the message user gets when he don't have access.
Articles:
Permission Values
0 comments:
Post a Comment