2012-03-15 83 views

回答

1

有名爲PublishWithChildrenWithResult()Document類的方法。根據源代碼,這將遞歸發佈分支下的所有內容:

public bool PublishWithChildrenWithResult(User u) 
    { 
     if (PublishWithResult(u)) 
     { 
      foreach (cms.businesslogic.web.Document dc in Children.ToList()) 
      { 
       dc.PublishWithChildrenWithResult(u); 
      } 
     } 
     else 
     { 
      return false; 
     } 

     return true; 
    } 
0

使用新contentService的API,你會做到這一點,像這樣:

var cs = ApplicationContext.Current.Services.ContentService;  
cs.PublishWithChildrenWithStatus(nodeToPublish, includeUnpublished:true) 

最後一個參數允許您指定是否你也希望發佈未發表的後代。 這種方法有點遺漏,因爲它會發布所有後代,而不僅僅是兒童。