Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I'd like people to be able to add items to a list, but for there to be 1 column in that list only visible/editable by the admin. Is this possible?

share|improve this question
    
How secure does this need to be? –  Steve P Oct 13 '10 at 18:42
add comment

3 Answers 3

If you're using a custom List Definition, you could do the follow (Warning, a lot of work with very little reward)

  1. Create a new class that inherits from ListFieldIterator
  2. Override the IsFieldExcluded Method to return true for your specific field if the current user isn't an administrator, and base.IsFieldExcluded for all others
  3. Create a custom RenderingTemplate that uses your ListFieldIterator instead of the default one
  4. Make your List Definition (or Content Type) user your new RenderingTemplate.
  5. Set SPField.ShowInViewForms to false for your Field.

This will stop the field showing up in Display/New/Edit forms for non-administrators, It will also stop you from adding the field to a view through the UI. I'm not sure about targeting a View to a group though.

As I said though, lots of work, depending on your requirements, probably not worth the reward.

share|improve this answer
add comment

There are a few ways to do this.

Here's a creative one that may work the best/easiest for you.

  1. Create your custom column on your list. Do not set it to required.
  2. Go to your list settings > Advanced.
  3. Enable managing content types.
  4. In the list settings, click on your content type to get to the fields.
  5. This is where you hide this field for all forms.
  6. Create a task list that only the admins have access to.
  7. Setup a workflow (using this new task list) that can be manually (and automatic on new items?) to request information for this field. When it gets the information and the task is completed, the workflow updates the field.
  8. When you're done, go back and turn of management of content types to clean things up.

Don't forget to disallow the normal users from creating their own private views on your list, otherwise they can add the hidden column and edit-in-datasheet and it'll defeat the purpose.

Other methods are a bit tedious, require custom code, and in many cases, if the users are smart enough and determined enough, they can find a way around it. Here's one:

  1. Create your custom field. Do not hide it as above.
  2. Edit the permissions on the list with a custom permission level that will only allow users to add, but not edit or delete items in the list.
  3. Edit the NewForm.aspx in SharePoint Designer and remove the custom field. This option customizes the NewForm, which isn't ideal if you expect that your fields will be changing - they won't be reflected in the NewForm and you'd need to edit again.
  4. (alternate for #3) Login to the server and, using powershell, set the ShowInNewForm flag on that field to false. This solves the issue in #3. If you add a new field to your list, it'll automatically show up on your NewForm.

Don't forget about disallowing the view creations as above.

That method doesn't work if your users need to be able to go back and edit the items - unless you use workflow to do that.

In some cases I've gone and created a secondary custom EditForm - just for the admins. It was the only form that actually had the field on it, while the settings on the field in the content type on the list was set to hidden.

Good luck! Tinker a bit and figure out what works best for you.

share|improve this answer
add comment

You can use the following approach:

  1. Assign a default value to the column.
  2. Create a custom view which has this column and target it only for Administrator. Rest views should not have this column.
  3. Create a new item list form and in there use a dataview web part which is targeted to admin. This form will have this column.
  4. Remove this column from all the other list forms.
share|improve this answer
    
thanks for the answer. but when a regular user edits an item, that field will still show up as editable, and have the value populated. –  Anonymous Sep 15 '10 at 16:12
1  
That is why i mentioned in step #4 to remove that column from all the other forms which a normal user encounters e.g. remove this field from the default NewForm.aspx or EditForm.aspx. This field should oly be visible via the targeted dataview web part hosted in a custom new item form. –  Vivek Sep 15 '10 at 16:42
1  
or if you do not wish to create a new form for administrator, then in the default new and edit form you can hide that field initially using JS or Jquery and only show that if the user is admin. From here you can check if the user is adminstrator or not; spservices.codeplex.com/Thread/View.aspx?ThreadId=80847 –  Vivek Sep 15 '10 at 16:56
    
hm. how do i edit EditForm.aspx and DispForm.aspx just for this list? i tried opening in SPDesigner but it did not display those form items. thank you for your help –  Anonymous Sep 15 '10 at 17:34
    
show 2 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.