private WorksheetEntry createSpreadSheet(string sheetName) { DocumentsService docService = new DocumentsService(this.googleAppName); docService.RequestFactory = GoogleOauthAccess.getRequestFactory(this.googleAppName, this.parameters); DocumentEntry entry = new DocumentEntry(); entry.Title.Text = sheetName; entry.Categories.Add(DocumentEntry.SPREADSHEET_CATEGORY); DocumentEntry newEntry = docService.Insert(DocumentsListQuery.documentsBaseUri, entry); return(this.searchForSpreadsheet(entry.Title.Text)); }
private void GoogleAuthorizeButton_Click(object sender, RoutedEventArgs e) { this.loseFocus(); if (this.OAuthAccessCode == "") { this.DoneButton.Content = "Cancel"; this.showBrowser(); string urlForOauth = GoogleOauthAccess.getAuthorizationURL(this.clientId, this.clientSecret); this.Browser.Navigate(urlForOauth); } else { this.triggerOauthUpdate(""); } }
public string getSpreadsheetURL(string sheetName) { DocumentsService docService = new DocumentsService(this.googleAppName); docService.RequestFactory = GoogleOauthAccess.getRequestFactory(this.googleAppName, this.parameters); Google.GData.Spreadsheets.SpreadsheetQuery query = new Google.GData.Spreadsheets.SpreadsheetQuery(); DocumentsListQuery docQuery = new DocumentsListQuery(); docQuery.Title = sheetName; DocumentsFeed feed = docService.Query(docQuery); DocumentEntry entry = (DocumentEntry)feed.Entries[0]; return("https://docs.google.com/spreadsheet/ccc?key=" + entry.ResourceId.Replace("spreadsheet:", "")); }
public GoogleSpreadsheetAccess(string appName, string clientId, string clientSecret, string OAuthAccessCode, string accessToken, string refreshToken) { this.googleAppName = appName; this.googleClientId = clientId; this.googleClientSecret = clientSecret; this.OAuthAccessCode = OAuthAccessCode; this.OAuthAccessToken = accessToken; this.OAuthRefreshToken = refreshToken; this.parameters = GoogleOauthAccess.getOAuth2Parameters( this.googleClientId, this.googleClientSecret, accessToken: this.OAuthAccessCode ); this.service = new SpreadsheetsService(appName); this.DownloadDataWorker.DoWork += DownloadDataWorker_DoWork; this.DownloadDataWorker.RunWorkerCompleted += DownloadDataWorker_RunWorkerCompleted; }
public void connect(out string OAuthAccessToken, out string OAuthRefreshToken) { if (this.OAuthAccessCode != "" && this.OAuthRefreshToken == "") { GoogleOauthAccess.getAccessTokens( this.googleClientId, this.googleClientSecret, this.OAuthAccessCode, out this.OAuthAccessToken, out this.OAuthRefreshToken ); } else { this.OAuthAccessToken = GoogleOauthAccess.getRefreshedAccessToken( this.googleClientId, this.googleClientSecret, this.OAuthRefreshToken ); } OAuthAccessToken = this.OAuthAccessToken; OAuthRefreshToken = this.OAuthRefreshToken; this.parameters.RefreshToken = this.OAuthRefreshToken; this.parameters.AccessToken = this.OAuthAccessToken; this.service.RequestFactory = GoogleOauthAccess.getRequestFactory(this.googleAppName, this.parameters); }