How to test sharepoint web parts and other sharepoint development locally? - sharepoint

I have been investigating building web parts for sharepoint 2010 and currently have a single instance of SP2010 on the work servers. I would very much like to be able to test them locally (on my laptop) if possible, without having to install sharepoint 2010 on my laptop (is this even possible?!)
Is there a way to test web parts and do I need to install all/part of sharepoint on my laptop?
Thanks

If your Web part is simply displayed in a SharePoint page, without using the SP API, you could simply host it in an ASP.NET page on your laptop, but this is not a common scenario.
One new feature of SP 2010 is the client API, i.e. a subset of the full API that can be used outside of the farm. If your usage of the API fits in this subset, this could be useful, but you will still need to access a SP server somewhere.
Another option is to put all the code that uses the SP API in something similar to a Database Access Layer which talks to SP on one hand and returns business objects (not lists or lists items). This way, you could simulate this part on your laptop and concentrate on the look of the Web part and its business rules, without SP. If this part is in its own DLL, the only reference to SP DLLs would be there, so the project on your laptop would not need to reference the SP DLLs.

There are two ways: the good one and old-school.
The good way is to install Sharepoint Services (http://technet.microsoft.com/en-us/windowsserver/sharepoint/default.aspx) and deploy WP locally. It works only if you have Windows Vista or Seven. It is the most productive way so i recomend it.
Another way comes from SP2003 era... The idea is to develop custom Web Control, test it locally with IIS or just development server, and then to embed it into web part. The method is described here - http://www.reflectionit.nl/SmartPart.aspx . It's an old and painful method. Unfortunately we can't use (without troubles) Microsoft.Sharepoint.dll etc
P.S. Sorry for my English...

This came up at our office and we ended up installing Sharepoint Foundation on each developer's PC, which allows us to develop and debug locally. Here is the link that I used to get this working.
Setup Dev Env. For Sharepoint Foundation on Win 7

I would say get a virtual machine.. but I dont think you can run 64bit VM's on a 32bit OS.
You'll have to upgrade to 64bit.
I don't think there is a good way around this; you will spend a lot of time on something of questionable value if you do not install SharePoint either on your laptop or in a VM and do it the proper way.

You can just swap out the inheritance from the SharePoint Web Part to the ASP.NET equivalent and back again - all the functionality is the same because the newer version was designed with backwards compatibility in mind. Use the ASP.NET version when testing on your laptop.
Here is some more info :-)
http://weblogs.asp.net/scottgu/archive/2006/09/02/Writing-Custom-Web-Parts-for-SharePoint-2007.aspx

Related

Creating a Sharepoint work environment on Windows 7

I want to learn sharepoint.Can I create a work environment for sharepoint in Windows7? Is there any other options to work with Sharepoint on our laptop?
You can, but maybe you shouldn't, anyway its up to you at the end so here are some guides with the steps to do it:
http://www.disruptivei.com/Blogg/Inl%C3%A4gg/6/Install-SharePoint-2013-on-Windows-7-8-8-1
http://community.bamboosolutions.com/blogs/sharepoint-2013/archive/2014/08/21/guest-blog-by-jonas-nilsson-install-sharepoint-2013-on-windows-7-8-8-1.aspx
https://www.youtube.com/watch?v=HZZkgu0BiGk
I have done it with SP 2010 but never tried with SP 2013, I never required to do so, either because the clients had environments or because you can develop everything you need with SP Online by using Apps, the second one is the biggest reason.
In case you want to know the alternatives proposed by Microsoft here are them:
https://msdn.microsoft.com/en-us/library/office/ee554869.aspx
https://msdn.microsoft.com/en-us/library/office/fp179924.aspx
The second one is the one I recomend because is for App development on SP Online.
Here is a previous discussion about this topic:
installing-sharepoint-2013-windows-7

How to use Visual webpart in SharePoint 2010 in Sandbox Solution

