2

the same site collection has two sites: Site A and B. In site A, there's a list named "A.1". In Site B, there's a list named "B.1". If I add a site column (in site collection level) named "contensOf_A.1" which will be a lookup to "A.1", will I be able to add it in list "B.1";

0

2 Answers 2

1

No, you won't be able to add a site collection level column that is a lookup to a list in site A. There isn't really any way to do this out of the box. If you really need to do it, there are some third party tools, try search for "cross site lookup" and you'll find some commercial or open source solutions. Or you could implement it as custom functionality yourself using JavaScript/JQuery.

Or, a better alternative, if you are using SharePoint 2010/2013 would be to consider using Managed Metadata, which you can make available across your entire farm.

1
  • I already have list A.1 and it's being used in lists in site "A". I guess I need a cross-site addon.
    – XristosK
    Sep 21, 2015 at 16:46
8

As Steven stated there is no way to do this OOTB but you can do it with powershell.

Get the lists from different Sites:

$targetWeb = Get-SPWeb http://sitecollection/site1/
$sourceWeb = Get-SPWeb http://sitecollection/site2/
$targetList = $targetWeb.Lists.item("Target List Name")
$sourceList = $sourceWeb.Lists.item("Source List Name")

Add the Lookup field on the target list.

$targetList.Fields.AddLookup("LookUpFieldName", $sourceList.id, "false")
$LookupField = $targetList.Fields["LookUpFieldName"]

Set properties on the new lookupfield on target list.

$LookupField.LookupWebId = $sourceList.ParentWeb.ID
$LookupField.LookupField = $sourceList.Fields["SourceField"].InternalName
$LookupField.Update();

The trick is to set LookupWebId to the SourceWeb's Id and LookupField to the source lookupfield of the SourceList.

1
  • 1
    Nice ! The question is how this field will behave in allitems.aspx and with purchased addon for filtering. I'll inform you.
    – XristosK
    Sep 21, 2015 at 16:58

Your Answer

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

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