I am writing a C# TBB for CT. i need to check all images in a folder and publish them. Do we have any method to check published path of a particular binary. I don't want to republish the binaries untill its not changed.

    if (Component.Schema.Title.Equals("Album"))
                                string k = Component.OrganizationalItem.Id;
                                OrganizationalItem folder = engine.GetObject(k) as OrganizationalItem;
                                IList<Component> list = folder.Components(true);
                                foreach (Component comp in list)
                                    if (comp.Schema.Title.Equals("multimedia image schema") )
                                        Filter f = new Filter();
                                        //f.Conditions["ItemType"] = ItemType.Component;
                                        f.Conditions["ItemType"] = ItemType.MultimediaType;
                                        xml.WriteAttributeString("id", comp.Id);

                                       // need to check if binaries are published and what its published path
                                        xml.WriteAttributeString("src", PublishBinary(comp));



I am publishing an xml containing all information of those multimedia types like alt text, src, date, country etc.

1 Answer 1


You can get the location that binaries are published to by default from Publication.MultimediaUrl. You will need to do a bit more work to detect if binaries have been updated since the last time they were published however.

  • You will need to check different targets depending on whether you are publishing to staging or live, so will need to have some configuration somewhere to give you the base site domain based on the publication + publication target/target type.
  • The modified date of the binary on the webserver is very unlikely to be the same as the modification date of the binary component in the CMS (the deployer server(s) could be in different timezone(s), the binary could have been updated after the XML is rendered, but before it is deployed and so on...)
  • Your PublishBinary method may publish the binaries to different locations than the default

A better approach might be to check the last time your XML page was published to the corresponding target (you can see this in the Content Explorer, by selecting Where used on the page and going to the Published To tab, so it must be possible using the API) and using this date as the basis for your comparison.

I assume that you still want to put the image path in your XML even if you don't publish it, so in this case you will have to build the path manually, rather than using PublishBinary.

  • How can we check if it is published or not for a multimedia component? Commented Mar 17, 2014 at 14:08
  • You can't - and I am not suggesting you do that - My recommended approach is to check the last published time for the XML file, and compare that to the revision date of the binary in the CMS
    – Will Price
    Commented Mar 17, 2014 at 14:22
  • its a good idea but in this case i will not be able to find first time publishing . Please note that path is not same for all publications. Commented Mar 18, 2014 at 10:51
  • First time publishing, you would want to publish all the binaries anyway wouldn't you? If you read the path from Publication.MultimediaUrl in the context publication where you are publishing the page, then it doesnt matter if its not the same for all publications
    – Will Price
    Commented Mar 18, 2014 at 10:52
  • No i don't want to publish all the images that's why I need to know its publishing status. Commented Mar 18, 2014 at 11:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.