Microsoft Cloud Authors: Kevin Benedict, Pat Romanski, Liz McMillan, Lori MacVittie, Elizabeth White

Related Topics: Microsoft Cloud, Silverlight

Microsoft Cloud: Blog Feed Post

Office 365 How to: Build and Deploy a Web Part with SharePoint Online

With Office 365, your development scenario involves sandboxed solutions

You know by now that the cloud is hot and Microsoft says “we’re all in.”  That being said, there has never been a better time to push all of those chips forward and  jump on the bandwagon.  It’s time to get some experience with SharePoint Online / Office 365.  I know most people don’t have access to the Office 365 beta yet, but when it opens up, you should sign up for the public beta and start getting familiar with it.  If you haven’t seen SharePoint Online yet, check our my previous article which gives a quick tour of it.  I plan to write more about SharePoint Online in the future, so I figured the best place to start is with an introductory development article on building and deploying a web part.  My past series on building and deploying web parts to 2010 and 2007 are still the most popular articles on DotNetMafia.com.  Let’s take what we learned there and see how we deploy web parts to the cloud.

Before we get started, let’s reiterate what we’re working with. With Office 365, your development scenario involves sandboxed solutions. As you know, these solutions are deployed to the site collection level and offer a restricted subset of the SharePoint API.  If you are already confortable working with sandboxed solutions, you are in great shape to begin SharePoint Online development.

What does the development environment look like?  Well, you know that SharePoint 2010 VM you already have?  You’re looking at it.  Just like Azure, SharePoint Online development also used the “Over the fence” development methodology.  Meaning, you develop your code locally and then throw it over the fence and hope it works.  This may sound bad, but it’s really not a big deal and the Azure people have been doing it for a while.  AppFabric is close to Azure, but there is always a possibility of differences when you get it in the cloud.  As long as you build a sandboxed solution and don’t make use of unsupported features (i.e.: PerformancePoint, BCS, etc), more than likely your code will work when it gets to the cloud.  There may be things that you can do in a Sandboxed solution in SharePoint 2010 compared to SharePoint Online, but it’s far too early to tell at this point.  To get started developing web parts in the cloud, you pretty much need a copy of SharePoint 2010 (or SharePoint Foundation) installed somewhere locally.  This could be native on your Windows 7 machine or inside a virtual machine.  Wherever it is, you will obviously need Internet access to get your code to the cloud.

To get started developing in the cloud, the first step is to build the web part on your local SharePoint environment.  I won’t go through all the steps here, because most of them are the same from my article on 2010 Web Part Development.  However, I will go through the important steps.  The first step is to create a new Empty SharePoint 2010 Project in Visual Studio 2010.  Specify the URL to a local site on your SharePoint server.  Don’t use the address of your SharePoint Online site.  It won’t work.  When prompted for the solution type, choose Sandboxed Solution.


At this point, you have a regular SharePoint project in Visual Studio.  Add a web part to the project just like you would in SharePoint 2010.  Sticking with the Hello World type example, we put some code like the following in our web part.

using System;

using System.ComponentModel;

using System.Web;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.WebControls.WebParts;

using Microsoft.SharePoint;

using Microsoft.SharePoint.WebControls;


namespace SharePointOnlineProject3.HelloCloudWebPart



public class HelloCloudWebPart : WebPart


protected override void CreateChildControls()


Controls.Add(new Label() { Text = "Hello, Cloud!" });




At this point, we can test our code locally on our SharePoint server.  Build and deploy the project and then add your web part to a test page on your site.  Again, if you aren’t familiar with these steps, take a look at my Building and Deploying Web Parts with SharePoint 2010 post. If the code, works you should see a similar page like the one below.


Now, we’re ready to send our web part “to the cloud!”.  How do we do that?  Start by using the Package menu to build a SharePoint package (.wsp file).


This creates a .wsp file located in the bin folder of the project.  We’ll use this file to deploy our web part to the cloud.  It’s now time to open up a browser and connect to your instance of SharePoint Online.  Once you get there, we deploy a sandboxed solution just like we would on-premises.  Go to Site Settings –> Solutions to view the Solutions Gallery.  Click on the Solutions button in the ribbon, and then click Upload Solution.  Browse to the bin folder of your Visual Studio project and select the file ending in .wsp.  Once it uploads, be sure and click the Activate button.


Now, you just need to ensure the feature is activated by going to Site Settings –> Site Collection Features.  If it is not activated, click the activate button.


