10

I ultimately ended up just using a foreach loop to iterate through the SPWeb.Lists collection and then check each list's BaseTemplate value to get all the picture and asset libraries. Code provided below: private void PopulateImageLibraryDropDownList() { base.EnsureChildControls(); _dropDownList.Items.Clear(); _dropDownList....


9

I read that sandbox solution is not preferred in SharePoint 2013 and we should use the app model. So is creating artifacts an available approach to do inside SharePoint apps? Yes there are multiple available approaches. The one I use the most is (for provider hosted add-ins) to use a remote event receiver on AppInstalledevent. In the event receiver you can ...


6

It’s better to use the Delete() method of SPWeb.Lists instead of using the Delete() method on the SPList because the latter doesn't delete lists properly sometimes. Try something like: SPWeb mySite= SPContext.Current.Web; SPList myCustomList = mySite.Lists["MyCustomList"]; mySite.Lists.Delete(myCustomList.ID); mySite.Update();


5

You best chance is to try at least four things while debugging: Use logging library "SharePoint Sandbox Logging" to log errors on feature activation, as you probably know logging capabilities on Sandbox are limited. Have Correlation Id with your error? contact Microsoft support Review SharePoint logs for on-premises Sandbox to check for any errors, warnings ...


5

This is how to check for sandbox: if(System.AppDomain.CurrentDomain.FriendlyName.Contains("Sandbox")) { // I'm in a SandPit } This is how to check for SPO: if(SPContext.Current.Web.siteClientTag.contains("$$16")) { // I'm in the clouds } Mystery solved!?!


5

As you have discovered SPLimitedWebPartManager is not availabe on Sandboxed solutions. Snippet from Waldek Mastykarz blog: Inconvenient provisioning Web Parts instances from Sandboxed Solutions One of the challenges when working with Sandboxed Solutions is how to provision Web Parts instances to pages. If you have done this before in a Farm ...


5

I no in your post you said "without an external application" but does that include js libraries? Below is a simple solution that will copy a document from one SP library to any other SP library. I have not verified its cross-site scripting capabilities but it theoretically should work across farms, domains, and different SP versions. (It 100% works across ...


4

The most preferred location to add JQuery is the "Site Asserts" library which exists in SharePoint Online - Office 365 site. Quick Steps to create a solution for this Create a Empty Solution in Visual Studio 2010 and deploy it as sandbox. Create a Folder called JQuery. In this Folder add an new Module. You would notice you get a new Elements.xml and a txt ...


4

Application pages are not allowed in Sandboxed solutions. So all pages have to be site pages, deployed through modules. These modules can then be added to features which can be activated on the difference sites depending on which pages is needed on each site.


4

Also it seems that to deploy a solution, I can simply upload a wsp to the solution gallery within a site collection and activate the feature? Yes this is right. So if I develop say a basic webpart on a dev laptop with installation of SP, VS, etc, and I reference my local sharepoint implementation in the project do I need to somehow change this in ...


4

You have to be a bit tricky to include codebehind for your custom pages in sandbox solutions. Here's a little tutorial on how to do it: http://www.wictorwilen.se/Post/Custom-application-pages-in-the-SharePoint-2010-Sandbox.aspx For example, here's my custom ASPX page: <%@ Page language="C#" MasterPageFile="~masterurl/default.master" Inherits="...


4

The code compiles and runs fine for me as long as there is a reference to Microsoft.SharePoint (2010). Are you building a console application? In that case make sure you are using the .NET 3.5 framework (not compact or anything else) and set the platform target to Any CPU in the build section of the project properties. BTW. note that you are leaking a site ...


4

It's related to the sandbox, because you cannot use SPFolder.ContentTypeOrder and SPFolder.UniqueContentTypeOrder in sandbox :\ Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll) Available in Sandboxed Solutions: No Edit: If it's just to order, the code posted as an answer by James in this question might work.


4

Well it's taken a few days but I've finally managed to work this one out however it did involve me having to dissect the whole project and reintroduce each piece one at a time. A few issues were causing it:- 1) I had set one of the projects "Include Assembly in Package" property to false. 2) A static method was making a call to an SPList which turned an ...


