The code which written to access people service in sharpoint 2010 is working fine using default url but when tried to access through Alternate access URL its givingThe request failed with HTTP status 401: Unauthorized. //code
SPCustomUser.People ppl
= new SPCustomUser.People();
ppl.Url = webURL + "/_vti_bin/people.asmx";
string CustomUserID
= System.Configuration.ConfigurationSettings.AppSettings["CustomUserID"].ToString();
string CustomUserPassword
= System.Configuration.ConfigurationSettings.AppSettings["CustomUserPassword"].ToString(); string CustomUserDomain
= System.Configuration.ConfigurationSettings.AppSettings["CustomUserDomain"].ToString();
ppl.Credentials = new System.Net.NetworkCredential(
CustomUserID, CustomUserPassword, CustomUserDomain);
SPCustomUser.PrincipalInfo[] principalInfoUser = ppl.ResolvePrincipals(userLogin,
SPCustomUser.SPPrincipalType.User, false); if (principalInfoUser[0].UserInfoID
== (-1))
{
//Add
and Get user info if user is not added in the site
principalInfoUser = ppl.ResolvePrincipals(userLogin, SPCustomUser.SPPrincipalType.User, true);
}
//get
SharePoint user id(unique) and user account name
userInfo = principalInfoUser[0].DisplayName;
return userInfo;
//error atSPCustomUser.People.ResolvePrincipals(String[] principalKeys, SPPrincipalType principalType, Boolean addToUserInfoList)