Your web part has now been thrown over the fence and deployed to the cloud!  Test it out by going to any page on the site and adding the web part to the page.  You’ll find your web part in the Custom section by default.  If all goes well, your web part should work here too.


Congratulations, you have now deployed code to the cloud!  It’s really not that hard is it?  Now, you might be wondering if you can debug your solution.  Unfortunately, the answer is no.  If you have an issue, you have to step through it locally on your on-premises SharePoint server.  That’s all there is to getting started with SharePoint Online development.  As you can see it’s very familiar to sandboxed solutions development with your on-premises server.

Read the original blog entry...

More Stories By Corey Roth

Corey Roth, a SharePoint Server MVP, is an independent consultant specializing in Cloud technologies such as Azure and Office 365. He also specializes in mobile development. Corey serves as the product manager for two cloud-first mobile app platforms: BrewZap and HappenZap.

IoT & Smart Cities Stories
DXWordEXPO New York 2018, colocated with CloudEXPO New York 2018 will be held November 11-13, 2018, in New York City and will bring together Cloud Computing, FinTech and Blockchain, Digital Transformation, Big Data, Internet of Things, DevOps, AI, Machine Learning and WebRTC to one location.
The current age of digital transformation means that IT organizations must adapt their toolset to cover all digital experiences, beyond just the end users’. Today’s businesses can no longer focus solely on the digital interactions they manage with employees or customers; they must now contend with non-traditional factors. Whether it's the power of brand to make or break a company, the need to monitor across all locations 24/7, or the ability to proactively resolve issues, companies must adapt to...
DXWorldEXPO LLC announced today that ICC-USA, a computer systems integrator and server manufacturing company focused on developing products and product appliances, will exhibit at the 22nd International CloudEXPO | DXWorldEXPO. DXWordEXPO New York 2018, colocated with CloudEXPO New York 2018 will be held November 11-13, 2018, in New York City. ICC is a computer systems integrator and server manufacturing company focused on developing products and product appliances to meet a wide range of ...
René Bostic is the Technical VP of the IBM Cloud Unit in North America. Enjoying her career with IBM during the modern millennial technological era, she is an expert in cloud computing, DevOps and emerging cloud technologies such as Blockchain. Her strengths and core competencies include a proven record of accomplishments in consensus building at all levels to assess, plan, and implement enterprise and cloud computing solutions. René is a member of the Society of Women Engineers (SWE) and a m...
@DevOpsSummit at Cloud Expo, taking place November 12-13 in New York City, NY, is co-located with 22nd international CloudEXPO | first international DXWorldEXPO and will feature technical sessions from a rock star conference faculty and the leading industry players in the world. The widespread success of cloud computing is driving the DevOps revolution in enterprise IT. Now as never before, development teams must communicate and collaborate in a dynamic, 24/7/365 environment. There is no time t...
Founded in 2000, Chetu Inc. is a global provider of customized software development solutions and IT staff augmentation services for software technology providers. By providing clients with unparalleled niche technology expertise and industry experience, Chetu has become the premiere long-term, back-end software development partner for start-ups, SMBs, and Fortune 500 companies. Chetu is headquartered in Plantation, Florida, with thirteen offices throughout the U.S. and abroad.
DXWorldEXPO | CloudEXPO are the world's most influential, independent events where Cloud Computing was coined and where technology buyers and vendors meet to experience and discuss the big picture of Digital Transformation and all of the strategies, tactics, and tools they need to realize their goals. Sponsors of DXWorldEXPO | CloudEXPO benefit from unmatched branding, profile building and lead generation opportunities.
CloudEXPO New York 2018, colocated with DXWorldEXPO New York 2018 will be held November 11-13, 2018, in New York City and will bring together Cloud Computing, FinTech and Blockchain, Digital Transformation, Big Data, Internet of Things, DevOps, AI, Machine Learning and WebRTC to one location.
Disruption, Innovation, Artificial Intelligence and Machine Learning, Leadership and Management hear these words all day every day... lofty goals but how do we make it real? Add to that, that simply put, people don't like change. But what if we could implement and utilize these enterprise tools in a fast and "Non-Disruptive" way, enabling us to glean insights about our business, identify and reduce exposure, risk and liability, and secure business continuity?
SYS-CON Events announced today that DatacenterDynamics has been named “Media Sponsor” of SYS-CON's 18th International Cloud Expo, which will take place on June 7–9, 2016, at the Javits Center in New York City, NY. DatacenterDynamics is a brand of DCD Group, a global B2B media and publishing company that develops products to help senior professionals in the world's most ICT dependent organizations make risk-based infrastructure and capacity decisions.