locked
Writer SDK Bug? RRS feed

  • General discussion

  •  Hey guys,
     
    Think I've found a little bug in the new SDKs. When you do a HeaderFooterSource plugin, in the publish and preview html methods, we're given an IPublishingContext object, but the IPostInfo in that object contains no information. So if my plugin wants to check what's in the Contents or the Title, it will fail everytime as the title and contents are blank.
     
    I have attached some sample code to demonstrate this. I'm guessing this is a bit of an oopsy :D

            public override string GeneratePreviewHtml(ISmartContent smartContent, IPublishingContext publishingContext, out HeaderFooterSource.Position position)  
            {  
                string code = string.Empty;  
                string content = publishingContext.PostInfo.Contents;  
                if (string.IsNullOrEmpty(content))  
                {  
                    code = "<p>There's nothing in the IPostInfo dude!</p>";  
                }  
                else 
                {  
                    code = "<p>Oh, yes there is.</p>";  
                }  
                position = Position.Footer;  
                return code;  
            } 

    (PS, I have sent this to Joe and Charles)
    SL - Windows Live Platform MVP
    Tuesday, June 10, 2008 2:55 PM

All replies

  • Ok, apparently this is the problem describe in the SDK release post (http://writerdevzone.spaces.live.com/blog/cns!FF912D98C958E9D3!170.entry) where it says:

    "According to the “New SDK Features.doc”, content source plugins can now read the title, body, and other properties from the active blog post. In this release, support for this scenario is incomplete."

    The work around for this is to just save the blog post. I think this work around should have been mentioned in that blog post ;)
    SL - Windows Live Platform MVP
    Tuesday, June 10, 2008 4:10 PM
  • We were only aware of this for SmartContentSource, not HeaderFooterSource. You're seeing it for the latter? And if so, I assume that overriding RequiresPermalink to return true fixes it?
    Wednesday, June 18, 2008 5:27 AM
    Moderator
  • I didn't try overriding the RequiresPermalink, I shall give that a try and confirm. But yes, it definately does happen with HeaderFooterSource plugins.
    SL - Windows Live Platform MVP
    Sunday, June 22, 2008 8:21 AM