Code Monkey home page Code Monkey logo

carddavnet's Introduction

CardDav.Net

C# .Net Implementation of the CardDav Client Protocol

Originally based off of: https://raw.github.com/graviox/CardDAV-PHP/master/carddav.php

Written from the ground up in C#, with vCard Reader and Writer from: http://www.codeproject.com/Articles/16030/NET-vCard-API-for-creating-and-parsing-vCards

Thanks Lumi!

Though the vCard reader and writer needs to be updated to meet the new vCard 4.0 specification!

Be sure to replace the word username with the proper email account you are trying to access.

Simple usage for connecting to a CardDAV server:

using CardDav;
using CardDav.Card;
using CardDav.Response;

CardDav.Client client = new CardDav.Client("url of carddav server go here", "username", "some password");

CardDavResponse response = client.Get();

/** Output the results from the Listing **/

//Assuming you have a result text box to output too :P

resultsTxt.Text = response.ToString();

/** Set the client to the proper Address Book server URL **/
// This is heavily assumming that there are address books and vcards!
// Always check to see if CardDavResponse.AddressBooks.Count > 0
// And always check to see if CardDavResponse.Cards.Count > 0

client.SetServer(response.AddressBooks.First().Url.ToString());
vCard card = client.GetVCard(response.Cards.First().Id);

//Assuming you have a result text box to output too :P

resultsTxt.Text = resultsTxt.Text + "\r\n\r\n\r\n" + card.ToString();

To see a demo application compile and run the CardDavDemo project.

Google CardDAV API

To use this library against Google CardDAV API, you need to:

  1. authenticate using OAuth 2.0 by following Google's instructions
  2. supply the OAuth 2.0 access token you receive to the CardDav.Net constructor
CardDav.Client client = new CardDav.Client("url of carddav server go here", "your OAuth 2.0 access token");

carddavnet's People

Contributors

jansokoly avatar metric avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.