2016-08-04 42 views
0

我试图通过控制台应用程序和c#访问我的谷歌驱动器帐户。 我按照指示: https://developers.google.com/drive/v3/web/quickstart/dotnet 和应用程序编译就好了。 第一次运行应用程序时,调试器问我GoogleClientSecrets.cs在哪里。我点击取消。 现在每次我打电话:Google GoogleClientSecrets.Load失败

var d = GoogleClientSecrets.Load(new FileStream("client_secret.json", FileMode.Open)); 

我得到如下对象返回:

d: 
Installed null Google.Apis.Auth.OAuth2.ClientSecrets 
Secrets  'd.Secrets' threw an exception of type 'System.InvalidOperationException' Google.Apis.Auth.OAuth2.ClientSecrets {System.InvalidOperationException} 
Web  null Google.Apis.Auth.OAuth2.ClientSecrets 

,因为该方法GoogleWebAuthorizationBroker.AuthorizeAsync失败,当然还有。 我已经打开谷歌仪表板的API和json文件(client_secret.json)确实存在于正在运行的二进制文件的目录中。

关于如何使加载函数有效的建议?

回答

0

问题是一个损坏的.json文件。不能相信我花了几个小时在这。案件结案。

-1
<td bgcolor="#FFFFFF"></td> 
      <td colspan="15" class="w20 lh20"> 
       <div class="pt5 pb7 massoperation bugf11" id="todoactionslide_${TLDET.TLIST.TLID}" style="display: none; position: relative;"> 
        <div class="fr lh18 subtxt2 pr5"><span id="taskSelected_${TLDET.TLIST.TLID}">0</span>&nbsp;&nbsp;${getI18nValue('zp.bugs.bug_selected')}</div> 
        {{if ("admin"==PROLE || "manager"==PROLE || "jointadmin"==PROLE) && "home"!=PAGEFOR}} 
         <div class="fl pt2 pl6 pr6">