Click here to Skip to main content
15,897,371 members
Articles / Web Development / ASP.NET

OneNote on iPhone and Palm Pré using Windows Azure

Rate me:
Please Sign up or sign in to vote.
4.96/5 (39 votes)
25 Dec 2009CPOL12 min read 80.7K   322   53  
Learn how to synchronize your OneNote notebooks on Windows Azure and access it from your iPhone or your Palm Pré.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Rino;

namespace Rino.iphone
{
    /// <summary>
    /// Class to display notebooks from an user
    /// </summary>
    public partial class nbooks : System.Web.UI.Page
    {
        /// <summary>
        /// Page load event
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            // Get user id
            string userid = Request.QueryString["userid"];
            if (userid == null)
            {
                home.AddItem("No user");
                return;
            }

            // Load user
            User user = AzureStorage.LoadUser(userid);
            if (user == null)
            {
                home.AddItem("User don't exist");
                return;
            }

            // For each notebook
            foreach (NotebookHeader header in user.Notebooks)
            {
                // For the unclassified notes notebook: add the first section
                if (header.Nickname == Notebook.UnfiledNotebookName)
                {
                    // Load notebook
                    Notebook notebook = AzureStorage.LoadNotebook(header.ID);
                    if (notebook == null)
                        continue;

                    // Get section
                    Section section = notebook.Sections[0];

                    // Compute url
                    string surl = String.Format("section.aspx?notebookid={0}&sectionid={1}", notebook.ID, section.ID);

                    // Add it to the list
                    home.AddItem(section.Name, section.Color, surl);
                }

                // For others notebook: add the notebook name
                else
                {
                    // Compute url for the notebook 
                    string url = String.Format("nbook.aspx?notebookid={0}", header.ID);

                    // Add it to the list
                    home.AddItem(header.Nickname, header.Color, url);
                }
            }
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Architect C2S
France France
Lionel is a software architect at C2S, a software company based in France and subsidiary of the Bouygues group.
Lionel is also the author of Liogo, an open-source Logo compiler for .NET.
Lionel is a contributor of DotNetGuru and Dr.Dobb's Journal.
Lionel is President and co-founder of OLPC France.

Comments and Discussions