6

Recently I had a question asked of me regarding the internal field name limit in SharePoint for columns.

The user found that the same column created in a library vs. a list had different character limits.

I did some testing on this and validated that, in a regular custom list, columns added from the front end have their internal name truncated down to 32 characters after SharePoint encoding.

In a standard library, column internal names stop at 256 characters.

My questions is, is there documentation on this anywhere? Or is this just one of those undocumented 'features' of SharePoint? I can't see a logical reason why this would act like this.

  • I'd say this is undocumented. The reasoning behind it is probably database limits (that the column holding internal name has a max length of 32). The strange thing, that I don not understand, is why it would be be so much more for document library columns (I mean 255 is the max path length for documents, but that the column names should be affected is strange) – Robert Lindgren Aug 25 '14 at 13:47
  • 1
    Nice observation, but who will want the field name to be that large.. 32 is more than enough :) But for document libraries is quite strange.. – Arsalan Adam Khatri Aug 25 '14 at 13:58
  • can anyone tell me that what is the pre-fixed length for a field's display name ? please note : I am asking for "Display Names" not internal names. – Vishwas Goswami Aug 24 '15 at 9:49
3

Looks like there is no such Public documentation available or i have seen it.

You are correct and I test it and my results are same as yours...List filed name turncated to 32 characters but Document library having bigger limit.

I tested code from this Blog post.

32 Character Limit Of SharePoint List's Internal Field Name

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SharePoint;

public partial class Program
{
 static void Main(string[] args)
 {
     string siteName = "http://localhost";
     string listName = "Shared Documents";
     string fieldName = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789012345";

     Console.WriteLine("Adding SPField to a SharePoint Document Library and a List with name of '{0}'", fieldName);
     Console.WriteLine();
     Console.WriteLine("Get SPField info from updated SharePoint Document Library:");
     TestFieldName(siteName, listName, fieldName);
     Console.WriteLine();

     listName = "Announcements";
     Console.WriteLine("Get SPField info from updated SharePoint List:");
     TestFieldName(siteName, listName, fieldName);

     Console.Read();
 }

 private static void TestFieldName(string siteName, string listName, string fieldName)
 {
     using (SPSite site = new SPSite(siteName))
     {
         using (SPWeb web = site.OpenWeb())
         {
             SPList list = web.Lists[listName];
             if (!list.Fields.ContainsField(fieldName))
             {
                 list.Fields.Add(fieldName, SPFieldType.Text, false);
                 list.Update();
             }
             if (list.Fields.ContainsField(fieldName))
             {
                 SPField field = list.Fields[fieldName];
                 Console.WriteLine("Display name:\t'{0}' {1}Static name:\t'{2}'",
                     field.Title, System.Environment.NewLine, field.StaticName);

                 list.Fields.Delete(fieldName);
                 list.Update();
             }
         }
     }
 }
}
  • This does not provide an answer to the question – Robert Lindgren Aug 25 '14 at 13:52
  • ok i edit the answer....but he asked is there any documentation available for characters limit? – Waqas Sarwar MVP Aug 25 '14 at 13:59
  • 1
    With the edit it feels more like an answer to the question :) – Robert Lindgren Aug 25 '14 at 14:02
  • 1
    thanks, actually i missed that line which i should not. – Waqas Sarwar MVP Aug 25 '14 at 14:03

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.