'Microsoft.Online.SharePoint.TenantAdministration.SpoOperation' violates the constraint of type parameter 'T'

StackOverflow https://stackoverflow.com/questions/23526200

  •  17-07-2023
  •  | 
  •  

Frage

I am trying to create a sharepoint app to provision site collections, I downloaded the latest sharepoint client sdk, and practically my code is the same as the one from SPC3999 Rob Howard on Channel 9.

http://channel9.msdn.com/Events/SharePoint-Conference/2014/SPC3999 (check the first 20 minutes)

So, something really weird is happening with my VS 2013. I put a breakpoint on the first line of the button click, but debugger is not stopping there, however the code is being called with the error on the post title.

 protected void btnCreate_Click(object sender, EventArgs e)
        {
            Uri tenantadminUrl = new Uri("https://xxx-admin.sharepoint.com");

            string accessToken = TokenHelper.GetAppOnlyAccessToken(
                TokenHelper.SharePointPrincipal,
                tenantadminUrl.Authority,
                TokenHelper.GetRealmFromTargetUrl(tenantadminUrl)).AccessToken;

            var newSite = new SiteCreationProperties()
            {
                Url="https://xxx.sharepoint.com/sites/" + txtName.Text,
                Owner= txtOwner.Text,
                Template="STS#0",
                Title = "App provisioned site" + txtName.Text,
                StorageMaximumLevel = 1000,
                StorageWarningLevel = 500,
                TimeZoneId = 7,
                UserCodeMaximumLevel =7,
                UserCodeWarningLevel=1

            };

            using(var clientContext=TokenHelper.GetClientContextWithAccessToken(tenantadminUrl.ToString(), accessToken))
            {
                var tenant = new Tenant(clientContext);
                var spoOperation = tenant.CreateSite(newSite);
                clientContext.Load(spoOperation);
                clientContext.ExecuteQuery();
            }

        }
War es hilfreich?

Lösung

this is not clear on the documentation, but actually the client sdk dll is here:

C:\Program Files\SharePoint Client Components\16.0\Assemblies

and then it works!

Andere Tipps

Thanks for responding here. I am getting our MSDN content publishers to update the pages on the API to make this clearer. If you are using the latest developer tools for Office platform you should get both versions of the DLL and when you do add assembly you'll see you can pick between the two versions. By default the app is going to add v16.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top