Viddler.Net on Codeplex

August 22nd, 2008 by Sander Schutten

Things are moving fast. Yesterday I released an early first version of Viddler.Net, a wrapper for the Viddle API. Today I was able to post an updated version to Codeplex, which seems more suitable for managing this project than my own blog. The updated version uses HTTP POST instead of GET and includes one extra implemented method to upload videos.

Find the Codeplex project at http://www.codeplex.com/ViddlerDotNet

Posted in General | No Comments »

First release of Viddler.Net

August 20th, 2008 by Sander Schutten

If you read my article in the Dutch .Net Magazine about Vista Media Center add-ins and you came looking on my blog for the Viddler.Net api, you just found it! If you don’t know what I’m talking about, please read on :)

This is my first release of the Viddler.Net api, which is a wrapper for the Viddler api. The Viddler.Net api allows a .Net developer to make use of the videos on the Viddler website through code. At this stage not all methods are implemented, but they will be soon. In the download you’ll find the full source code of the api including the unit tests. To be able to run the unit tests you need to modify the app.config and put in your own username, password and api key. You can request you api key here.

If you want to use Viddler.Net in your own project, you need to add a Viddler.Net configuration section to your app.config or web.config. To do this you first need to declare the configuration section in the <configSections> section in top of the configuration file. Then you need to define the configuration section somewhere below the configSections section, but between the <configuration>elements. You configuration file should look something like this:

1
2
3
4
5
6
7
8
9
10
11
12
<configuration>
  <configSections>
    <section
      name="viddlerNetSettings"
      type="Avanade.ViddlerNet.Settings, Avanade.ViddlerNet, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
      />
  </configSections>
 
  <viddlerNetSettings
    apiKey="yourApiKeyHere"
    baseUrl="http://www.viddler.com/rest/v1/?method={0}&api_key={1}" />
</configuration>

Download Viddler API wrapper for .Net 2.0 Version v0.1 beta

Downloaded a total of 431 times

 

Note that not all methods are currently implemented or working correctly. I’m working on getting them all to work, but I thought to release a version now, while I’m still improving it. The current status is represented by the following test results overview (click to enlarge):

On my todo-list is currently:

  • Implement all methods
  • Complete all unit tests
  • Change http method from GET to POST to allow more characters for some parameters

Posted in General, Media Center | 3 Comments »

Map xs:string to xs:datetime

July 1st, 2008 by Sander Schutten

Remember that situation where you needed to convert a string representation of a DateTime to a valid DataTime using the BizTalk mapper? No? Well, I do. The parsing of the string as a DateTime is not the real problem here. Once you know how the string is formatted it is simply writing a way to parse it, either using substrings or using the DateTime.Parse method. Once you have a DateTime though, you need to format it to be valid according to the XSD spec. That’s exactly where DateTimes and the BizTalk mapper can give you a headache. Especially when you’re dealing with different locales under which BizTalk is running this can be quite cumbersome. There is however a good way of converting a string to a valid datetime and I’ll show you how in the following code sample:

?View Code CSHARP
1
2
3
4
5
6
7
8
9
// We'll be using the W3cXsd2001class from the Metadata namespace
using System.Runtime.Remoting.Metadata;
 
// Parse a string as a DateTime. This could be a string coming
// from the source message.
DateTime myDateTime = DateTime.Parse("07/01/2008");
 
// This method returns the current DateTime into a xs:DateTime
string dateTimeString = W3cXsd2001.SoapDateTime.ToString( myDateTime );

Happy coding :)

Posted in BizTalk Server | 2 Comments »