Failed to install App for SharePoint error when provisioning Lookup columns

Failed to install App for SharePoint error when provisioning Lookup columns

I came across this error today while trying to provision some lookup columns as part of a SharePoint 2013 App I was creating. It seems in 2013 you can provision lookup columns declaratively in the Elements XML – this is great news! In 2010 you had to do a sort of halfway house with a combination of XML and some C# code to wire the column up.

The XML I was using for the lookup column was -

[code lang="XML"]<Field
ID="{87217691-FA03-4178-8823-DA9626F89FFF}"
Type="Lookup"
Name="TestLookup"
DisplayName="Test Lookup"
Required="TRUE"></Field>[/code]

It seems you will only see this error when a – you haven’t wired up the lookup column declaratively and b – the column is being provisioned as part of a list – either through the use of a Content Type or otherwise.

Failed to install app For SharePoint

Of course the first thing I did was to check the logs in the 15 hive, the message that appears in here is rather spurious –

Possible mismatch between the reported error with code = 0×81070504 and message: “There is no Web named “/mytestapp”.” and the returned error with code 0×80070002.    36714239-fd6e-47c8-b7d5-b5577627c58e

This seems to be referring to the appweburl which of course doesn’t exist until the app has been deployed by Visual Studio. Anyhow once I correctly wired up the lookup columns to their relevant lists the error disappeared and my app deployed. The correct XML to declaratively wire-up a lookup column is as follows -

[code lang="XML"]<Field
ID="{87217691-FA03-4178-8823-DA9626F89FFF}"
Type="Lookup"
Name="TestLookup"
DisplayName="Test Lookup"
List="Lists/Test"
ShowField="Title"
Required="TRUE"></Field>[/code]

Looks like I’m in for a world of pain with SharePoint 2013 development – these sandbox errors are even worse than the ones in 2010!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">