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 am creating custom lists(fields,CT,List Def and list Instance) A and B with visual studio. I have site column called "Status" i have used those column name in ListA and ListB. Suddenly i need to change ListB "Status" Field display name as StatusB, Since its site column after changing the display name will affect the listA display name too. How to resolve the issues? i need to update the field in list definition?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

In the second content type which you may have created for the ListB specify the Inherits attribute to False for ContentType property. An then in FieldRefs section rename the Status field.

<ContentType ID="CTID"
                   Name="CTName"
                   Group="CTGroup"
                   Description="CTDescription"
                   Inherits="FALSE"
                   Version="0">
        <FieldRefs>
      <FieldRef Name="Status" ID="IDOFSTATUSColumn" DisplayName="StatusB"/>
    </FieldRefs>
    </ContentType>

For more information you can refer http://sharepointnadeem.blogspot.in/2011/06/change-default-field-names-in-child.html

Here you go. This is how you can change the display name of the field using CSOM and make it a required field:

            ClientContext clientContext = new ClientContext("http://demo2010a:90");
            List list = clientContext.Web.Lists.GetByTitle("Products");
            clientContext.Load(list);
            clientContext.ExecuteQuery();
            var fields = list.Fields;
            clientContext.Load(fields);
            clientContext.ExecuteQuery();
            var field = fields.GetByInternalNameOrTitle("Status");
            field.Required = true;
            field.Title = "StatusB";
            field.Update();
            clientContext.Load(field);
            clientContext.ExecuteQuery();
share|improve this answer
    
i that possible to set the required field as true with this? also i need Object model code to update this i can't update scheme directly –  MarsMan Jan 2 '13 at 14:00
    
You had not mentioned that you needed to do it using CSOM. Anyways, so if I understand you correctly you want to change the fields display name only in the particular list and also want to make the field as required field? –  Nadeem Yousuf Jan 2 '13 at 14:08
    
I need to to do both –  MarsMan Jan 2 '13 at 14:32
    
Hey Ayyappan, please mark the question as answered if it answered your question. –  Nadeem Yousuf Jan 3 '13 at 6:01
    
This will work only in top level site it wont work for the sub sites hope u understood.Because it is in site feature. –  MarsMan Jan 3 '13 at 11:38
show 1 more comment

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.