public ClientContext GetClientContext(bool isLegacy = true,bool isExternalCall = false) { try { var account = new AccountInfo(); if (isExternalCall) { Context = new ClientContext(ApplicationConfiguration.ModernSpInsatance) { Credentials = new NetworkCredential(ApplicationConfiguration.SharePointServiceAccount, ApplicationConfiguration.SharePointServiceAccountCredential, ApplicationConfiguration.Domain) }; } else { Context = new ClientContext(ApplicationConfiguration.ModernSpInsatance) { Credentials = account.GetCredentials() }; } return Context; } catch (Exception ex) { throw ex; } }
public static byte[] ReturnProfileImageBytes(string profileImageUrl) { var account = new AccountInfo(); var webClient = new WebClient { Credentials = account.GetCredentials() }; return webClient.DownloadData(Convert.ToString(profileImageUrl)); }