0

I have the following CSOM code to update a field internal name:-

using (ClientContext context = new ClientContext("https://*****.sharepoint.com/sites/Intranet/"))
            {
                try
                {
                    context.Credentials = new SharePointOnlineCredentials("***@***.onmicrosoft.com", passWord);
                    var a =  context.Site.RootWeb.Fields.GetByInternalNameOrTitle("Confidentiality_x0009_");
                    a.InternalName = "Confidentiality";
                    a.Update();
                    a.UpdateAndPushChanges(true);

but i am getting this error:-

Suppression State
Error   CS0200  Property or indexer 'Field.InternalName' cannot be assigned to -- it is read only
2

You cannot change the internal name of a field once created. That is by design. You will have to delete and recreate the field.

  • thanks for the reply ... there is no way even using PnP? – John John Aug 28 '20 at 16:49
  • no there is no way, PnP internally makes CSOM call its just a wrapper. As i said you cannot change it. – Akshay Randive Aug 28 '20 at 16:50
0

Just like Akshay said, once the column is created the internal name is set and cannot be changed later. If you really need to have another internal name, you will need to delete the column and recreate it with a name your desire.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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