public void AddBinariesFromFolder(string rootSGWebDavUrl, Folder folder, string path) { //Try to get a reference to the sub Structure Group based on the folder title StructureGroup sg = _engine.GetObject(rootSGWebDavUrl + path) as StructureGroup; if (sg == null) { Exception ex = new Exception(String.Format("Could not find Structure Group {0}. Please create this and republish", rootSGWebDavUrl + path)); _logger.Error(ex.Message); throw ex; } //Loop through all components in the folder foreach (Component comp in folder.GetComponents(true)) { if (comp.ComponentType == ComponentType.Multimedia) { AddBinary(comp, sg); } } }