Welcome to MSDN Blogs Sign in | Join | Help

SharePoint : How to hide a field from the Edit Form?

I am not sure, how this can be achieved thro' UI. But here, Sharepoint Object model helps us.

localhost.Lists listService = new localhost.Lists();

            listService.Credentials= System.Net.CredentialCache.DefaultCredentials;

            XmlDocument xmlDoc = new System.Xml.XmlDocument();

            XmlNode ndUpdateFields = xmlDoc.CreateNode(XmlNodeType.Element, "Fields", "");

            ndUpdateFields.InnerXml = "<Method ID='1'>" +

                                                            "<Field ReadOnly='True' ShowInEditForm = 'FALSE' Type='Number' Name='_x0043_ol1' DisplayName='Col1'/>" +

                                                "</Method>";

            try

            {

                        XmlNode ndReturn = listService.UpdateList("Events", null, null, ndUpdateFields, null, null);

                        MessageBox.Show(ndReturn.OuterXml);

            }

            catch (Exception ex)

            {

                        MessageBox.Show("Message:\n" + ex.Message + "\nStackTrace:\n" + ex.StackTrace);

            }

 

Published Friday, April 07, 2006 1:36 AM by Karthikeyan
Filed under:

Comments

# re: SharePoint : How to hide a field from the Edit Form?

Friday, May 30, 2008 1:22 PM by Menerva

Great job, it really help but the thing is how to implement it in sharepoint.

what must i do to integrate the code in sharepoint.

please i need that info, if any one know how please contact me at younes.menerva@gmail.com

Anonymous comments are disabled
 
Page view tracker