1

I am working on a sharepoint online site collection, and using the UI i have created a new site column with the following name "HRAuthor", and i save the new column. so i got a site column which have its display and its internal name as "HRAuthor". then i wanted to modify the display name of the column to be "Author". so i went to the site column, i edit it, i chnage the name from "HRAuthor" to "Author", but i got this error message:-

The column name that you entered is already in use or reserved. Choose another name.

so i am not sure if i can overcome this problem using pnp script or other means. Now i want the internal name & static name to be the same (HRAuthor), but the display name to be "Author"..

  • Add a space to the end. So "Author " as the display name – theChrisKent May 17 '18 at 18:12
  • @theChrisKent i find another way, where i can create the site column using pnp script , in this case i can define the display name as Author, without getting any error!! – john Gu May 17 '18 at 21:49
  • Awesome, glad you got it solved. If you post your solution as an answer to your own question, that will help out others with similar issues. Thanks! – theChrisKent May 17 '18 at 22:44
1

You can add fields using the Add-PnPField method or using the Add-PnPFieldFromXml as below:

1) Using PnPField:

Connect-PnPOnline -Url "https://sitecollectionurl"
Add-PnPField -Type "User" -DisplayName "Author" -InternalName "HRAuthor"

2) Using PnPFieldFromXml:

Connect-PnPOnline -Url "https://sitecollectionurl"
$web = Get-PnPWeb
$xml = '<Field Type="User" Name="HRAuthor" ID="{27d81055-f208-41c9-a976-61c5473eed4a}" DisplayName="Author" Group="Test" Required="FALSE" StaticName="HRAuthor"/>'
Add-PnPFieldFromXml -FieldXml $xml -Web $web
0

Enter New name and run this in browser console

function ValidateAndSubmit() {  
       return true; 
    }
    function doesFieldNameConflict(strName) {
        return false; 
    }

You will be now able to save the name.

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.