août
28
2006

C# implementation of newMediaObject for the MetaWeblog API

If you have a blog you might know about the MetaWeblog API. I implemented it for Tech Head Brothers portal to be able to post news from a client. Today I am using Live Writer to post on my blog and I also wanted to have the possibility to post news on the new version of Tech Head Brothers portal but with pictures and without the usage of a ftp server.

Checking the API I found a new method that I had not implemented: newMediaObject.

metaWeblog.newMediaObject (blogid, username, password, struct) returns struct

The blogid, username and password params are as in the Blogger API.

The struct must contain at least three elements, name, type and bits.

name is a string, it may be used to determine the name of the file that stores the object, or to display it in a list of objects. It determines how the weblog refers to the object. If the name is the same as an existing object stored in the weblog, it may replace the existing object.

type is a string, it indicates the type of the object, it's a standard MIME type, like audio/mpeg or image/jpeg or video/quicktime.

bits is a base64-encoded binary value containing the content of the object.

The struct may contain other elements, which may or may not be stored by the content management system.

If newMediaObject fails, it throws an error. If it succeeds, it returns a struct, which must contain at least one element, url, which is the url through which the object can be accessed. It must be either an FTP or HTTP url.

I defined in the interface two struct as following:

public struct MediaObjectUrl
{
    public string url;
}

public struct MediaObject
{
    public string name;
    public string type;
    public byte[] bits;
}

Added the method in the IMetaWeblog interface:

[XmlRpcMethod("metaWeblog.newMediaObject",
    Description="Add a media object to a post using the "
                + "metaWeblog API. Returns media url as a string.")]
MediaObjectUrl newMediaObject(
    string blogid,
    string username,
    string password,
    MediaObject mediaObject);

And finally the following implementation:

/// <summary>
/// Post a media object.
/// </summary>
/// <param name="blogid">The blogid.</param>
/// <param name="username">The username.</param>
/// <param name="password">The password.</param>
/// <param name="mediaObject">The media object.</param>
/// <returns>MediaObjectUrl  defining the url of the media</returns>
public MediaObjectUrl newMediaObject(string blogid, 
                                     string username, 
                                     string password, 
                                     MediaObject mediaObject)
{
    if (!ValidUser(username, password))
        throw new XmlRpcFaultException(0, "You have no right to do that.");
 
    string filename = Path.Combine(HttpContext.Current.Request.PhysicalApplicationPath, 
                                   "images/" + mediaObject.name);
 
    if (!Directory.Exists(Path.GetDirectoryName(filename)))
        Directory.CreateDirectory(Path.GetDirectoryName(filename));
 
    File.WriteAllBytes(filename, mediaObject.bits);
 
    MediaObjectUrl mediaObjectUrl = new MediaObjectUrl();
    mediaObjectUrl.url = ConfigurationManager.AppSettings["BlogUrl"] + 
                         "/images/" + 
                         mediaObject.name;
 
    return mediaObjectUrl;
}

The good point now is that I am able to let the authors of the site post news with embeded pictures without managing a ftp server. 

août
26
2006

Internet Explorer 7 RC1 and Mouse Gesture

I downloaded for the first time the new version of Internet Explorer and I find quite cool.

You might download it on this page.

And then you need the must have plugin, Mouse Gestures for Internet Explorer

août
25
2006

It is coming as open source :-)

soon and on a well known place now...

août
17
2006

BlogThisUsingWriterPlugin coming soon

OK I fixed my main issue. I wasn't able to have my plugin loaded by Jetbrains Omea, and it seems that it is linked with the .NET Framework 2.0 that I use in my plugin, even if Omea Reader is running using .NET Framework 2.0 somehow it can't verify the plugin.

I had to install MSBee so I don't need to install VS 03 again. And now back to the old days of command line I have to compile using such a command:

msbuild BlogThisUsingWriterPlugin.csproj /t:Rebuild /p:TargetFX1_1=true

After modifying my csproj MSBuild file to use MSBee

So this is how it look likes in Omea Reader

And the result in Windows Live Writer:

Not bad.

That will be my second plugin for Live Writer and it will be also on Codeplex in Windows Live Writer Plugins project.

Thanks to Christopher Frazier for the kind help compiling my project on VS 03.

Ok it is 2:01 AM, time to go to bed.

août
17
2006

Windows Media Player Currently Playing Plugin for Windows Live Writer uploaded to Codeplex

I just finished the first release of the plugin. Now you are free to download the source from Codeplex on this page.

août
17
2006

Windows Media Player Currently Playing Plugin for Windows Live Writer

 That's my first plugin for Windows Live Writer and it will be published on Codeplex in the project Windows Live Writer Plugins.

Here it is how it looks like in Live Writer:

And you might see the result of it here:

[ Currently Playing : Water From A Vine Leaf - William Orbit - The Best Of Strange Cargos (07:02) ]

août
16
2006

