DZone
Mobile Zone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
  • Refcardz
  • Trend Reports
  • Webinars
  • Zones
  • |
    • Agile
    • AI
    • Big Data
    • Cloud
    • Database
    • DevOps
    • Integration
    • IoT
    • Java
    • Microservices
    • Open Source
    • Performance
    • Security
    • Web Dev
DZone > Mobile Zone > Using SkyDrive in Your Windows Phone App: Part 1

Using SkyDrive in Your Windows Phone App: Part 1

Rabeb Othmani user avatar by
Rabeb Othmani
·
Feb. 03, 12 · Mobile Zone · Interview
Like (0)
Save
Tweet
6.13K Views

Join the DZone community and get the full member experience.

Join For Free

in case you don’t know what is skydrive, on wikipedia you will find that “ windows live skydrive , initially called windows live folders, is a free-of-charge file hosting service that allows users to upload files to a cloud storage and then access them from a web browser .”

that was true before the build. now, microsoft released an sdk that enables us to write  third party applications running on windows 7, windows developer preview and windows phone, that interact with the whole live services, skydrive among them in different languages : javascript, c# and rest.

it also released its official skydrive application for both windows phone and ios .







get ready

first of all you have to download ans install the live sdk v5.0 . you would probably need to use the live interactive sdk to explore the apis and learn how to use them.

the live connect should recognize your application, that’s why you should go to live connect app management site and create a new app.

create


you will get a client id and client secret that you will be using later with your application.

clientbis

demo : sign in

let’s see how it works now:

create a windows phone application and make sure to add the following references:

references


you should also add the signin button to your toolbox :

toolbox


in the main page, the user should sign in :

main



 <grid x:name="contentpanel" grid.row="1" margin="12,0,12,0">
              <textblock height="55" horizontalalignment="left" margin="54,113,0,0"
                         name="textblock1" text="please sign in to access your skydrive"
                         verticalalignment="top" width="336" />
              <my:signinbutton content="button" clientid="your_client_id"
                               scopes="wl.signin wl.basic " branding="windows" sessionchanged="signinbutton1_sessionchanged"
                               height="72" horizontalalignment="left" margin="138,268,0,0"
                               name="signinbutton1" verticalalignment="top" width="160" />
              <textblock height="32" horizontalalignment="left" margin="12,372,0,0" name="infotextblock" text=""
                         verticalalignment="top" width="419" />
 
          </grid>


in the mainpage.xaml, i added a singinbutton control, you should put your own client id. i only used wl.signin and wl.basic scopes at this point.

wl.basic : allows access to a user’s basic info, such as his or her hotmail contact list.

wl.signin : allows user’s log in .

the “infotextblock “ will indicate either the user is signed in or not. that will be handled in the c# code.

private void signinbutton1_sessionchanged(object sender, microsoft.live.controls.liveconnectsessionchangedeventargs e)
          {
              if (e.status == liveconnectsessionstatus.connected)
              {
                  session = e.session;
                  client = new liveconnectclient(session);
                  infotextblock.text = "signed in.";
              }
              else
              {
                  infotextblock.text = "not signed in.";
                  client = null;
              }
 
          }


run the application , hit the sign in button and you should get this screen:

sign in


summary

in this first part, we grabbed the tools and sdk needed in order to use skydrive in our windows phone applications.

then we learnt how to sign in into skydrive storage without writing any code.

in part two, we will learn how to read/insert files into skydrive. stay tuned sourire



source: http://rabeb.wordpress.com/2012/01/07/using-skydrive-in-your-windows-phone-applications-part-1/

Windows Phone app application

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Testing Your Infrastructure as Code Using Terratest
  • AWS IAM Security Best Practices
  • Instancio: Test Data Generator for Java (Part 2)
  • No-Code/Low-Code Use Cases in the Enterprise

Comments

Mobile Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • MVB Program
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends:

DZone.com is powered by 

AnswerHub logo