How to Display Informational Messages in a Console Action

April 28 2010 17 comments

Editing menu console actions already have a method to display errors, but there isn’t any public API for ShowMessage, and that’s unfortunate.

Fortunately, by using Reflector, I was able to find out how Microsoft uses ConsoleMessage class to display informational messages in a Console Action. I’m not sure why this class is an internal class, but anyway I found a solution and it works just fine.

Here is an unsupported way (reflection) to display informational messages in Console Actions:

public static void ShowMessage(string message)
{
  var type = typeof(ConsoleError)
    .Assembly
    .GetType("Microsoft.SharePoint.Publishing.WebControls.ConsoleMessage");
 
  HttpContext.Current.Items["CurrentConsoleMessage"] =
    Activator.CreateInstance(type, new[] { message });
}

Popularity: 7% [?]

17 comments to “How to Display Informational Messages in a Console Action”

  1. Excellent blog! Do you have any helpful hints for aspiring writers?
    I’m planning to start my own blog soon but I’m a little lost
    on everything. Would you recommend starting with a free platform like WordPress or go for a paid
    option? There are so many options out there that I’m totally overwhelmed .. Any recommendations? Bless you!

    Also visit my blog – commercial pest control (i-hate-bedbugs.blogspot.com)

  2. rut ham cau says:

    We’re a gaggle of volunteers and opening a new scheme in our community. Your web site provided us with valuable info to work on. You have performed an impressive activity and our entire community will probably be grateful to you.

  3. Emile says:

    My family all the time say that I am wasting my time
    here at web, but I know I am getting knowledge every day by reading such good articles.

  4. Everything posted made a ton of sense. However, think about this, what if
    you typed a catchier title? I ain’t saying your content isn’t solid., but
    what if you added a title to maybe grab folk’s attention?
    I mean How to Display Informational Messages in a Console Action |
    SharePoint Blues is a little boring. You ought to peek at Yahoo’s home page and
    see how they write article headlines to grab viewers to open the links.
    You might add a related video or a picture or two to
    get people interested about everything’ve got to say.
    Just my opinion, it would make your posts a little bit
    more interesting.

  5. Needed to send you that bit of remark in order to say thanks a lot yet again with your nice techniques you’ve documented at this time.

  6. Amazing issues here. I am very glad to look your article.
    Thank you a lot and I’m looking forward to touch you.

    Will you kindly drop me a mail?

  7. Bravo pour le internet sites je le trouve vraiment magnifique. je vais partager cette azrticle sur mon page twitter

  8. Karri says:

    It’s actually a nice and useful piece of information. I am happy that you shared this helpful info with
    us. Please keep us informed like this. Thanks for sharing.

  9. Thankfulness to my father who told me regarding this webpage, this webpage is in fact awesome.

  10. Congratulations, your blog is appealing and informative. Going through your Information, I found quite a few new ideas to implement.

  11. Bernd says:

    Tazer App for i – Phone can be used for Self-defense purpooses if a criminal iss stupid enough.
    As you list down the features that you will build inn your application to be shared with the i – Paad application developer, you will already know what the market is like, what youir competitors are doing and
    how muuch have they been able to reach out to their audience.
    With an i – Phone VPN you can interact with yokur company’snetwork or
    your personal email and have ecure access via Exchange Active –
    Sync, IMAP, Cal – DAV aand Card – DAV, IPSec as well as
    SSL VPN.

  12. site says:

    Frrom begnning to end, thewe strategies can be tailored by hand
    to the likes of tthe promoter, maaking the game
    closer to the original oncept as currently possible. Another
    popular bowling variant is the Five-pin bowling which is often played in Canada.

    And since that time, their steady pokpularity has been quickly growing.

  13. www.mommiesplayground.com says:

    I believe you have mentioned some very interesting points , thankyou for the post.

  14. Carley Neblock says:

    Not to hijack this thread, but, I’m looking for Atlanta dentists and I can’t figure out how to find them… has anyone ever heard of this Atlanta dentist? They’reIt’s based out of Atlanta, only 15 minutes from me. I am not able to find reviews on them – Exceptional Smile LLC, 4420 Bankers Cir, Atlanta, GA 30360 – (678) 841-8800

  15. It was a shock that this was the first time encounter
    for the majority of pupils onn the social marketing melbourne (http://www.localbusinesssearch.com.au) Superstar since
    iits relaunch 15 months back.

  16. This piece of writing presents clear idea for the new viewers of blogging, that actually how to do
    blogging and site-building.

  17. forex forum says:

    I’m no longer sure where you are getting your information, but great topic.
    I needs to spend some time learning more or working out more.

    Thanks for great info I used to be searching for this information for my mission.

Leave a Reply