Testing the Provisioning.SiteCollectionCreation solution

May 12, 2014 at 6:00 PM
Hi there,

First off, these samples and code demos are very cool. I want to implement the site provisioning one and have tried to do the spoprovisioing one in version 1.0. However, There is really no clear walkthroughs on how I can implement and test them. It appears to be very vague in nature.

I have attempted to test this new Provisioning.SiteCollectionCreation solution and get all the way to the Create page but get the following exception:
System.Security.VerificationException was unhandled by user code
HResult=-2146233075
Message=Method Microsoft.SharePoint.Client.ClientRuntimeContext.Load: type argument 'Microsoft.Online.SharePoint.TenantAdministration.Tenant' violates the constraint of type parameter 'T'.
Source=Contoso.Provisioning.SiteCollectionCreationWeb
StackTrace:
   at Contoso.Provisioning.SiteCollectionCreationWeb.Default.CreateSiteCollection(ClientContext ctx, String hostWebUrl, String url, String template, String title, String description)
   at Contoso.Provisioning.SiteCollectionCreationWeb.Default.btnCreate_Click(Object sender, EventArgs e) in c:\Projects\Provisioning.SiteCollectionCreation\Provisioning.SiteCollectionCreationWeb\Pages\Default.aspx.cs:line 71
   at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
   at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
   at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
   at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
   at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
InnerException:


I have also attempted to actually deploy this app as well. I have entered my site url and the clientid into the appmanifest, as well as enter both the client id and client secret in the web.config file. Perhaps I am missing something??

Thanks a ton for the great content.
John
Marked as answer by jhipolito on 5/13/2014 at 8:05 AM
May 12, 2014 at 10:36 PM
I had the same error and its because you are using the old assembly version

Http://levalencia-public.sharepoint.com (last post)
May 12, 2014 at 10:43 PM
Hi Luis,

I tried the update but it did not work. Perhaps you can provide me a link and direction on what you did to update?
May 13, 2014 at 12:53 AM
even after installing this: http://www.microsoft.com/en-us/download/details.aspx?id=35585

I get the same error:
System.Security.VerificationException was unhandled by user code
HResult=-2146233075
Message=Method Microsoft.SharePoint.Client.ClientRuntimeContext.Load: type argument 'Microsoft.Online.SharePoint.TenantAdministration.Tenant' violates the constraint of type parameter 'T'.
Source=Contoso.Provisioning.SiteCollectionCreationWeb
StackTrace:
   at Contoso.Provisioning.SiteCollectionCreationWeb.Default.CreateSiteCollection(ClientContext ctx, String hostWebUrl, String url, String template, String title, String description)
   at Contoso.Provisioning.SiteCollectionCreationWeb.Default.btnCreate_Click(Object sender, EventArgs e) in c:\Projects\Provisioning.SiteCollectionCreation\Provisioning.SiteCollectionCreationWeb\Pages\Default.aspx.cs:line 71
   at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
   at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
   at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
   at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
   at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
InnerException:
May 13, 2014 at 3:10 AM
Edited May 13, 2014 at 4:05 AM
Although I did get this to work using F5 debugging, I am not able to get it working when deployed to azure.

Here are the steps I did:
1) registered the app at my dev site to get the clientid and client secret
2) Added the clientid and my azure site to the app manifest.
3) added the clientid and client secret to the webconfig
4) published
5) packaged app and added to my appcatalog site. I am able to add the app to my root web.

I click on the app and I get a webconfig error.

I am able to successfully do this with other provider-hosted apps I have created.

Any tips on all steps need to deploy this?

Thanks a ton!
John
May 13, 2014 at 2:28 PM
This is the error I get after publishing to azure.....puzzled since I have the correct assembly in my solution now??

Could not load file or assembly 'Microsoft.SharePoint.Client, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' or one of its dependencies. The system cannot find the file specified.
May 13, 2014 at 3:06 PM
set all SharePoint references to Copy Local True