public StringBuilder GetUsersByGroup()
{
StringBuilder SPBResult = new StringBuilder();
//Open Site
SPSite spSite = new SPSite(ConfigurationManager.AppSettings["SharepointURL"].ToString());
SPWeb spWeb = spSite.OpenWeb();
if (strGroupName.Length > 0 && strInsertGroupName.Length > 0)
{
SPBResult = UsersList("Administrator");
}
return SPBResult;
}
public bool UsersList(string strGetGroupName,)
{
StringBuilder SPBUsersList false;
StringBuilder SPBGroupList = new StringBuilder();
SPGroup SPgroups = null;
blnExistsUser = false;
//Open Site
SPSite spSite = new SPSite(//"Sharepoint URL ");
SPWeb spWeb = spSite.OpenWeb();
SPBGroupList = new StringBuilder();
SPBUsersList = new StringBuilder();
SPgroups = spWeb.SiteGroups[strGetGroupName)];
foreach (SPUser singleUser in SPgroups.Users)
{
if(singleUser.LoginName == "Username")
{
SPBUsersList=true;
}
}
return SPBUsersList;
}
{
StringBuilder SPBResult = new StringBuilder();
//Open Site
SPSite spSite = new SPSite(ConfigurationManager.AppSettings["SharepointURL"].ToString());
SPWeb spWeb = spSite.OpenWeb();
if (strGroupName.Length > 0 && strInsertGroupName.Length > 0)
{
SPBResult = UsersList("Administrator");
}
return SPBResult;
}
public bool UsersList(string strGetGroupName,)
{
StringBuilder SPBUsersList false;
StringBuilder SPBGroupList = new StringBuilder();
SPGroup SPgroups = null;
blnExistsUser = false;
//Open Site
SPSite spSite = new SPSite(//"Sharepoint URL ");
SPWeb spWeb = spSite.OpenWeb();
SPBGroupList = new StringBuilder();
SPBUsersList = new StringBuilder();
SPgroups = spWeb.SiteGroups[strGetGroupName)];
foreach (SPUser singleUser in SPgroups.Users)
{
if(singleUser.LoginName == "Username")
{
SPBUsersList=true;
}
}
return SPBUsersList;
}