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