2009-05-05 46 views
1

檢入文檔時,我在ItemCheckingInEvent內執行Web服務。在開發中,沒有問題。我部署了應用程序,事實證明我沒有足夠的權限來讀取配置文件。我的代碼讀取一個配置文件來創建WCF代理。真正的問題是如果我使用SPSecurity.RunWithElevatedPrivileges函數,我怎麼能從我的函數中返回?Sharepoint特權

例如:

SPSecurity.RunWithElevatedPrivileges(delegate() 
{ 

     // exec service call 

}); 

// need data from service call here 

回答

3

高架委託之前就宣告你的工作對象,裏面爲它分配:

object myServiceData = null; 

SPSecurity.RunWithElevatedPrivileges(delegate() 
{ 
     myServiceData = DoServiceStuff(); 
}); 

//do things with myServiceData