I have tested this successfully, but wanted to check if anyone else has run into issues with this approach?

The following object SP.Publishing.DesignPackage allows you to .install() and .apply() sandbox solutions as well as design packages.

Example code:

private static void ApplyDesign(ClientContext context, string fileUrl)
    DesignPackageInfo info = new DesignPackageInfo()
       PackageGuid = Guid.Empty,
       MajorVersion = 1,
       MinorVersion = 1,
       PackageName = "whatever"
    Console.WriteLine("Installing design package / sandbox solution ");

    // have the package in a doc lib or something...
    string fileRelativePath = context.Url + fileUrl;
    DesignPackage.Install(context, context.Site, info, fileRelativePath);

    Console.WriteLine("Applying Design Package!  / sandbox solution ");
    DesignPackage.Apply(context, context.Site, info);

Source: http://blog.symprogress.com/2013/07/apply-designpackage-using-client-object-model/


I am getting exception on below line

DesignPackage.Install(context, context.Site, info, fileRelativePath);

Exception : An exception of type 'Microsoft.SharePoint.Client.ServerException' occurred in Microsoft.SharePoint.Client.Runtime.dll but was not handled in user code Additional information: Cannot find stub for type with id "{d21214d9-63f5-488b-a665-2b7f9abc1604}". The specified server may not support APIs used in this operation.

I am trying to install sandbox wsp on site collection in SharePoint Foundation. Can you please help?

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.