how to get all users in sharepoint group using silverlight

how to get all users in sharepoint group using silverlight:

use following code to Retrive All shareopint fielduser valus

C# code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.SharePoint.Client;
using Microsoft.SharePoint;

namespace users
{


public partial class MainPage : UserControl
{
string user;
GroupCollection Groupcoll;
ClientContext site;

 
public  MainPage()
{



InitializeComponent();
site = new ClientContext(ApplicationContext.Current.Url);

site.Load(site.Web);
Groupcoll= site.Web.SiteGroups;
site.Load(Groupcoll, groups => groups.Include(group => group.Users));

site.ExecuteQueryAsync(new ClientRequestSucceededEventHandler(OnRequestSucceeded), null);
}
private void OnRequestSucceeded(Object sender, ClientRequestSucceededEventArgs args)
{

Dispatcher.BeginInvoke(datacon);
}



private void datacon()
{
    foreach (Group Grp in Groupcoll)
    {
     UserCollection collUser = Grp.Users;
     foreach (User Usr in collUser)
     {
     user = Convert.ToString(Usr.Title);
     combobox1.Items.Add(user);
 }
}
}


See this link for getting users from web service

Comments

Popular posts from this blog

Upload Single/Multiple file by using the REST API and jQuery SharePoint 2013

Add content type to SharePoint List/Library using REST API

A type named 'SP.Data. could not be resolved by the model error