Skip Ribbon Commands
Skip to main content

Quick Launch

Sandeep Nakarmi > Sandeep's Blog > Posts > SharePoint 2010: Lookup relation between lists in different sites
March 29
SharePoint 2010: Lookup relation between lists in different sites
Usually you create a lookup relation between lists that exist in the same site. But there might be cases where you might want to add some global data in one list and let the lists in other sites access that global data. Which means that the lists participating in a lookup relationship do not exist in same site. You can achieve this using Site Columns.
 
In SharePoint 2010, you can create a site column of type lookup. This column will lookup to a list that you choose and also pull back other projected fields that you’ve set. Then in the subsite, you can add this site column into a list using “Add from existing site columns”. The result is that, it will create a lookup relationship with the list of former site and also pull the projects fields. In this way you can have a lookup relation between two lists in different sites BUT in same site collection. Internally speaking, a lookup column in SharePoint has two key attributes:
 
a) List : The Guid of the list that is referenced through the lookup field. Can also have “Self” to indicate that it is self lookup. E.g. in Related Issues of Issue List.
 
b) ShowField : Specifies the field to be displayed in the list that is referenced through the Lookup field. If this attribute is not specified, the default is to display the value contained in the Title field. These two attributes are usually enough if the lookup column refers to a list in the same site. Whereas, when the column references a list in another site, like the one which would be created when using Site Column, another attribute in field schema comes into play. I.e. WebId
 
c) WebId: The guid of the site in which the referenced list exist. E.g. This is the field schema of a lookup column that references a list in another site.
<?xml version="1.0" encoding="utf-16"?> <Field Type="Lookup" DisplayName="LOOKUPSITECOLUMN" Required="FALSE" EnforceUniqueValues="FALSE" List="{63df740f-a6b5-4473-beea-d48025d0be27}" WebId="4d0962d5-c670-41a3-b8a3-3de3074665c2" ShowField="Title" UnlimitedLengthInDocumentLibrary="FALSE" Group="Custom Columns" ID="{8d0122eb-1b89-4250-93a0-639f3d3b23b3}" SourceID="{4d0962d5-c670-41a3-b8a3-3de3074665c2}" StaticName="LOOKUPSITECOLUMN" Name="LOOKUPSITECOLUMN" ColName="int1" RowOrdinal="0" />
  
  
There are no items to show in this view of the "Comments" list. To add a new item, click "New".
 

 New Comment

 

Items on this list require content approval. Your submission will not appear in public views until approved by someone with proper rights. More information on content approval.

Title 
Body 
Email:
Website:
  PHXUFY
Enter the number above