Bikesh Srivastava
How to login with SharePoint in asp.net c# ?
By Bikesh Srivastava in .NET on Jul 27 2016
  • Bikesh Srivastava
    Jul, 2016 27

    use this code to authenticate with SharePoint online office 360.string userName = Your user Name;string password = Pasword;string baseurl = "Share point URL";Uri uri = new Uri(baseurl);var securePassword = new SecureString();foreach (var c in password) { securePassword.AppendChar(c); }var credentials = new SharePointOnlineCredentials(userName, securePassword);var authCookie = credentials.GetAuthenticationCookie(uri);var fedAuthString = authCookie.TrimStart("SPOIDCRL=".ToCharArray());if (fedAuthString != null){result.UserToken = fedAuthString;result.Message = "User has been logged in successfully";}else{result.Message = "Invalid User!!";}

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS