locked
Sharepoint2010 column wise & user permissions RRS feed

  • Question

  • Hi, 

    i have a custom list in sharepoint2010, with fields inclusing Approval1, Approval1Comments,Approval2,Approval2Comments,

    Now my requirement is create a workflow where as user1 can only enter data, 

    user2 can see approval1 filed also he can change the Approval1comments field,

    User3 can see entire list, Read & Write for both Approval1, Approval1Comments,Approval2,Approval2Comments.

    Could anyone pls help me on this,

    Thanks in advance.


    Rasna


    • Edited by Tom-Rasna Monday, February 18, 2013 6:40 AM
    Thursday, February 14, 2013 5:33 AM

Answers

All replies

  • HI,

    Field level permission is not possible in SharePoint lists/libraries. But you can hide the fields from the edit/new form based on the logged in user using Client Object Model and JavaScript. Check out this link to know how to hide fields. 


    Regards,
    SC Vinod
    Blog
    : http://sharesilver.wordpress.com/

    Thursday, February 14, 2013 6:10 AM
  • Hi vinod , thanks for your reply.

    But i want to hide only some columns to some people based on permission level,

    Thanks in adv.


    Rasna

    Thursday, February 14, 2013 6:18 AM
  • Well Tom,

    SC Vinod is right in that, field level permission is not something that can be configured on a custom lists. However, if you really need to implement your security model then technically it could be done using  list event receivers. You'd create a reciever on the item updating event and implement logic that determines if the current user can should be allowed to edit the item. In the logic you will need to compare the "before" and "after" properties to determine which fields have been changed and then based on that then determine if the current user should be allowed to make those changes. If the current user should not be allowed to make those changes then cancel the update operation and send back a message that explains why the operation was cancelled.  

    Hope this helps.


    Ras

    Thursday, February 14, 2013 6:23 AM
  • To hide fields/columns, your best off building a custom control for this (that derives from SPlist).

    Hope this helps.


    Ras

    Thursday, February 14, 2013 6:26 AM
  • Hi, 
    EvoMan, Thanks for reply, 
    Could you please give me some link for this kind of scenario or provide me any sample source code.

    Thanks in advance.



    Rasna

    Thursday, February 14, 2013 6:28 AM
  • Sure,

    Rasna, I am assuming that you've created custom code /user controls for SharePoint in the past. If you have not please let me know and I'll explain in more detail.

    To create a grid view user control that uses the SPListView control have a look at the following article http://blogs.msdn.com/b/powlo/archive/2007/02/25/displaying-custom-data-through-sharepoint-lists-using-spgridview-and-spmenufield.aspx 

    It is a guide that you can use to build what you need, I'd suggest using using a custom user control (Wrapped inside a web part) instead of a standard web page. It makes it easier for you to reuse later. 

    You will have to work out the logic required to determine which fields are visible based on the current logged in users credentials. You will have to create a few pages (either application pages or standard SP pages) for Creating, Reviewing, Updating and Deleting entries.

    All this in no means is a quick solution and you will need to test it throughly before releasing into production.

    Hope this helps.


    Ras

    Thursday, February 14, 2013 6:42 AM
  • Hi EvoLord, 

    Thanks for your reply

    The above link is not working ""resource not found error " i am getting .

    i have created a sharepoint custom list using OOTB.

    now i have to create a approval workflow(serial) , only 2 users can do approval.

    Then in the list , user1 can only enter data

    user2 can view approval status (which is done by him)

    user3 can view entire list (Read & Write ) 

    Could you please help me how can i achieve  this,

    Thanks in advance


    Rasna


    • Edited by Tom-Rasna Thursday, February 14, 2013 6:49 AM
    Thursday, February 14, 2013 6:49 AM
  • Sorry about that Rasna,

    Heres the link http://blogs.msdn.com/b/powlo/archive/2007/02/25/displaying-custom-data-through-sharepoint-lists-using-spgridview-and-spmenufield.aspx

    As I said in my previous post, this is not a simple task and if you've not done any custom development for SharePoint, this is going to be difficult for you.

    An alternate is for you to use client side code (jQuery) to hide the columns/fields in the list - you will also have to do this on the edit page as well. For the list you could using a content Query web part (inserted above the list) and add the relavent jQuery. For the edit page, you will have to use SharePoint designer to create a new edit page (based on the default) for the list and then add the relavent jQuery their. 

    Hope this helps


    Ras

    Thursday, February 14, 2013 6:58 AM
  • Rasna,

    your requirements are pretty simple. I don't think you need to hide any columns. If you've just got two approvers, And a super user. All you really need to do is use a Approval status field and a Approval comments field. You then have to create two views for the list. The first view should be filtered for any items approved by "[ME]" and make this view the default view. The second view should be an all items view, that you build explicitly for your superuser (private view).

    Hope this helps.


    Ras

    Thursday, February 14, 2013 7:05 AM
  • Hi , EvoLord

    i have gone through the link which u have provided 

    that is on SharePoint 2007, also in that i could not found anything related to permissions 

    thanks a lot for your replies 



    Rasna

    Thursday, February 14, 2013 7:21 AM
  • Rasna,

    You need to add a content editor web part to your New/Edit form of your list. Write a JavaScript code in the CEWP to check the user's permission and hide the fields accordingly. Look at this link for the code.


    Regards,
    SC Vinod
    Blog
    : http://sharesilver.wordpress.com/

    Thursday, February 14, 2013 9:19 AM
  • Hi Rasna,

    In my last post, I'd suggested that your requirements do not really need any dot net custom code. You should be able to achieve what you want using javascript/jquery - client side code and a content editor web part:

    "your requirements are pretty simple. I don't think you need to hide any columns. If you've just got two approvers, And a super user. All you really need to do is use a Approval status field and a Approval comments field. You then have to create two views for the list. The first view should be filtered for any items approved by '[ME]' and make this view the default view. The second view should be an all items view, that you build explicitly for your superuser (private view)."

    Could you let me know if this is something you have tried and found wanting?


    Ras

    Friday, February 15, 2013 4:43 AM
  • Hi.

    thank you for your reply,

    i have created a view using condition approved by [Me] , but in this view user2 can be able to write data but my requirement  is user2 should be read only .

    Also  i have given  contribute permissions to user1 , he can be able to create a view 

    Thanks in advance


    Rasna


    • Edited by Tom-Rasna Friday, February 15, 2013 5:49 AM
    Friday, February 15, 2013 5:42 AM
  • Hi 

    This link worked for me 

    http://spcolumnpermission.codeplex.com/



    Rasna

    • Marked as answer by Tom-Rasna Monday, February 18, 2013 6:41 AM
    Monday, February 18, 2013 6:41 AM