I want to read profile property of Mysites using C#.net.I written below code but it is throwing exception at third line of the code execution.
Exception: Cannot complete this action. Please try again.
SPSite site = new SPSite(strUrl); // strUrl = I am mentioning MySite site collection URL here. Like ex: http://servername:1111/
ServerContext context = ServerContext.GetContext(site);
UserProfileManager usrPrfMngr = new UserProfileManager(context); //Exception occuring here
foreach(UserProfile profile in usrPrfMngr)
strEmail = profile["WorkEmail"].ToString();
Please help me to resolve this issue.
View Complete Post