Вопрос

I am trying to add the column below via PowerShell

<Field 
    ID="{1920c575-d592-40eb-a163-5a302b78aa65}" 
    Type="Note" 
    DisplayName="1920c575d59240eba1635a302b78aa65" 
    StaticName="1920c575d59240eba1635a302b78aa65" 
    Name="1920c575d59240eba1635a302b78aa65" 
    Required="FALSE" 
    Hidden="TRUE" 
    Overwrite="TRUE" 
    ShowInNewForm ="FALSE" 
    ShowInEditForm="FALSE" 
    ShowInDisplayForm="FALSE" 
    xmlns="http://schemas.microsoft.com/sharepoint/" 
/>

However I get this error message:

Exception calling "AddFieldAsXml" with "1" argument(s): ""
At line:14 char:9
+         $destWeb.fields.AddFieldAsXml($fld.OuterXml)
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : SPException

All other site columns are created correctly but not this one. I know this is related to a metadata column but at this point I am not sure if it is related. I have another identical column except the GUIDs that gets created with out problem. Any idea how to troubleshoot this?

I am using the code from this site http://get-spscripts.com/2011/01/export-and-importcreate-site-columns-in.html

Это было полезно?

Решение

It seems that you have already created that field with that GUID.

What about if you export the columns? Do you get any field with that same GUID 1920c575-d592-40eb-a163-5a302b78aa65? If you don't see it, try to empty site's recycle bin and try to re-run the script.

Another possibilty, it's that as Internal Name is being repeated and SharePoint is adding one more character to make it unique, and that would overcome the limit of 32 characters limit. Try to change Internal Name to less characters.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с sharepoint.stackexchange
scroll top