小编Jul*_*lio的帖子

如何使用 google Sheets api v4 重命名工作表?

我有一个代码,其目的是重命名特定工作表,但是当执行 BatchUpdate 并且代码被破坏时,有人有任何想法吗?

        public void UpdateSheetName(string sheetName,string newSheetName)
    {
        //get sheet id by sheet name
        Spreadsheet spr = service.Spreadsheets.Get(SpreadsheetId).Execute();
        Sheet sh = spr.Sheets.Where(s => s.Properties.Title == sheetName).FirstOrDefault();
        int sheetId = (int)sh.Properties.SheetId;
        BatchUpdateSpreadsheetRequest bussr = new BatchUpdateSpreadsheetRequest();

        var request = new Request()
        {
              UpdateSpreadsheetProperties= new UpdateSpreadsheetPropertiesRequest(){
                   Properties=new SpreadsheetProperties()
                   {                      
                       Title= newSheetName,

                   },
                  Fields ="title"
               }

        };

        bussr.Requests = new List<Request>();
        bussr.Requests.Add(request);
        var bur = service.Spreadsheets.BatchUpdate(bussr, SpreadsheetId);
        bur.Execute();
    }
Run Code Online (Sandbox Code Playgroud)

错误消息:“requests[0]”(oneof)的值无效,oneof 字段“kind”已设置。无法设置“updateSpreadsheetProperties”[400]

.net c# google-api-dotnet-client google-sheets-api

6
推荐指数
1
解决办法
2783
查看次数

ASP.NET CORE 中的 CORS 策略阻止了对 XMLHttpRequest 的访问

我尝试使用 ajax 从我的侧客户端连接到 API 服务器,但在响应中出现错误: 访问 XMLHttpRequest at ' https://localhost:44381/api/webinars ' from origin ' http://localhost :5003 ' 已被 CORS 策略阻止:对预检请求的响应未通过访问控制检查:请求的资源上不存在“Access-Control-Allow-Origin”标头。 我尝试在 API 中编辑 CROS 策略,但仍然出现相同的错误。这是我来自 MVC 的 ajax 代码:

 $.ajax({
            url: "https://localhost:44381/api/webinars",
            type: 'POST',
            headers: {
                contentType: "application/json",
            },
            body: JSON.stringify(body),
            success: function (data) {
                console.log(data);
            },
            failure: function (err) {
                console.log(err);
            }

        });
Run Code Online (Sandbox Code Playgroud)

从 API 启动:

  public IConfiguration Configuration { get; }

    // This method gets called by the runtime. Use this method to add services to the container. …
Run Code Online (Sandbox Code Playgroud)

c# api ajax model-view-controller cross-domain-policy

5
推荐指数
1
解决办法
9954
查看次数

如何在不更改 Google Apps 脚本的情况下进行 Json 解析

我在 Apps Script 中请求 Go to Webinar API,响应如下:

{"joinUrl":"https://example.com","asset":true,"registrantKey":3669516009270899211,"status":"APPROVED"}
Run Code Online (Sandbox Code Playgroud)

当我制作 JSON.parse 时,我得到如下信息:

{joinUrl=https://example.com, asset=true, registrantKey=3.6695160092708992E18, status=APPROVED}
Run Code Online (Sandbox Code Playgroud)

RegistrantKey 变了,不知道为什么。

那是我的代码:

      try{
    var resp =  UrlFetchApp.fetch(url,options)
    var json=JSON.parse(resp);
    return json
  }catch(err){
    Logger.log(err);
    return err;
Run Code Online (Sandbox Code Playgroud)

}

json request google-apps-script jsonparser

1
推荐指数
1
解决办法
209
查看次数

Visual Studio 2017不支持定位.NET Core 3.0

我尝试在Visual Studio 2017-版本15.9.16中安装SDK 3.0.1。当我打开一个新的Web应用程序时,出现一条错误消息:

严重性代码说明项目文件行抑制状态错误NETSDK1045目前.NET SDK不支持针对.NET 3.0的核心。无论是目标.NET 2.2的核心或降低,或使用一个版本的.NET SDK,它支持.NET 3.0的核心。 IdentityServer-C:\ ProgramFiles \ dotnet \ sdk \ 2.2.106 \ Sdks \ Microsoft.NET.Sdk \ targets \ Microsoft.NET.TargetFrameworkInference.targets 137

我的网点信息:

 dotnet --info
.NET Core SDK (reflecting any global.json):
 Version:   3.0.100
 Commit:    04339c3a26

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.17763
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\3.0.100\

Host (useful for support):
  Version: 3.0.0
  Commit:  7d57652f33

.NET Core SDKs installed:
  1.0.4 [C:\Program Files\dotnet\sdk]
  2.1.2 [C:\Program Files\dotnet\sdk]
  2.1.202 [C:\Program Files\dotnet\sdk] …
Run Code Online (Sandbox Code Playgroud)

c# sdk visual-studio-2017 .net-core-3.0

0
推荐指数
1
解决办法
448
查看次数