Martin Stoll

Martin Stoll

  • NA
  • 2
  • 1.1k

C# CSOM - Get authorized view url of a file

Feb 20 2020 11:19 AM

Hello,

is there a way to get a authorized url of specific file stored in SharePoint Online?

I have an (win) application, that can upload files fine. Later, the file (the uniequid is stored in a database) should be show in a webbrowser control without login.

Similar to Listitem.File.GetPreAuthorizedAccessUrl(), this works?

For Example ServerRelativeUrl + accesstoken.

Login with username and password works fine. (below the Sourcecode)
  1. "********".ToList().ForEach(c => securePassword.AppendChar(c));  
  2.                     clientContext = new ClientContext("https://mysharepoint.sharepoint.com");//Credentials.URL);  
  3.                     clientContext.Credentials = new SharePointOnlineCredentials("[email protected]", securePassword);  
  4.                      
 
 
 

Any ideas?