有人知道我在哪里可以找到一个简单的示例 C# 代码示例吗?显然很难找到。
我刚刚开始,得到了我的开发者密钥。
初始(真的是菜鸟问题/假设)--我的解决方案可以(应该/必须)成为 Web 服务客户端吗?我不需要在 .Net 中安装新的库,对吗?
基本上,作为一项测试,我希望能够安全地以 html 格式显示私人笔记本中的单个笔记,类似于以 html 格式导出的 Everfort 在外部网站上的样子。
提前谢谢了!
您应该首先从http://www.evernote.com/about/developer/api/下载我们的 API ZIP 。您将在 /sample/csharp 中找到 C# 客户端示例代码。此示例代码演示了如何从使用用户名和密码进行身份验证的桌面应用程序中使用 Evernote API。
我不确定你是否有过这个工作,但今天早上我在玩 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);
http://weblogs.asp.net/psteele/archive/2010/08/06/edamlibrary-evernote-library-for-c.aspx可能会有所帮助。正如作者所说,它只是捆绑了一些并修复了一些。我自己还没有尝试过,但我想我会提到一种可能更简单的入门方法。可能。
这可能也有帮助...使用 Way Back Machine 找到它,因为原始博客站点处于脱机状态。
原博文:http ://web.archive.org/web/20090203134615/http://macrolinz.com/macrolinz/index.php/2008/12/
向下滚动并找到 12 月 26 日的帖子 - “趁热拿走……”