如何从 http://aaa-my.sharepoint.com 获取数据到 ajax 上的 http://aaa.sharepoint.com

How to get data from http://aaa-my.sharepoint.com to http://aaa.sharepoint.com on ajax

http://...-my.sharepoint.com

获取数据时出错

XMLHttpRequest cannot load https://aaaa-my.sharepoint.com/_api/SP.UserProfiles.PeopleManager/GetMyProperties. Response to preflight request doesn't pass access control check: The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'. Origin 'https://aaaa.sharepoint.com' is therefore not allowed access. The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute.

请帮我解决一下。谢谢

您在此处收到 CORS(Cross-origin 资源共享)错误。

您请求的资源不允许您的域访问请求的资源。

您是否在 SharePoint 上启用了 CORS headers?

这里有 link 一些可能对 SO 有帮助的答案,
enable-cors-in-sharepoint-2013
401-response-for-cors-request-in-iis-with-windows-auth-enabled

错误是因为您试图从 aaa.sharepoint.com 到 aaa-my.sharepoint.com.

进行跨域调用

我看到您正在尝试获取已登录用户的用户配置文件属性。为此,您不需要拥有 My Site Base Url。 REST api 调用也适用于当前网站集基础 url。所以 http://aaa.sharepoint.com/_api/SP.UserProfiles.PeopleManager/GetMyProperties 应该会得到你想要的结果