Hi!
I have a CSOM program (desktop app). I can use Graph or REST API if needed.
I have a sharing link like:
https://MYTENANT-my.sharepoint.com/:w:/p/pablo/EWkIoUESiylKrOEglXilrkoBf1eat8RNe35sA0JYvaEzjg
I need to get the file name from this link (or at least the extension).
Using CSOM what I did was:
Microsoft.SharePoint.Client.File file = context.Web.GetFileByGuestUrl(szSharingLinkToGetFileNameFrom);
context.Load(file);
context.ExecuteQuery();
Console.WriteLine("File: " + file.Name);
This works just fine if the user that calls this API is the same user that is logged in.
But suppose my use is MARY and Mary has this sharing link belonging to Pablo.
The only way I could make it work is to use this OneDrive connection string when connecting to OneDrive:
https://MYTENANT-my.sharepoint.com/personal/pablo_MYTENANT_com
But remember that if I am Mary, I don't really know the connection string of other user... parsing the link is not a choice since it smells problematic if the UPN changes...
I did not yet test if the sharing link belongs to another tenant (e.g. and that sharing link is Anyone Can View).
Thanks
