spmeta2 icon indicating copy to clipboard operation
spmeta2 copied to clipboard

Field type changing

Open vlad-ivanov-d opened this issue 8 years ago • 3 comments

Hello,

Do you support an availability of changing a field type? If yes, I've found a little bug: When I try to change the field type from "Text" to "Note" if fails with an exception:

field or property "NumberOfLines" doesn't exist

It looks like SPMeta2 tries to set a property "NumberOfLines" on "Text" type field and fails because of such property doesn't exist. This property is only actual for "Note" field type. So SPMeta2 should change field type from "Text" to "Note", and then set properties.

I use SharePoint 2016 On-Premises, CSOM, and SPMeta2.CSOM.Foundation v1.2.130

Field definition:

public static NoteFieldDefinition Coordinates()
{
    return new NoteFieldDefinition
    {		
        Id = new Guid("7d021794-f805-4a5f-ad10-95892b68a522"),
        Title = "Coordinates",
        InternalName = "Coordinates",
        Group = ".Test",
        AddFieldOptions = BuiltInAddFieldOptions.AddToAllContentTypes,
	EnforceUniqueValues = false,
	NumberOfLines= 6
    };
}

vlad-ivanov-d avatar Oct 17 '17 09:10 vlad-ivanov-d

No, unfortunately changing field types isn't supported right now.

There are a few tickets related to this:

  • https://github.com/SubPointSolutions/spmeta2/issues/1083
  • https://github.com/SubPointSolutions/spmeta2/issues/720

In a nutshell, it's a complex operation from both implementation and testing. Plus it might turn out in a data loss or corruption.

On a radar, might happen in a few month from now depending on the current workload.

avishnyakov avatar Oct 17 '17 23:10 avishnyakov

Oh, I see. It will be good. Thank you for so fast reply!

vlad-ivanov-d avatar Oct 19 '17 14:10 vlad-ivanov-d

Not a worry. We might do that mid-November.

avishnyakov avatar Oct 20 '17 08:10 avishnyakov