Tag Info

Hot answers tagged

15

Not out-of-the-box AFAIK. You could check it like this: if(AppDomain.CurrentDomain.FriendlyName == "Sandboxed Code Execution Partially Trusted Asp.net AppDomain") { // I'm playing in the sandbox! }


15

AFAIK there is no foolproof way to do this unfortunately. I know Microsoft's SharePoint Patterns & Practices team are using: AppDomain.CurrentDomain.FriendlyName.Contains("Sandbox") So if that's the best they've come up with, it's fair to say that's as good as it gets. Obviously some static helper method is the way to go rather than having this check ...


11

Can you check that ou have enabled and configured the user code service on your farm and started it? Look for user code service in service applications and create one if it is not there. Then go to Central Administration > System Settings > Manage Services on Server > check that “Microsoft SharePoint Foundation Sandboxed Code Service” service is running


9

You are not allowed to call ANYTHING outside of the Sandbox. A call to listdata.svc is a call outside the sandbox, requiring System.Net.WebPermissions. This is prohibited by the CAS policies on the Sandbox. You basically have three ways to get around this: Use client side code (JavaScript) Use a farm solution Build a Sandbox Full-Trust proxy solution


8

Create a plain ol Web Part that stores the info in the appropriate location (property bags, custom list etc).


8

By default, code access security denies WebPermission to code running in a sandboxed solution (see Restrictions on Sandboxed Solutions in SharePoint 2010) However, you can create a full-trust proxy operation that will enable you to call the services. (see Sandboxed Solutions in Partnership with Full-Trust Proxies in SharePoint 2010)


8

Sandbox mode implies you'll have to do it all at a site level. Personally I'd be going with a CDN link, and additionally I'd be checking to see if it's already been loaded elsewhere in the page - useful in the case of a jquery-dependent webpart which may be included two or three times in a page: https://gist.github.com/902090 Of course, if the solution ...


7

The System.Net.Mail namespace works with on-premise Sandbox solutions but does not work with Office 365, so there is no way to send email from code. The "Send Email" activitiy in SharePoint Designer workflows in Office 365 does work, so yes, you can use workflow to send email.


7

No you cannot set cookies in the sandbox, the data are not transferred back between the sandbox and the IIS. The Sandbox lives in it's own process and the HttpContext.Current is different from the HttpContext.Current in ASP.NET (that lives in IIS and the w3wp.exe process) For more limitations see: ...


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

The quota is set in Central Administration -> Applications -> Site Collections -> Quotas and locks. You can set the limit for the site collection and the level at which an email is sent to the admin. You can set it to a very high value. You can also set the resource quotas by using PowerShell, and also set the metrics used to arrive at the resource point ...


5

You should be able to create content types with sandbox solutions http://msdn.microsoft.com/en-us/library/ff798382.aspx What Can I Do with Sandboxed Solutions? Create a content type: Sandbox = Tick This may help you http://sharepointbuzzer.wordpress.com/2010/10/21/list-definition-using-sandbox-in-sharepoint-2010/


5

No there is unfortunatley no possibility to do that.


5

If you want to send a document as an attachment, you will need to write custom code. Use a feature to create a custom action that adds the "Send as attachment" link to the ECM. <UrlAction Url="~site/_layouts/MyApp/MyCustomPage.aspx?ItemId={ItemId}&amp;ListId={ListId}" /> Clicking this menu item navigates to a custom application page where the ...


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, ...


5

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/


4

check if the 'Microsoft SharePoint Foundation Sandboxed Code Service' service is started SharePoint 2010 Central Administration -> System Settings -> Manage Services on Server


4

Don't forget that you also need membership of the SharePoint_Shell_Access role to use PowerShell cmdlets that interact with the content database. Use the Add-SPShellAdmin cmdlet to enable this.


4

There should be almost no difference. In any case the extra time required for interprocess communication is very small compared with getting data from the database. There are two main reasons to use a sandboxed solution: You plan to deploy it to the cloud (SharePoint Online Services) To improve managability and security There are many situtations where ...


4

I asked that question at the SharePoint Conference and they said there shouldn't be any performance difference. I agree with you though, I would think that unpackaging the wsp, opening a new process, and returning the result would means slower page loads on whatever is using that functionality.


4

Yes, SharePoint lists are your only option in this case. Each request is marshalled from ASP.NET/SharePoint to a specific Sandbox process. These processes and AppDomains are not guaranteed to be the same or even on the same machine, so any kind of in-memory cache is out of question.


4

Regardless of what code, or lack thereof, is contained in the solutuion SharePoint will still execute the user/sandobexed soultion inside the sandbox, i.e. it is run but the User Code Service. I'd take a look at the setup of the User Code Serivce and verify that it is correct, this blog posting may help: ...


4

You will need to use the appropriate Resource. In your case, it's in core.resx, resource key "webpartgalleryList". Note that the Web Part Gallery is always at the root of the site collection, so for maximum portability you should access it using web.Site.RootWeb, not web. Also, SPListCollection[string listName] will already throw an exception if the list is ...


4

The Page object you're getting in the Sandboxed webpart isn't the real page, so this in one of the things that won't work. Option 1: Render in RenderContents You can manually render your script include in RenderContents: protected override void RenderContents(HtmlTextWriter writer) { string jQuerySrc = Page.ClientScript.GetWebResourceUrl(this.GetType(), ...


4

You can't use AppGlobalResource or <%$Resources:RESXFILE,RESOURCEKEY%> in Sandboxed solutions. See Localization in SharePoint 2010 Sandbox Solutions for how to use resources in Sandboxed solutions.


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

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" ...


4

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!?!


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

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(); ...



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