Link to home
Create AccountLog in
Avatar of 88brad
88brad

asked on

SharePoint Hidden Column

Hi,

I'm trying to hide a column in SharePoint 2007 in a document library.  The column needs to be hidden so that users cannot update the field, but it needs to be visible in the default view.  That is the easy part and I've successfully done that.

However, my problem arises when I try to edit a document via C# code using the SharePoint dlls.  My code is as follows:

foreach (SPFile document in docLibrary.Files)
{
     string name = document.Properties["MyColumn"];
}

when the column is hidden, it is null.  However, when it's optional, it returns the default value.

How can I hide this column from users but still be able to update it in code?  Thank you!
Avatar of Rafael I
Rafael I
Flag of Japan image

How are you hiding the column?
Avatar of 88brad
88brad

ASKER

Going into each content type the column is added for and selecting hidden instead of optional/required.
ASKER CERTIFIED SOLUTION
Avatar of Rafael I
Rafael I
Flag of Japan image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of 88brad

ASKER

Rawsteak's solution was where I was going if my solution didn't work.  Nomoho had the right idea but was missing some details.