开发者

How to get userid by email?

开发者 https://www.devze.com 2023-03-13 08:50 出处:网络
static void Main(string[] args) { using (SPSite mySite = new SPSite(\"sitename\")) { using (SPWeb myWeb = mySite.OpenWeb())
static void Main(string[] args)
{
  using (SPSite mySite = new SPSite("sitename"))
  { 
    using (SPWeb myWeb = mySite.OpenWeb())
    {
      string userEmail = "foo@example.com"开发者_StackOverflow社区;

      string userName = Membership.GetUserNameByEmail(userEmail);

      Console.WriteLine("Your UserName is: " + userName);
    }
  }     
}

This code is retuning NULL. What am i doing wrong in this code?


Obviously the simplest answer is that no user was found with that e-mail. If you believe that is not the case, please show why and I will try to help you out.

0

精彩评论

暂无评论...
验证码 换一张
取 消