Open
Description
Target SharePoint environment
SharePoint Online
What SharePoint development model, framework, SDK or API is this about?
SharePoint REST API
Developer environment
macOS
What browser(s) / client(s) have you tested
- 💥 Internet Explorer
- 💥 Microsoft Edge
- 💥 Google Chrome
- 💥 FireFox
- 💥 Safari
- mobile (iOS/iPadOS)
- mobile (Android)
- not applicable
- other (enter in the "Additional environment details" area below)
Additional environment details
- Affecting all users in our company
- Various: Edge/Chrome/Safari latest
- SPFx version 1.17.4
- Node.js version 16.20.1
- macOS 15.4.1/Windows 11 etc
Describe the bug / error
There is an internal Microsoft support ticket attached to this.
Retreving a SharePoint user's profile properties via REST ap in SPFx stopped working as of May 27th @ around 7pm. The following code snippet will fail (mildly edited from what I have in code):
this.context.aadTokenProviderFactory.getTokenProvider();
.then(aadTokenProvider => { return aadTokenProvider.getToken(tenantURL) })
.then(token => {
const requestHeaders: Headers = new Headers();
requestHeaders.append("Accept", "application/json;odata=verbose");
requestHeaders.append("Content-type", "application/json;odata=verbose");
requestHeaders.append("Cache-Control", "no-cache");
requestHeaders.append("Authorization", `Bearer ${token}`);
requestHeaders.append('odata-version', '');
return this.context.httpClient.get(tenantURL + "_api/SP.UserProfiles.PeopleManager/getuserprofilepropertyfor(accountname=@v,%20propertyname='propertyname')?@v='i:0#.f|membership|[email protected]'", HttpClient.configurations.v1, {
headers: requestHeaders
});
})
Note that I use aadTokenProvider and httpClient instead of spHttpClient because that's the only way to access properties in a multi-geo tenant. This was working for both my main domain and my emea domain.
Steps to reproduce
- Place the above code in a newly minted SPFx webpart
- Test the webpart with gulp serve
- Request will fail with Permissions Denied 403 error
Expected behavior
The httpRequest should be successful and return a value for the requested property.