我正在尝试从本地服务器向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的可用库.)
在设置我们的分支策略时,有两个与强制链接的工作项相关的复选框:
第一个是不言而喻的,但我们试图理解检查/取消选中第二个项目的后果.我们没有运气试图找到这些选项的文档,所以我们想知道是否有人可以描述他们做了什么.谢谢!
是否可以从字符串末尾执行惰性匹配?
人为的例子:
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)
是否可以从字符串末尾开始进行惰性匹配?我缺少什么?谢谢!