0

I'm new to developing Windows Phone app. Besides, my laptop is so old that I can not develop or use Emulator for Windows Phone 7.5 or higher on it so I have to stick with the old WP7.1

I want to upload a selected image to google drive. I created a button to browse the image and an "image container" to display it after choosing it. Done here with the code below. But after displaying it, I want the upload process to start here too. But the problem occurs at the beginning.

    private void browseButton_Click(object sender, RoutedEventArgs e)
    {

        PhotoChooserTask photo = new PhotoChooserTask();
        photo.ShowCamera = true;
        photo.Show();
        photo.Completed += new EventHandler<PhotoResult>(browseButton_Click_Conpleted);
    }


    private void browseButton_Click_Conpleted(object sender, PhotoResult e)
    {
        BitmapImage image = new BitmapImage();
        image.SetSource(e.ChosenPhoto);
        displayIMG.Source = image;

        //It works until now

        //Below is the code I copied from many place that will authorize me to upload to their drive.
        string[] scopes = new string[] { DriveService.Scope.Drive,
                             DriveService.Scope.DriveFile};

        UserCredential credential =
                    GoogleWebAuthorizationBroker
                                  .AuthorizeAsync(new ClientSecrets
                                  {
                                      ClientId = "MY_CLIENT_ID_HERE"
                                  ,
                                      ClientSecret = ""MY_SECRET_ID_HERE"
                                  }
                                                  , scopes
                                                  , Environment.UserName
                                                  , CancellationToken.None
                                                  , new FileDataStore("Daimto.GoogleDrive.Auth.Store")
                                                  ).Result;

    }

It shows much error as it doesn't recognize some of the type or namespace, no using is suggested. I create a new project that target WP8.0 with the hope it will recognize all but some still missing like Environment.UserName or new FileDataStore. I've already added Google.Apis.Drive.v2 client library I don't know what I am missing.

My first priority is to develop on WP7.1. I don't want to buy a new phone just because of this. And sorry for my English.

1 Answer 1

1

Did you try out the PedroLamas sample in order to upload files to GDrive?

1
  • Was able to test PedroLamas and successfully upload an image to google drive. Now I'm working on using it in my own app. Thanks for your help, it saves time Mar 26, 2015 at 7:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.