4

You cannot use the SharePoint root folder, nor any of its sub folders. However, you can deploy an aspx file to the content database using a module. Look at the solution here: http://spkbase.codeplex.com That solution also uses the SPUserCodeWebPart to run server-side code on those aspx pages.


4

This sort of task is more suited to an event receiver. The itemAdded approach will certainly give you access to the ID. An event receiver does not have the typical delay you see with Workflows, it fires right away. One issue you can experience with ItemAdded events is that they run asynchronously. What this means is that the control is returned to the UI ...


4

Using a pure Sandboxed solution this is not possible. A sandboxed solution has absolutely no access outside the current site collection, that's the whole point of sandboxed solutions. On-premises If you're solution is developed for on-premises SharePoint where it's "just" politics which require the solution to be Sandboxed. Then there is the possibility of ...


4

Are there only 2 kinds of SharePoint Solutions? yes, but since SP 2013 we could count the APPs as a separate solution type as well Does the SharePoint Foundation Sandboxed Code Service" (SPUserCodeV4) have to be active ... yes On what server(s) should...Code Service" (SPUserCodeV4) be active? I would suggest on the front end "Save Site as ...


4

APPROACH 1 First add reference of two COM components. Microsoft Office Object Library Microsoft Excel Object Library excel = new ApplicationClass(); excel.Visible = false; string workbookPath = url; Workbook excelWorkbook = excel.Workbooks.Open(workbookPath, 0, false, 5, "", "", false, XlPlatform.xlWindows, "", true, false, 0, true, false, false); Sheets ...


4

There has been an outage listed in the admin portal for most of the week regarding sandboxed solutions: SP73009 - Custom Solutions and Workflows - Service degradation Service degradation - Jul 27, 2016 3:50 PM Current Status: We're continuing to perform a detailed analysis of the issue to determine the next steps. User Impact: Users may be ...


4

As far as I have information, I doubt anything will change with respect to farm solutions. They exist since the first version of SharePoint and are the most powerful way to develop solutions in SharePoint. Among other things: Better performance Code more "ordered" Compiled code Simpler to use Elevated privileges More classes It does not seem that this ...


3

AFAIK the "i like it" controls are not part of the ribbon? If you want to replace the controls, you can create a custom control that inherits from SocialNotificationBase and render your own content in the OnLoad control public class ReitanSocialNotification : SocialNotificationBase { public ReitanSocialNotification() { base....


3

Not sure why you are using iCount at all? Does this work: foreach (string s in listArray) { string listName = s; } Alternatively string[] listArray = new string[] { "some list", "Some other list" }; int len = listArray.Count<string>(); for (int i = 0; i < len; i++) { string listName = listArray[i]; } Otherwise dump in a try/catch ...


3

You'll need to ask a Site Collection Admin to upload it for you if you don't have the right permission. A sandboxed solution is installed by a site collection administrator to the site collection's solution gallery. This gallery also shows the current resource usage, average resource usage over the past two weeks, and the status of each sandboxed ...


3

I have the exact same problem. Unfortunately, it doesn't look like it's possible to use a .webpart file for the wrapper web part, SPUserCodeWebPart, since the GetTypeId method in the SafeControls class in SharePoint explicitly checks for this and throws an exception if you try as evidenced by the following reflected code: // Microsoft.SharePoint....


3

Was this windows account the same one with which SharePoint was installed? In that case, you could try to create a new user in AD and then login using the new user credentials.


3

In sandbox solution you can not create visual webpart directly. for that you have download and install the Visual Studio 2010 SharePoint Power Tools from given link and then you can create Visual WebPart in sandbox solution. [Visual Web Part(Sandboxed)] http://visualstudiogallery.msdn.microsoft.com/8e602a8c-6714-4549-9e95-f3700344b0d9/


3

Another option to what Vikalp said is to use Visual Studio 2012


3

For client side stuff I came up with the following check: if (typeof O365 === "undefined"){ // I'm executing in the context of SharePoint on-prem. } else{ // I'm executing in the context of SharePoint Online. }


Only top voted, non community-wiki answers of a minimum length are eligible