2014-05-09 34 views
0

我已經添加了腳本以在創建網站時發送郵件。如果創建的網站是私人網站,如何限制電子郵件通知。這是我的Java腳本在戶外限制私人網站的電子郵件通知

var mail = actions.create("mail"); 

var node = people.getGroup("GROUP_EMAIL_CONTRIBUTORS"); 

    if(node){ 
     var members = people.getMembers(node);   
    } 
mail.parameters.from = "[email protected]" 
mail.parameters.subject=" A new site called " + document.properties.name+" is created"; 
mail.parameters.text="Click http://sameer_w7:8080/share/page/site/" + document.properties.name + "/dashboard" + " to join the site"; 

for(var i=0;i<members.length;i++) 
{ 
    mail.parameters.to = members[i].properties.email; 
//execute action against a document 
mail.execute(document); 
} 

回答

2

你可以瞭解網站的siteVisibility狀態。請點擊SiteService Wiki頁面。

像這樣的東西應該工作:

if (document.properties["st:siteVisibility"] != "PRIVATE"){ 
<your email action here> 
} 

要確保你選擇的類型是ST:在規則的網站,否則上添加額外的檢查。

+0

謝謝我沒有修改腳本,但我修改了規則和ST:網站包含公共,它工作 – samnaction