Cast XMlNode to SPUser or SPUserCollection - InfoPath Dev
in

InfoPath Dev

Cast XMlNode to SPUser or SPUserCollection

Last post 07-25-2008 06:42 AM by altja. 0 replies.
Page 1 of 1 (1 items)
Sort Posts: Previous Next
  • 07-25-2008 06:42 AM

    • altja
    • Not Ranked
      Male
    • Joined on 07-02-2008
    • Grand Rapids, MI
    • Posts 10

    Cast XMlNode to SPUser or SPUserCollection

     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 exist

    return "";

    }

Page 1 of 1 (1 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.