I am trying to use a Visual Webpart in a sandbox solution. However every I deploy it: it gives me the following error:
Error 1 The deployment type "TemplateFile" of file "VisualWebPart1UserControl.ascx" in Project Item "VisualWebPart1" is not compatible with a Feature in a Sandboxed Solution.
I did some research and found out that Visual WP is not supported in Sandbox solutions. Is there anyway I can have Visual WP in a sandbox solution?
And is there any specific reason as to why Visual WP is not really supported in Sandbox solution.
Use VS Sharepoint Power Tools. It has Visual Web Part item template for sandbox solutions.
http://visualstudiogallery.msdn.microsoft.com/8e602a8c-6714-4549-9e95-f3700344b0d9/
Please follow this link
Restrictions on Sand boxed Solutions in SharePoint 2010
http://msdn.microsoft.com/en-us/library/gg615454.aspx)
it will provide you the detaisl about the limitation of Sandboxed solution.
RoManiac is correct, you can not deploy visual web part in Sanboxed solution as it contains user control.
Mark as answer if it helps you.
You can deploy a solution directly onto your SharePoint Server farm, or you can deploy the solution into a sandbox. A sandbox is a restricted execution environment that enables programs to access only certain resources, and that keeps problems that occur in the sandbox from affecting the rest of the server environment. Solutions that you deploy into a sandbox, which are known as sandboxed solutions, cannot use certain computer and network resources, and cannot access content outside the site collection they are deployed in.
Normally, a Visual Web Part cannot be sandboxed, as it needs to work outside the sandbox in order to load the underlying user control for the Visual Web Part.
This is how to have a Visual WP in a sandbox solution:
http://msdn.microsoft.com/en-us/office365trainingcourse_lab_2_1_topic3.aspx

What is a low-cost way to study Sharepoint?

I want to study Sharepoint. But if I create a project in VS 2010 it will shows an error message like "Sharepoint server is not installed in this machine". So is there any free Sharepoint server or service available? Is there any other way to start learning sharepoint 2010.
SharePoint is a very demanding platform to work with, ensure you have hardware matching the specifications, http://technet.microsoft.com/en-us/library/cc262485.aspx.
Working with crappy hw, virtual drives and so on will cause a lot of pain and consume loads of time. Think of learning SharePoint and SharePoint development as an investment.
However, if you just want to play with it for a bit follow this guide for installing SP on Windows 7
http://msdn.microsoft.com/en-us/library/ee554869.aspx
It do require x64
Download SharePoint 2010 Foundation since it's free. http://technet.microsoft.com/en-us/sharepoint/ee263910.aspx#tab=1
Cheers
Cloudshare (www.cloudshare.com) is the easiest and fastest way to get setup using SharePoint. It's about $60/month, but you get a machine pre-installed with SharePoint, SQL Server, and Windows Server. All you need, and you don't have to do a thing!
Also, if you're looking for something a bit cheaper, try Office365 w/SharePoint. It won't give you every feature, but it's less than $10/month per user, so it might be what you're looking for?
Two avenues to try:
Free sharepoint service: http://www.freesharepoint.com/
Trial Sharepoint 2010: http://sharepoint.microsoft.com/en-us/Pages/Try-It.aspx
Have a look here. There are VHDs available for download to have a play with.
[edit] If you can't find your way around VHDs best place to start would be getting your hands on WSS4 (Microsoft Sharepoint Foundation). WSS is a free version of sharepoint as opposed to full whack MOSS (Microsoft Office Sharepoint Server) and a good place to start playing.
I highly recommend SharePoint 2010 Developer Training Course from Microsoft.
A SharePoint development rig can be pricey. Check out the free trial at cloudshare.com. money well spent...currently 49 a month.. Removes the headaches of maintaining the environment so u can focus on Dev work.
As mentioned in the other posts you should have a look at MSDN to get started with the SharePoint Framework itself.
Cloudshare.com is offering SharePoint developer systems hosted in the cloud. There is a 14 day trialversion.
Cloudshare is great, it's fast and it's offering a lot of templates for SharePoint developer Farms.
One of the best books for SharePoint development is "Inside Microsoft SharePoint" from Microsoft Press.
NothingButSharePoint.com is also a great point to get started with SharePoint regardless to your profession. There is a lot of content for Users/IT-Pros/Developers
Thorsten
There is a really useful script which helps to setup all the environment you need to start development for SP (SP2010 trial, VS, SPD, Office and so on). So, you can just start it, enter some input details and right after it finishes you can start development.
It is absolutely free (if my memory serves me well, it is 180 days trial).
I highly recommend it for quick start.
SharePoint 2010 Easy Setup Script

SharePoint development nightmares

