Ask a questionAsk a question
 

AnswerHOWTO: Get current PostApiUrl from ContentSource plugin

Answers

  • Wednesday, October 21, 2009 3:58 PMScott LovegroveMVPUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Unfortunately not, at least, not in ContentSource plugins. You can get the url if you're using a HeaderFooterContentSource or a NotificationHookPlugin type, but not ContentSource.
    SL - Windows Live Platform MVP
    If my post has answered your question, please mark it as an answer.
    • Marked As Answer bymac2000 Thursday, October 22, 2009 7:27 AM
    • Proposed As Answer byScott LovegroveMVPWednesday, October 21, 2009 3:58 PM
    •  

All Replies

  • Wednesday, October 21, 2009 3:58 PMScott LovegroveMVPUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Unfortunately not, at least, not in ContentSource plugins. You can get the url if you're using a HeaderFooterContentSource or a NotificationHookPlugin type, but not ContentSource.
    SL - Windows Live Platform MVP
    If my post has answered your question, please mark it as an answer.
    • Marked As Answer bymac2000 Thursday, October 22, 2009 7:27 AM
    • Proposed As Answer byScott LovegroveMVPWednesday, October 21, 2009 3:58 PM
    •  
  • Friday, November 13, 2009 10:06 PMNewKiwi Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Here is a hack that works on the 14.0.8xxx version of WLW, but you have no promise that Microsoft won't change things.  Set a reference to the WindowsLive.Writer.BlogClient.dll (in the same location the api reference was located) then you can call:

    var blog = new WindowsLive.Writer.BlogClient.Blog( WindowsLive.Writer.BlogClient.BlogSettings.DefaultBlogId )

    which will give you a Blog object and from that you can call:

    blog.PostApiUrl

     


    matthew Hintzen
  • Friday, November 13, 2009 11:21 PMScott LovegroveMVPUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Interesting. I haven't tried this so can't answer my own question as yet. Does that method work if you have multiple blogs configured? I notice that it calls the DefaultBlogId, which I'm guessing would be the one that gets loaded when Writer is opened. Can that BlogSettings class call a different blog?
    SL - Windows Live Platform MVP
    If my post has answered your question, please mark it as an answer.
  • Saturday, November 14, 2009 1:12 AMNewKiwi Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Actually, the DefaultBlogId is changed if you change blogs in WLW.  Which of course makes me suspect that it will be renamed in a future revision of WLW, because you are right "DefaultBlogId" is misleading, it would have been better if they named the property "CurrentBlogId", because that is how it acts. 

    The Id is actually a Guid, that corresponds to key contianing settings for the registered WLW blog, stored in the registry under HKCU\software\microsoft\windows live\writer\weblogs.
    matthew Hintzen