Just release from last month, Office 365 is opening a new opportunity for your professionals and small businesses Collaboration to everyone. License price is easy to calculate with $6 per person per month, Office 365 is not expensive to bring your business on Cloud and  help you build solutions that leverage SharePoint Online, Exchange Online and Lync Online, Office Web App (Excel, Word, PowerPoint and OneNote)

And a very new release from Microsoft,  Office 365 Developer Training Kit – June 2011 allow you learn how to build collaborative and communication focused cloud solutions that run in Office 365 using Visual Studio 2010 and the .NET Framework

In this post, I would like to introduce my experience to build a solution with Visual Studio 2010 and deploy in Office 365 SharePoint site.

1. First of all, you need to install Visual Studio 2010 SharePoint Power Tools, this extension allow Visual Studio create SharePoint Visual web parts that can be deployed in a sandboxed solution and displays build errors on compile time

2. Create an empty SharePoint 2010 project and provide your local SharePoint 2010 for debugging

3. Add an Visual Webpart for Sandboxed Solution with several asp controls as below

All Lists of this site:
<asp:DropDownList ID=”ddlLists” runat=”server”></asp:DropDownList>
<asp:Button ID=”btnPopularDetails” runat=”server” Text=”Show Details” OnClick=”btnPopularDetails_Click” />
<asp:GridView ID=”gridListsDetails” runat=”server”></asp:GridView></p>

4. Add following code to get all existed list except document library on page load and show details info of selected list to Gridview when clicked on “Show Details” button

 public partial class VisualWebPart1 : System.Web.UI.WebControls.WebParts.WebPart
protected override void OnInit(EventArgs e)
}protected void Page_Load(object sender, EventArgs e)
if (!Page.IsPostBack)
SPWeb web = SPContext.Current.Web;
var listNames = from SPList list in web.Lists
where list.BaseTemplate != SPListTemplateType.DocumentLibrary
select list.Title;
ddlLists.DataSource = listNames;
}protected void btnPopularDetails_Click(object sender, EventArgs e)
SPList sourceList = SPContext.Current.Web.Lists.TryGetList(ddlLists.SelectedValue);
SPQuery qry = new SPQuery();
qry.ViewFieldsOnly = true;
qry.ViewFields = “<FieldRef Name = ‘Title’ /><FieldRef Name = ‘Author’ />”;
qry.RowLimit = 20;
gridListsDetails.DataSource = sourceList.GetItems(qry).GetDataTable();
gridListsDetails.EmptyDataText = string.Format(“List {0} have no data”, ddlLists.SelectedValue);

5. Build project and find Office365.wsp under Debug/Bin folder

6. Login to Office 365 with your account

7. Open  Site Setting and navigate to Solution Galleries

And then, Upload your Solution to this gallery, after that click on Active button to active your solution

8. Finally, Create a new page and insert your webpart to see the result

Related Video resources:

Hoang Nhut Nguyen
Email: nhutcmos@gmail.com
Skype: hoangnhut.nguyen