Skip to content

Accessing SharePoint user profile properties via REST api (_api/SP.UserProfiles.PeopleManager) in SPFx stopped working as of May 27th @ around 7pm #10289

Open
@tgorgdotcom

Description

@tgorgdotcom

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

  1. Place the above code in a newly minted SPFx webpart
  2. Test the webpart with gulp serve
  3. Request will fail with Permissions Denied 403 error

Expected behavior

The httpRequest should be successful and return a value for the requested property.

Metadata

Metadata

Assignees

Labels

area:csom/rest/apiCategory: SharePoint Client Side Object Model SDK / REST APItype:bug-confirmedConfirmed bug, not working as designed / expected.type:bug-suspectedSuspected bug (not working as designed/expected). See “type:bug-confirmed” for confirmed bugs.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions