1

I'm trying to activate a sandbox solution on SharePoint 2013 using C#.

This is the code that I am using, it's working and the solution is activated however the files in the solution are not copied to the Style Library.

SPSite tempSite = new SPSite(Global.url);

 SPUserToken ownertoken = tempSite.Owner.UserToken; using (SPSite siteCollection = new SPSite(Global.url, ownertoken)) { SPDocumentLibrary solutionGallery = (SPDocumentLibrary)siteCollection.GetCatalog(SPListTemplateType.SolutionCatalog); SPFile file = solutionGallery.RootFolder.Files.Add(Global.sharepointSolutionName, File.ReadAllBytes(Global.currentDirectory)); SPUserSolution solution = siteCollection.Solutions.Add(file.Item.ID); } 

If I upload and activate the same solution manually everything works great.

Any idea of what I am missing here to get the files in the directories?

Thanks in advance.

1 Answer 1

1

Your code needs to activate the feature that provisions the files.

siteCollection.Features.Add([guid_of_your)feature]) 

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.