2017-06-26 75 views
0

我剛開始使用API​​更新智能工作表文檔。在公司防火牆後面訪問SmartSheet API C#

在SDK參考中使用示例(csharp-read-write-sheet),只要我在打開的Internet連接上,我就可以更新文檔,但是,當我連接到公司LAN時它報告了代理身份驗證問題。

這是從SDK代碼

string accessToken = ConfigurationManager.AppSettings["AccessToken"]; 
if (string.IsNullOrEmpty(accessToken)) 
    accessToken = Environment.GetEnvironmentVariable("SMARTSHEET_ACCESS_TOKEN"); 
if (string.IsNullOrEmpty(accessToken)) 
    throw new Exception("Must set API access token in App.conf file"); 

// Get sheet Id from App.config file 
string sheetIdString = ConfigurationManager.AppSettings["SheetId"]; 
long sheetId = long.Parse(sheetIdString); 

// Initialize client 
SmartsheetClient ss = new SmartsheetBuilder().SetAccessToken(accessToken).Build(); 

// Load the entire sheet 
Sheet sheet = ss.SheetResources.GetSheet(sheetId, null, null, null, null,  null, null, null); 
Console.WriteLine("Loaded " + sheet.Rows.Count + " rows from sheet: " + sheet.Name); 

能否請您指教我該怎麼配置API提供System.Net.WebProxy對象到客戶端API通過公司代理提供認證路線

回答

1

不幸,SDK不會公開底層的WebRequest對象。 但是,您可以在您的app.config文件中指定代理信息。

例如:

<configuration> 
    <system.net> 
     <defaultProxy> 
      <proxy proxyaddress="http://my-actual-proxy-url" /> 
     </defaultProxy> 
    </system.net> 
</configuration> 

見相關的問題:C# Connecting Through Proxy

+0

好的,謝謝......但是,您能否將此添加爲下一個發佈週期的功能。 –

+0

唯一的問題是,這不允許提供憑據(請參閱下面的我自己的答案) –

+0

是的,添加到我們的積壓 –