Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I'd like to create a lookup column in my list (hopefully using OOTB functionality) that shows a column from another list. Sounds simple enough, but the available columns to choose to lookup from my source list only consist of Dates or Text types. The column I want to pull is of type Person or Group. I read that this might not be allowed, since it is like doing a "Lookup of a Lookup". Is there any way around this?

share|improve this question

2 Answers 2

up vote 1 down vote accepted

There is no way you can do this OOTB in SharePoint. So you have to do some coding to get your solution.

Here is a sample code which performs the operation you want.

     /// <summary>
    /// Create LookUp Column in Site Columns
    /// </summary>
    /// <param name="fieldName">LookUp Field Name</param>
    /// <param name="fieldTitle">LookUp Field Title</param>
    /// <param name="required">Field Required or Not</param>
    /// <param name="allowMultipleValues">Multiple Allowed or Not</param>
    /// <param name="sourceList">Source List of LookUp Column</param>
    /// <param name="destinationlist">Destination List of LookUp Column</param>
   /// <param name="sourceField">Source Field of LookUp</param>

    public static void CreateLookupField(string fieldName, string fieldTitle, bool required, bool allowMultipleValues, SPList sourceList, SPList destinationlist, string sourceField)
        {            
            try
            {
                destinationlist.Fields.AddLookup(fieldName, sourceList.ID, required);
                SPFieldLookup lookUpField = (SPFieldLookup)destinationlist.Fields[fieldName];
                lookUpField.AllowMultipleValues = allowMultipleValues;
                lookUpField.Title = fieldTitle;
                lookUpField.LookupField = sourceField;
                lookUpField.Update(true);
                destinationlist.Update();
            }
            catch (Exception ex)
            {

            }            
        }

If you have any doubt in this code then ask me.

share|improve this answer
    
There is actually a way to do it declaratively in SharePoint 2010, have a look here blogs.msdn.com/b/joshuag/archive/2008/03/14/… –  C. Marius - MVP Feb 11 '13 at 15:16

I did this with less coding in sharepoint 2010. Here's what I have:

  • List called PeopleList with columns "Person" and "Title".
  • Workflow called "CopyPersonFromTitle", which runs when an item is created/changed.
  • A list called CustomListWithLookup, which has a Lookup with the following configuration. Get Information From: PeopleList. In this column: Title. Allow multiple values: yes

CopyPersonFromTitle workflow:

If CurrentItem.title is empty  
Set CurrentItem.title to CurrentItem.Person (display name as string)
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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