0

I created programmatically a list and a column. This column is a multiple line of text. I would like to also enable the option "Append Changes to Existing Text" programmatically. How to do that?

using (SPWeb web = site.OpenWeb())
            {
                // check if list exists
                SPList list = web.Lists.TryGetList(listTitle);

                if (list == null)
                {
                    SPListCollection listCollection = web.Lists;

                    // create new list
                    Guid gd = listCollection.Add(listTitle, "", SPListTemplateType.GenericList);
                    //listCollection[gd].Update();

                    // get new created archive log list and add columns
                    list = listCollection[gd];

                    // enable versioning
                    list.EnableVersioning = true;          

                    list.Fields.Add("Log", SPFieldType.Note, false);

                    SPFieldMultiLineText logField = list.Fields.GetField("Log") as SPFieldMultiLineText;
                    // DO SOMETHING TO ALLOW APPEND CHANGES TO EXISTING TEXT
                    // save columns
                    list.Update();
               }
           }
  • It can be set, but you'd need to enable versioning on the list first before enabling that property on the column. – Eric Alexander Jul 20 '15 at 14:06
0

Try this: logField.AppendOnly = true;

More info here.

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.