First, I got my code to work, but I would like to do it better.
I want to cast the results from GetUserCollectionFromGroup into a SPUserCollection or SPUser. Is there a way directly convert it.
GetUserCollectionFromGroup is a method in the SharePoint UserGroup WSDL.
My rough working Code
public static String GetUserCollectionFromGroup(String group, String site){
bool isMember = false;
UserGroup ug = new UserGroup();SPUserCollection coll;
//SPUser user = new SPUser(System.Xml.XmlAttributeCollection attColl;
ug.Credentials = System.Net.
CredentialCache.DefaultCredentials;
try
{
XmlNode node = ug.GetUserCollectionFromGroup(group);
//SPUserCollection coll = (SPUserCollection)node.FirstChild;System.Collections.IEnumerator ienum = node.FirstChild.GetEnumerator();while (ienum.MoveNext())
{
XmlNode elemNode = (XmlNode)ienum.Current;
attColl = elemNode.Attributes;
String name = attColl[2].Value.ToString();String email = attColl[4].Value.ToString();
}
}
catch { }//catches groups that don't existreturn "";
}