I have two identical lists on the same site, with exactly the same columns that I would like to consolidate into one list. The reason I created two is because there are two groups of individuals that should only be able to view/edit the items of their respective group. We are looking to create a consolidated list with full list functionality that the managers can review. Is this possible?
2 Answers
Yes it is, but you will need to code a console application or perform this in powershell (harder in my opinion). (this is really if you want to fully merge them and them not to appear merged else look up linking sharepoint lists on google)
If you have visual studio and some .net coding experience this should be a simple task.
Some off the cuff code as an example and a start point only:
using (SPSite site = new SPSite(url))
{
using (SPWeb web = site.OpenWeb())
{
SPList usersList1 = web.Lists[strListName1];
SPList usersList2 = web.Lists[strListName2];
SPList mergeList = web.Lists[strMergeList];
..loop through list 1, check if item in list 2, if it isn't add to merge list
..loop through list 2, check if in merge list, if it isn't add to merge list
mergeList.Update();
}
}
There are plenty of ways you could optimise the process, and it depends totally on the data you need to check.
I would use a new list too collect the data 100% of the time in this situation in case something goes wrong. Belts and braces.
Good luck, if you need anything else shout.
-
-
The code is almost identical. $site = Get-SPSite url.. etc here is a nice little example of using lists in powershell robertkuzma.com/2012/09/… Commented May 20, 2013 at 13:38
-
I'm looking for the same solution..any other easy way OOB or by using scripts?– GeorgeCommented Aug 4, 2014 at 12:37
There is no OOTB way to present two separate lists as a single list with full list functionality for your managers.
If you want to keep the lists split in two you can show a consolidated view using Content By Query WebPart, but it'll by no means be full list functionality.
If you want to provide your managers with full list functionality for all the items, but limit the two groups to each their part, then a more appropiate solution might be:
- Create a single list
- Only give managers access to the list
- Create two folders
- Break inheritance on the two folders and give each group read/write access to their own folder