小编Jef*_*man的帖子

ajax获取Office365 REST Api请求失败CORS?

我正在尝试从本地服务器向Office365 RESTful API服务发出ajax GET请求,但遇到了跨域HTTPRequest错误.以下是我的'get-files-at-root'尝试的示例:

$.ajax({
  url: 'https://[sharepoint_site]/_api/v1.0/me/files?access_token='+token,
  type: 'get',
  dataType: 'json',
  success: function(data) {
    if (success){
      success(data);
    }
  },
  error: error
})
Run Code Online (Sandbox Code Playgroud)

我从服务器得到以下响应:

No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:3000' is therefore not allowed access. The response had HTTP status code 403.
Run Code Online (Sandbox Code Playgroud)

我已经尝试将访问令牌作为标头参数发送:

headers: {'Authorization': 'Bearer '+ token}
Run Code Online (Sandbox Code Playgroud)

但这也有同样的结果.

关于我做错了什么的任何想法?

(背景:我正在尝试在客户端上创建自己的Office365'文件选择器',因为我找不到提供此功能的OneDrive Business的可用库.)

ajax cors office365

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

TFS + Git需要链接的工作项分支策略选项

在设置我们的分支策略时,有两个与强制链接的工作项相关的复选框:

  • 检查链接工作项的所有拉取请求
    • 如果没有链接的工作项,则阻止合并

第一个是不言而喻的,但我们试图理解检查/取消选中第二个项目的后果.我们没有运气试图找到这些选项的文档,所以我们想知道是否有人可以描述他们做了什么.谢谢!

git tfs visual-studio-2015

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

RegEx 从字符串末尾开始惰性匹配

是否可以从字符串末尾执行惰性匹配?

人为的例子:

let str = "It's the end of the world as we know it"
let regex = /n.+$/
str.match(regex)         //finds "nd of the world as we know it"
Run Code Online (Sandbox Code Playgroud)

很简单,它从字符串末尾查找 1 个或多个任意字符,直到找到最后一个“n”(向后)。

然而,现在假设我希望它从字符串末尾查找 1 个或多个任意字符,直到找到第一个“n”(向后)。您可能会认为可以添加“惰性”量词,如下所示:

let regexLazy = /n.+?$/
Run Code Online (Sandbox Code Playgroud)

但结果仍然是一样的:

str.match(regex)         //finds "nd of the world as we know it"
Run Code Online (Sandbox Code Playgroud)

是否可以从字符串末尾开始进行惰性匹配?我缺少什么?谢谢!

regex

6
推荐指数
0
解决办法
690
查看次数

标签 统计

ajax ×1

cors ×1

git ×1

office365 ×1

regex ×1

tfs ×1

visual-studio-2015 ×1