Step1: First of all we will check the current site
permissions for the existing users and groups.
To do that we click on Site Actions, under this we select Site Permissions
Step2: When you click on Site
Permissions, you can see the existing
permissions to the site users and groups. We can see users have different kind
of permissions like Contribute, Design etc.
We want them all to have only read access to the site.
Step3: To achieve this
we will write a SharePoint Feature in Visual Studio 2012.
Visual Studio 2012 can be opened from Start menu( in admin mode).
Step4: Here we you will select New Project under Start
Page.
Select SharePoint as your project type in the
left panel. Then you will select the .NET
Framework 3.5 and select SharePoint
2010 Project under it. Now enter the name of the Project, Location &
Solution name in the lower panel.
Step5: When you click
ok after filling all the entries in the form then select the
desired site and the Type of solution
Then click on Finish. An empty SharePoint Project will be opened. In this under Solution Explorer you will see all the
components of your solution.
Step6: Under Solution
Explorer in Features right click on Feature1 and click on Add Event Receiver.
Now we write will our code
under Feature1.EventReceiver.cs
Step7: After writing the complete code we will deploy the
solution from Solution Explorer.
Step8: Now on the site, click on Site Actions-> Site Settings
Step9: A new page will be opened, click on Manage Site Features
Step10: A new page will be opened with all the site features
listed on it. Select our feature and
click on Activate
Step11: Once the feature is activated, you can check the site
permissions again.
Here we can see the
permissions for the users and groups have been modified. Now they have only Read access to the site, they can’t
make any changes to the site now.
No comments:
Post a Comment