A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
Calling /_vti_bin/homeapi.ashx/sites/recent using SharePointOnlineCredentials
Hi!
I am trying to call /_vti_bin/homeapi.ashx/sites/recent to get the recent sites for a given user.
The way I login is by using SharePointOnlineCredentials (username + pwd)
The code I use is:
using (var client = new WebClient())
{
client.Credentials = creds;
client.Headers.Add("X-RequestDigest", dig.DigestValue);
client.Headers.Add("X-FORMS_BASED_AUTH_ACCEPTED", "f");
client.Headers.Add(HttpRequestHeader.ContentType, "application/json;odata=verbose");
client.Headers.Add(HttpRequestHeader.Accept, "application/json;odata=verbose");
client.Headers.Add(HttpRequestHeader.UserAgent, "Mozilla/4.0+(compatible;+MSIE+5.01;+Windows+NT+5.0");
client.Headers.Add("SPHome-ClientType", "SharePointIOS");
var endpointUri = new Uri(szRequestURL);
byte [] answer= client.DownloadData(szRequestURL);
}
But I get an error 401. If I login using MSAL or ADAL (so I register an app) then it works (here I don't use SharePointOnlineCredentials)... but in some customers I cannot register an app.
Is it possible to call that REST API using SharePointOnlineCredentials?
Thanks
Microsoft 365 and Office | SharePoint | For business | Windows
Microsoft 365 and Office | SharePoint Server | Development
The process of building custom solutions for SharePoint Server.
Microsoft Security | Microsoft Entra | Microsoft Entra ID
A cloud-based identity and access management service for securing user authentication and resource access
Microsoft Security | Microsoft Graph
An API that connects multiple Microsoft services, enabling data access and automation across platforms
1 answer
Sort by: Oldest
-
Deleted
This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.
1 deleted comment
Comments have been turned off. Learn more