1

I have a list, where I want to have a lot of columns with different name but identical type. The type shall be "choice" whith some predefined choices.

Edit: detailed explanation of my goal: I need to document the access rights on a sight collection, as there are several people in charge of administrative tasks which have to align their actions. So I'm building a single custom table with users/groups corresponding to rows and subsites as columns. There are additional columns holding the names and other descriptive datas on users and groups, but they need to be updated once, so they aren't in the focus now.

To document the access rights of a specific group on a certain subsite I made a column with the name of the specific subsite which provides a choice for each field allowing to select from the well known and some intermediate privilege levels. Everytime I generate a new subsite which breaks inheritance, the access rights shall be defined/documented here, by adding a new column of this type. Then I have to define this column for this subsite from scratch. This means:

  • add column
  • change column type to choice
  • add a description
  • add all choices
  • define the standard value

So this can be a lot of work if done manually for every column. And it's error prone, too. So I thought about having a template for these columns.

I tried:

  1. defining a site column and rename it when using it multiple times

  2. open the list in Access and make copies of columns

  3. trying to make copies of columns in QuickEdit

while 3 simply doesn't offer any opportunity to do what I want, I probably wasn't good enough to find the right ropes in Access for option 2. Option 1 seemed to work until I wanted to insert a second column. Then I had to realise that my site column apparently had been "consumed" by my first column in the list despite having it renamed.

So is there any easy way to produce identical columns?

1
  • I'm finding it hard to understand what you are trying to do here. Could you perhaps explain a bit more what your goals are?
    – user43832
    Commented May 25, 2016 at 8:42

2 Answers 2

1

This is not really a good use of a list. The number of columns in a list should ideally be fixed.

why don't you build your list with the following columns?

User/group, subsite, access rights

granted, you need to add the same user or group more than once (once for each subsite), but you could report the data in excel by using a pivot table.

And speaking of excel: if you really want to keep the layout with a column per subsite, I would say that keeping your table in Excel might be a more practical solution.

3
  • Why should the number of columns ideally be fixed? Because of system limitations?
    – Ariser
    Commented May 25, 2016 at 10:12
  • 1
    partly because of system limitations, but also because of practicallity. Adding a new column is time consuming, like you already found out. And by fixed, I don't mean that you can't add or remove columns once in a while. :-). Also, displaying your list on screen will become harder and harder as you add columns.
    – Erik Nell
    Commented May 25, 2016 at 10:22
  • Interesting. I did not think about the constraint called screen size in advance. You were dead on my weak spot. I'll probably switch to the scheme suggested by you.
    – Ariser
    Commented May 25, 2016 at 12:29
1

If all you want to do is create a whole lot of columns, Powershell is the way to go.

You can use this script to create a column.

$site = Get-SPSite -Identity $row.SiteCollectionURL
$web = $site.RootWeb

# Assign fieldXML variable with XML string for Site Column
$fieldXML = '*Your XML here*' 


# Create Site Column from XML string
$web.Fields.AddFieldAsXml($fieldXML)

# Dispose of Web and Site objects and close the loop
$web.Dispose()
$site.Dispose()
}

You may need to tweak this script if you want to have a csv file with the column names.

Reference: https://www.captechconsulting.com/blogs/bulk-creation-of-sharepoint-site-columns-and-content-types-with-powershell-part-1

2
  • Can this be changed from site column level to local list context?
    – Ariser
    Commented May 25, 2016 at 10:56
  • This looks as if I needed to have access to the SP server itself to perform this trick. So I think it is not applicable for me.
    – Ariser
    Commented May 25, 2016 at 12:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.