本文整理汇总了C#中Google.GData.Spreadsheets.SpreadsheetsService.setUserCredentials方法的典型用法代码示例。如果您正苦于以下问题:C# SpreadsheetsService.setUserCredentials方法的具体用法?C# SpreadsheetsService.setUserCredentials怎么用?C# SpreadsheetsService.setUserCredentials使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Google.GData.Spreadsheets.SpreadsheetsService
的用法示例。
在下文中一共展示了SpreadsheetsService.setUserCredentials方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GDataAPI
public GDataAPI(NameValueCollection parameters)
{
try
{
SpreadsheetsService service = new SpreadsheetsService("post2spreadsheet");
service.setUserCredentials(cardeira.Properties.Settings.Default.gUserName, cardeira.Properties.Settings.Default.gPassword);
Google.GData.Spreadsheets.SpreadsheetQuery query = new Google.GData.Spreadsheets.SpreadsheetQuery();
SpreadsheetFeed feed = service.Query(query);
SpreadsheetEntry entry = null;
foreach (SpreadsheetEntry e in feed.Entries)
{
entry = e;
logger.Debug("Spreadsheet: {0}", entry.Title.Text);
if (entry.Title.Text == cardeira.Properties.Settings.Default.spreadsheetkey)
break;
}
if (entry != null)
InsertRow(service, (WorksheetEntry)entry.Worksheets.Entries[0], parameters);
}
catch (Exception e)
{
logger.ErrorException("error writing to spreadsheet", e);
}
}
示例2: GoogleNinjaService
public GoogleNinjaService(ISpreadsheetConfiguration googleSpreadsheetConfiguration)
{
this.googleSpreadsheetConfiguration = googleSpreadsheetConfiguration;
service = new SpreadsheetsService("tretton37-NinjaBook");
service.setUserCredentials(googleSpreadsheetConfiguration.Username, googleSpreadsheetConfiguration.Password);
}
示例3: AuthenticateGoogleUser
private SpreadsheetsService AuthenticateGoogleUser(string val)
{
SpreadsheetsService service = new SpreadsheetsService("NodeLookupProgram");
service.setUserCredentials(ConfigurationManager.AppSettings["username"].ToString(), ConfigurationManager.AppSettings["passcode"].ToString());
return service;
}
示例4: getWorksheetList
//Fetch all worksheets for given Spreadsheet
public static ArrayList getWorksheetList(string userName, string passWord, string spreadSheetName)
{
ArrayList worksheetList = new ArrayList();
SpreadsheetsService service = new SpreadsheetsService(spreadSheetName + "Service");
//You could set it up from DB or config file also. This is not a reccomended way. Just an easy way to show fetching
service.setUserCredentials(userName, passWord);
SpreadsheetQuery query = new SpreadsheetQuery();
SpreadsheetFeed feed = service.Query(query);
foreach (SpreadsheetEntry entry in feed.Entries)
{
if (entry.Title.Text == spreadSheetName)
{
AtomLink link = entry.Links.FindService(GDataSpreadsheetsNameTable.WorksheetRel, null);
WorksheetQuery wquery = new WorksheetQuery(link.HRef.ToString());
WorksheetFeed wfeed = service.Query(wquery);
foreach (WorksheetEntry worksheet in wfeed.Entries)
{
worksheetList.Add(worksheet.Title.Text);
}
}
}
return worksheetList;
}
示例5: SpreadSheet
public SpreadSheet()
{
service = new SpreadsheetsService("stock-market");
service.setUserCredentials("shurai", "$gva99void!");
SpreadsheetQuery query = new SpreadsheetQuery();
SpreadsheetFeed feed = service.Query(query);
SpreadsheetEntry ssentry = (SpreadsheetEntry)feed.Entries[0];
AtomLink sslink = ssentry.Links.FindService(GDataSpreadsheetsNameTable.WorksheetRel, null);
WorksheetQuery wkquery = new WorksheetQuery(sslink.HRef.ToString());
WorksheetFeed wkfeed = service.Query(wkquery);
WorksheetEntry wkentry = (WorksheetEntry)wkfeed.Entries[0];
listFeedLink = wkentry.Links.FindService(GDataSpreadsheetsNameTable.ListRel, null);
listQuery = new ListQuery(listFeedLink.HRef.ToString());
listFeed = service.Query(listQuery);
Console.WriteLine("Worksheet has {0} rows: ", listFeed.Entries.Count);
foreach (ListEntry worksheetRow in listFeed.Entries)
{
ListEntry.CustomElementCollection elements = worksheetRow.Elements;
foreach (ListEntry.Custom element in elements)
{
Console.Write(element.Value + "\t");
}
Console.WriteLine();
}
}
示例6: AllCells
public ActionResult AllCells()
{
SpreadsheetsService service;
service = new SpreadsheetsService("DevFestEvent");
service.setUserCredentials(
ConfigurationManager.AppSettings["GoogleUser"],
ConfigurationManager.AppSettings["GoogleUserPassword"]);
SpreadsheetQuery q = new SpreadsheetQuery(App.SheetFeedData);
var feed = service.Query(q);
AtomLink l = feed.Entries.First().Links.FindService(GDataSpreadsheetsNameTable.WorksheetRel, null);
WorksheetQuery query = new WorksheetQuery(l.HRef.ToString());
WorksheetFeed f = service.Query(query);
foreach (var item in f.Entries)
{
AtomLink cellFeedLink = item.Links.FindService(GDataSpreadsheetsNameTable.CellRel, null);
var cellfeedlink = cellFeedLink.HRef.ToString();
CellQuery cquery = new CellQuery(cellfeedlink);
CellFeed cfeed = service.Query(cquery);
Console.WriteLine("Cells in this worksheet:");
uint rownum = 2;
foreach (CellEntry curCell in cfeed.Entries)
{
rownum = curCell.Cell.Row;
}
}
return View(f);
}
示例7: GoogleClient
public GoogleClient(TrelloStatsConfiguration configuration)
{
_configuration = configuration;
_service = new SpreadsheetsService("trelloStats");
_service.setUserCredentials(_configuration.GmailEmailAddress, _configuration.GmailPassword);
_configuration = configuration;
}
示例8: SpreadsheetProxy
public SpreadsheetProxy(Credentials credentials)
{
spreadsheetService = new SpreadsheetsService("groundfloor-svc1");
spreadsheetService.setUserCredentials(credentials.username, credentials.password);
documentService = new DocumentsService("groundfloor-svc2");
documentService.setUserCredentials(credentials.username, credentials.password);
}
示例9: DatabaseClient
public DatabaseClient(string username, string password) {
var docService = new DocumentsService("database");
docService.setUserCredentials(username, password);
documentService = docService;
var ssService = new SpreadsheetsService("database");
ssService.setUserCredentials(username, password);
spreadsheetService = ssService;
}
示例10: GetWords
public IEnumerable<Word> GetWords()
{
if (Enabled)
{
SpreadsheetsService GoogleService = new SpreadsheetsService("LanguageBooster");
// FIX ME: Remove credentials from code.
GoogleService.setUserCredentials("xxx", "xxx");
SpreadsheetQuery SpreadsheetsQuery = new SpreadsheetQuery();
SpreadsheetFeed Spreadsheets = GoogleService.Query(SpreadsheetsQuery);
// Get list of spreadsheets
foreach (SpreadsheetEntry WordsSheet in Spreadsheets.Entries)
{
System.Diagnostics.Trace.WriteLine(WordsSheet.Title.Text);
System.Diagnostics.Trace.WriteLine(WordsSheet.Title.Text);
// Get list of worksheets from spreadsgett
WorksheetFeed Worksheets = WordsSheet.Worksheets;
WorksheetEntry CurrentWorksheet = null;
foreach (WorksheetEntry Worksheet in Worksheets.Entries)
{
CurrentWorksheet = Worksheet;
break;
}
AtomLink CellsLink = CurrentWorksheet.Links.FindService(GDataSpreadsheetsNameTable.CellRel, null);
CellQuery CellsQuery = new Google.GData.Spreadsheets.CellQuery(CellsLink.HRef.ToString());
CellFeed Cells = GoogleService.Query(CellsQuery);
Word word = null;
// Load actual table data
foreach (CellEntry CurrentCell in Cells.Entries)
{
if (CurrentCell.Column == 1)
{
word = new Word();
word.Question = CurrentCell.Value;
}
if (CurrentCell.Column == 2)
{
word.Answer = CurrentCell.Value;
System.Diagnostics.Trace.WriteLine(word.Question + " - " + word.Answer);
yield return word;
}
}
}
}
}
示例11: SpreadsheetManager
public SpreadsheetManager( string userName, string password, string applicationName, string clientId, string clientSecret, string redirectUri, string scope )
{
oAuthParams = new OAuth2Parameters()
{
ClientId = clientId,
ClientSecret = clientSecret,
RedirectUri = redirectUri,
Scope = scope
};
_spreadsheetsService = new SpreadsheetsService( applicationName );
_spreadsheetsService.setUserCredentials( userName, password );
}
示例12: Index
//
// GET: /Spreadsheet/
public ActionResult Index()
{
SpreadsheetsService service;
service = new SpreadsheetsService("Spreadsheet-GData-Sample-App");
service.setUserCredentials(
ConfigurationManager.AppSettings["GoogleUser"],
ConfigurationManager.AppSettings["GoogleUserPassword"]);
SpreadsheetQuery query = new SpreadsheetQuery();
var feed = service.Query(query);
return View(feed);
}
示例13: WatchNotify
public WatchNotify(string googleUserName, string googlePassword, IEmailService mailService)
{
if (String.IsNullOrEmpty(googleUserName) || String.IsNullOrEmpty(googlePassword))
throw new ArgumentException("Please provide google credentials");
GoogleUserName = googleUserName;
GooglePassword = googlePassword;
MySpreadsheetService = new SpreadsheetsService("AuctionWatchNotify");
MySpreadsheetService.setUserCredentials(GoogleUserName, GooglePassword);
if (!mailService.CheckConnection())
throw new ArgumentException("Please pass in a working email service account");
MyEmailService = mailService;
}
示例14: LogInButton_Click
private void LogInButton_Click(object sender, RoutedEventArgs e)
{
try
{
SpreadsheetsService service = new SpreadsheetsService("dyselon-cardmaker-v1");
service.setUserCredentials(this.Username.Text, this.Password.Password);
Service = service;
}
catch (Exception ex)
{
MessageBox.Show(String.Format("Failed to log in with error:\n\n{0}", ex.ToString()));
return;
}
this.DialogResult = true;
this.Close();
}
示例15: CSS
public ContentResult CSS()
{
SpreadsheetsService service;
service = new SpreadsheetsService("DevFestEvent");
service.setUserCredentials(
ConfigurationManager.AppSettings["GoogleUser"],
ConfigurationManager.AppSettings["GoogleUserPassword"]);
var cellfeedlink = App.SheetFeedCSS;
CellQuery cquery = new CellQuery(cellfeedlink);
CellFeed cfeed = service.Query(cquery);
string ans = "";
foreach (CellEntry curCell in cfeed.Entries)
{
ans += curCell.Cell.Value;
}
return Content(ans, "text/css");
}