Activate a solution (.wsp) programmatically in Office 365 (Sharepoint online) site collection

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

سؤال

I have a .wsp file uploaded into the Solution Gallery of a site collection created in Office 365. This solution is not activated and I want to activate it programmatically. The below code is an example on how to achieve it for a solution file in an on premise sharepoint site.

SPDocumentLibrary solutionGallery = (SPDocumentLibrary)siteCollection.GetCatalog(SPListTemplateType.SolutionCatalog);
SPFile file = solutionGallery.RootFolder.Files.Add("HelloWorldSolution.wsp", File.ReadAllBytes("HelloWorldSolution.wsp"));
// Activating the solution file 
SPUserSolution solution = siteCollection.Solutions.Add(file.Item.ID);

Is there a sharepoint online(Office 365) equivalent of this, that can be achieved through the client object model in CSOM?

هل كانت مفيدة؟

المحلول

Use this, It has neat explanation. You can use webclient Api to do that job http://blog.symprogress.com/2013/07/upload-wsp-file-to-office365-sp2013-using-webclient/

نصائح أخرى

There is currently nothing in CSOM to accomplish this.

The only way that I expect you could get this to work is to mock the browser. You will need to query the page to get the details on the uploaded .wsp and then submit back to activate it.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top