简单的C#Evernote API OAuth示例或指南?

问题描述:

任何人都知道我能找到一个简单的例子,C#代码示例?显然真的很难找到。简单的C#Evernote API OAuth示例或指南?

我刚刚开始,得到了我的开发人员锁。

初始(真的noob问题/推定) - - 能(应该/必须)我的解决方案是一个Web服务客户端?没有新的库我需要在.Net中安装对吗?

基本上,作为一个测试,我希望能够从一个私人笔记本电脑中安全地呈现一个单一的音符,类似于HTML在外部网站上的Everfort导出。

提前非常感谢!

你应该从http://www.evernote.com/about/developer/api/下载我们的API ZIP启动。您将在/ sample/csharp中找到C#客户端示例代码。此示例代码演示了如何使用来自使用用户名和密码进行身份验证的桌面应用程序的Evernote API。

http://weblogs.asp.net/psteele/archive/2010/08/06/edamlibrary-evernote-library-for-c.aspx可能的帮助。正如作者所说,它只是捆绑一些并修复了一些。没有尝试过自己,但认为我会提到一个可能更简单的方法来开始。有可能。

这也可能有帮助...自从原始博客网站脱机后,使用Way Back Machine发现它。

https://www.evernote.com/pub/bluecockatoo/Evernote_API#b=bb2451c9-b5ff-49bb-9686-2144d984c6ba&n=c30bc4eb-cca4-4a36-ad44-1e255eeb26dd

原来的博客文章:http://web.archive.org/web/20090203134615/http://macrolinz.com/macrolinz/index.php/2008/12/

向下滚动,找到从12月26日的帖子 - “得到它,而它的热...”

我不知道,如果你曾经得到了这个工作,但我今天早上和Evernote,OpenAuth和C#一起玩耍,并设法使它工作。我已经把博客文章/库解释经验,并概述了如何使用MVC在这里做到这一点 - http://www.shaunmccarthy.com/evernote-oauth-csharp/ - 它使用AsyncOAuth库:https://github.com/neuecc/AsyncOAuth

我写周围AsyncOAuth的包装,你会发现这里很有用:https://github.com/shaunmccarthy/AsyncOAuth.Evernote.Simple

一个带刺的东西要注意的 - Evernote的端点(/ OAuth的和/OAuth.action)是区分大小写的

// Download the library from https://github.com/shaunmccarthy/AsyncOAuth.Evernote.Simple 

// Configure the Authorizer with the URL of the Evernote service, 
// your key, and your secret. 
var EvernoteAuthorizer = new EvernoteAuthorizer(
    "https://sandbox.evernote.com", 
    "slyrp-1234", // Not my real id/secret :) 
    "7acafe123456badb123"); 

// First of all, get a request token from Evernote - this causes a 
// webrequest from your server to Evernote. 
// The callBackUrl is the URL you want the user to return to once 
// they validate the app 
var requestToken = EvernoteAuthorizer.GetRequestToken(callBackUrl); 

// Persist this token, as we are going to redirect the user to 
// Evernote to Authorize this app 
Session["RequestToken"] = requestToken; 

// Generate the Evernote URL that we will redirect the user to in 
// order to 
var callForwardUrl = EvernoteAuthorizer.BuildAuthorizeUrl(requestToken); 

// Redirect the user (e.g. MVC) 
return Redirect(callForwardUrl); 

// ... Once the user authroizes the app, they get redirected to callBackUrl 

// where we parse the request parameter oauth_validator and finally get 
// our credentials 
// null = they didn't authorize us 
var credentials = EvernoteAuthorizer.ParseAccessToken(
    Request.QueryString["oauth_verifier"], 
    Session["RequestToken"] as RequestToken); 

// Example of how to use the credential with Evernote SDK 
var noteStoreUrl = EvernoteCredentials.NotebookUrl; 
var noteStoreTransport = new THttpClient(new Uri(noteStoreUrl)); 
var noteStoreProtocol = new TBinaryProtocol(noteStoreTransport); 
var noteStore = new NoteStore.Client(noteStoreProtocol); 
List<Notebook> notebooks = client.listNotebooks(EvernoteCredentials.AuthToken);