Locked Get Blog Id within a plugin

  • quinta-feira, 3 de janeiro de 2008 17:08
     
     

    Is there some way to retrieve the blog id from within a plugin?

    TIA.

Todas as Respostas

  • quinta-feira, 3 de janeiro de 2008 18:50
     
     
    Hi.

    Do you create an inserting plugin using the SmartContentSource Class? If you want to classify blogs, you can use the IPublishingContext.AccountId Property. This value is contained arguments of the GeneratePublishHtml and the GenerateEditorHtml method.
    If you want user accounts of blogs, I think that probably the SDK isn't supported the way.

  • quinta-feira, 3 de janeiro de 2008 22:44
     
     

    Hmm...The AccountId property isn't helpful, but this does give me an idea. I'll probably append the Blog Id to the Engine Name so I can retrieve it with the ServiceName property. Sort of convoluted, but I'll be able to do what I'm trying to.

  • domingo, 6 de janeiro de 2008 22:24
     
     
    You could use the AccountId to retrieve the blog account information directly from the registry: HKCU\Software\Microsoft\Windows Live\Writer\Weblogs\{id}. This obviously isn't something I can officially recommend and will likely break with future versions of WLW (as we may move away from using the registry for our settings) so keep those caveats firmly in mind if you intend to release your plugin for public consumption.
  • segunda-feira, 4 de janeiro de 2010 12:58
     
     
    Hi All,
            as said in above blog that we can get published html infromtion from this IPublishingContext.AccountId Property
    But when i use this like public override string GeneratePublishHtml(ISmartContent content, IPublishingContext publishingContext)
            {
                IPublishingContext ps = publishingContext;
               
                string str = "";
                try
                {         
                    string mycontent=content.Properties.GetString("Path", "nosdnf");
                    if (Convert.ToString(ps.PostInfo.Contents) != "")
                    {
                        str = mycontent;
                    }
                    else
                    {
                        str += "<a style='border:0px' href=''><img style='border:0px' alt='View test' src='" + mycontent + "' /></a>";
                        str += "<a href=''>View Full Album</a>";
                    }
                    //str += "<img src='" + content.Properties.GetString("Path", "nosdnf") + "'></img></span>";                           
                }
                catch (Exception ex)
                {
                    PluginDiagnostics.DisplayError("Generate Html", ex.Message);
                }
                return str;

            }
    So it recursively called the same function...
    one another thing here is that ... anything which return by this method is appended by DIV tag so is that any way to remove it ?