BlogThisUsingWriterPlugin - Omea weblog posting extension for Windows Live Writer

I started to code a plugin that will implement the famous IBlogExtension for Omea Reader and Pro to target Windows Live Writer.

It will let you select one feed in Omea, right click on it and choose BlogThis, and it will fire up Windows Live Writer with the content of the original post.

août
16
2006

Windows Live Writer SDK

I installed it and searched where it was installed without any success till it was indexed by desktop search. So for those who might search like me it is in My Documents\Windows Live Writer SDK (Beta).

août
16
2006

Tech Ed Richard, not TechHead :)

When I  was awarded the first time as MVP, one of the first MVP I met was Richard Clark, a cool guy. And I am happy to see some confusion in one of his last post ;)

"J'ai participé à pas mal d'events de Microsoft, et à part les PDC et TechHead, je pense qu'Imagine Cup est bien l'un des évènements les plus gros de MS."

"I participated to quite some Microsoft events, and apart from PDC and TechHead, I think Imagine Cup is one of the biggest event of MS"

He is one judge of the Imagine Cup and created the Project Hoshimi, as far as I know. The idea was in his head at the first MVP Summit we had together in 2002 or 2003, I can't remember.

Tech Ed is the Microsoft event all of us knows and Tech Head, that became later on Tech Head Brothers is my french portal about .NET technologies.

Thanks a lot the advertisement Richard ;)

Update: The whole story about the idea of Project Hoshimi is in the last post of Richard (in french) and again he is using TechHead ;)

août
15
2006

1024/256 :-) at last

At last I get an update to my ADSL connection, I had 512/128 since the beginning (2001). I was one of the first to get ADSL in Mulhouse. I really had to push and push to get a modem. The frustrating point was that I saw all others getting faster and faster and me staying at 512/128. I tried several time to change but I was always said your are too far you can't get more.

Yesterday I saw that they changed the page on which you can update your abo, then I tried for the 2000th time to update and this time it was ok for 1024/256 :-) And for the same price, cool.

After one day my abo was updated and now I really have 1024/256 even with this kind of line:

Longueur de ligne :
 4175 mètres

 4/10 sur 3332m, 6/10 sur 843m

Affaiblissement :
 58.66 dB

I know it is ridiculous compared to some friends but it is a good day for me :-).

Didier, the link to update is here ;-)

Philippe, please stop laughing.

About Laurent

Laurent Kempé

Laurent Kempé is the editor, founder, and primary contributor of Tech Head Brothers, a French portal about Microsoft .NET technologies.

He is currently employed by Innoveo Solutions since 10/2007 as a Senior Solution Architect, certified Scrum Master and Founding Member.

Founder, owner and Managing Partner of Jobping, which provides a unique and efficient platform for connecting Microsoft skilled job seekers with employers using Microsoft technologies.

Laurent was awarded Most Valuable Professional (MVP) by Microsoft from April 2002 to April 2012.

JetBrains Academy Member
Certified ScrumMaster
My status

Twitter

Flickr

www.flickr.com
This is a Flickr badge showing public photos and videos from Laurent Kempé. Make your own badge here.

Month List

Page List

Laurent Kempé | Build .NET projects from Windows Explorer using MSBuild Launch Pad (mPad)
Jun
4
2010

Build .NET projects from Windows Explorer using MSBuild Launch Pad (mPad)

In September 2009 I posted about a tool I am using to build my MSBuild projects from the shell “Build your .NET project with a right click in Windows Explorer

Last week I changed to MSBuild Launch Pad (mPad) which also add a context menu when you right click your project or solution files.

The added value for me is that it maintained project, 1.0 was released on May 21, 2010 with following release notes:

    • Support sln, csproj, vbproj, vcxproj, shfbproj, ccproj, oxygene and proj files execution.
    • Basic settings such as Show Prompt, and Auto Hide are provided.
    • MSBuild Shell Extension integration is achieved.

I also very much like that when I right click and say build I get the control on the .NET framework version I want to use and if it is a Release, Debug or what so ever.

4668737460_d5f6fd3791_o[1]

Nice little productivity booster tool.

Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading

About Laurent

Laurent Kempé

Laurent Kempé is the editor, founder, and primary contributor of Tech Head Brothers, a French portal about Microsoft .NET technologies.

He is currently employed by Innoveo Solutions since 10/2007 as a Senior Solution Architect, certified Scrum Master and Founding Member.

Founder, owner and Managing Partner of Jobping, which provides a unique and efficient platform for connecting Microsoft skilled job seekers with employers using Microsoft technologies.

Laurent was awarded Most Valuable Professional (MVP) by Microsoft from April 2002 to April 2012.

JetBrains Academy Member
Certified ScrumMaster
My status

Twitter

Flickr

www.flickr.com
This is a Flickr badge showing public photos and videos from Laurent Kempé. Make your own badge here.

Month List

Page List