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