I thought I'd give SharePoint development a go, to broaden my understanding of Microsoft technologies and ran into a situation I refuse to understand.
I have a new web application created: http://localhost:11523 and set up the site collection as required. I can browse to the web site fine, without any issues, but now I want to start developing against this, using the object model.
Right, so after I struggled with SPSite site = new SPSite("http://localhost:11523"); I figured that I'm not running VS2008 in elevated permissions, so restarting VS I finally got one step further.
Whenever I step into my code, I get:
The Web application at
http://localhost:11523/ could not be
found.
I've Googled this without luck. The application is most definitely there, I can browse it, add web parts and go mad. I just can't seem to connect to it via Visual Studio.
Any ideas would be great.
EDIT
I thought I'd isolate my method, called "GetListFromSharePoint(string name)" into a test method (nUnit Framework) and to my surprise returned 9 entries from the list, as expected. When I dumped the method back into my web application (not SharePoint, trying to test the Composite Control through a normal Web site), and run into the mentioned problem.
This is in SharePoint 2007, and I'm developing on the same machine onto which SharePoint 2007 is installed.
This approach used to work, for some reason, I just can't get it to recognize SharePoint. The test stubs work find, just not the web application.
Edit 2
So there where a couple of things I "missed", which kind of solved the problem by itself.
Firstly, I was developing on a x64 Windows 2008 box, thus SharePoint 2007 was running in x64 mode. Cassini, turns out, is 32bit regardless of the platform you run it on, which caused some compiler bugs (I did not have IA64 compilers installed). After installing this, I figured out that the default web site (localhost:80) had been disabled by SharePoint.
Renabling the default web site, allowed me to create my web application as a virtual directory against it, which allowed my debugger compiler to run in x64.
My next challenge was access permissions. Because any new virtual directory on port 80 is assigned to the default application pool, is it assumed that the user does not have the right permissions, so I had to change my web application to run under my SharePoint web application's application pool.
The last thing I had to do was run my SharePoint code with elevated permissions.
Working like a charm :D
Note! Enable debug on your SharePoint web application....
Thanks,
Eric
(You have not specified version - assuming SharePoint 2010).
You need to decide what object model you want to use:
client (to be able to access the server from any other machine)
server (the one that you are trying now, can only be run locally).
Most likley reasons your code not work:
using "localhost" instead of ""computer name" in the Url. (I believe it is the reason.)
you are running your code not on the same machine as the SharePoint
you are running code under non-admin account
Check out how sites collections are configured in "Central Administration" site - urls associated with each site collection are listed there - make sure you are using correct one.
You can also try enumerating all site collections in SPWebApplication (http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.administration.spwebapplication.sites.aspx) to start expiriments.
I dont think the SPSite connect through the IIS, and if SharePoint isn't set up to respond to localhost (done in the Central Administration) you wont be able to connect to that url. IIS works a bit different here since it relays the signals to "localhost" to the "web application instance".
Start by checking in your SharePoint Central Administration. Go to "Configure alternate access mappings" in the "System Settings" section. Here you have your SharePoint instances, there are three properties which you can see directly in the list; 'Internal URL', 'Zone' and 'Public URL for Zone'.
If the Internal URL isn't set to Localhost you wont be able to use that connection you suggested. It bay be improper to change this to another url as well, so simply try to set your SPSite site = new SPSite("http://yourinternalurl:11523"); to whatever's in that box! :)
Cheers

DIsplaying SSRS reports in SharePoint?

I have a series of reports served by SSRS. They are great and the users like them.
That being the case, upper management wants to throw a wrench in the works and serve the reports from the Sharepoint server.
Is there a realtively painless way to let users access the reports from sharepoint? How would somebody go about doing such a thing? Or do I just need to bite the bullet and try to stop the madness?
I'm not sure which version of SSRS or Sharepoint you're using, but there have traditionally been both a Report Viewer and a Report Explorer web part shipped with Sharepoint in the RSWebParts.CAB file (at least since SQL Server 2005 SP2 I think). You can start there, but if you wanted quick and low-tech you could put in an IFRAME web part and point it to the Reports folder on your SSRS Server. Since you're using Sharepoint, that's also making the assumption that you're using Windows Authentication, so that wouldn't be an issue there.
Here's a link that might be of some use:
Viewing Reports with SharePoint 2.0 Web Parts
The most painless is going to be to run SSRS in Native mode, which it sounds like you're doing already, then install the SSRS web parts on your WSS/MOSS server.
You will have to manage security and report source control using some other methods besides sharepoint, however you don't have to deal with installing WSS/MOSS on your SSRS box and adding it to your SharePoint farm.
The more painful option is to run SSRS in Integrated mode. This allows you to use all the SharePoint document management stuff for your reports and share the same security setup however, the server configuration can be lengthy and difficult to setup.
http://msdn.microsoft.com/en-us/library/bb677365.aspx
Hope this helps!
Ben

Resources