1



I've got two Sandbox Solution projects in visual studio that I want to use in SharePoint online. The first project has a list and a lookupfield. The other project has an other list and I want to use the lookupfield from project 1 in project two. The only thing is, it doesnt show any content in the lookupfield in project two after deploying. First I couldn't use the lookup field anyway but after deploying on my testserver it became visible in project 2. Maybe it has got something to do with relations between projects?

Lookup field in project 1

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <Field
       ID="{e47e686c-a0f3-4c0d-b31a-e01443050c4f}"
       Name="LookupArtist"
       Title="LookupArtist"
       DisplayName="Artist"
       List="Lists/artistlist"
       ShowField="Title"
       Type="Lookup"
       Required="FALSE"
       Group="Custom Site Columns"
       Mult="FALSE"
       >
  </Field>
</Elements>

Listitem in project 2:

 <Field ID="{e47e686c-a0f3-4c0d-b31a-e01443050c4f}" Name="LookupArtist" Title="LookupArtist" DisplayName="Artist" List="{D449F2C3-C39E-4586-987D-6D469EA76646}" ShowField="Title" Type="Lookup" Required="FALSE" Group="Custom Site Columns" WebId="{f4086755-7faf-4e8b-80f5-3d9998877cb4}" SourceID="{f4086755-7faf-4e8b-80f5-3d9998877cb4}" StaticName="LookupArtist" ShowInDisplayForm="FALSE" ShowInNewForm="TRUE"></Field>
1

If you are deploying the field before the list instance (in the package), it will be broken. But, if you deploy Project1 a second time, the lookup will work, since the list will exist at that time.

I would suggest making sure your lookup is deployed after the Artists list instance, or moving it to project 2 altogether if possible.

Another thing I would suggest is deleting and re-creating your target site from scratch when you deploy lists - deployments tend to get tricky to debug when there are artifacts from previous deployments getting in the way. You can write a PowerShell script to do that, even in SharePoint online.

  • also, forget about Project 2 for the time being, and deploy project 1 to a fresh site, and verify the lookup works in site settings -> site columns. Once you get that consistently working (on one deployment), go ahead and deploy project 2. – Derek Gusoff Apr 26 '13 at 17:00
0

Take a look on this post: http://salvatoredifaziosharepoint.blogspot.co.uk/2012/07/sharepoint-2010-create-content-type.html

BTW You should write something like this:

<Field ID="{2AAD1044-89E9-4C88-8234-424A4B739C1C}" Name="LookupToList" DisplayName="LookupToList" StaticName="LookupToList"
   Type ="Lookup"
   Required="TRUE"
   Group="Custom Columns"
   Overwrite="TRUE"
   WebId="~sitecollection"
   EnforceUniqueValues="FALSE"
   List="Lists/MyList"
   SourceID="http://schemas.microsoft.com/sharepoint/v3"
   ShowField="MyLookupField" />

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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