how to get all users in sharepoint group using silverlight
how to get all users in sharepoint group using silverlight:
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);
See this link for getting users from web service
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
{
{
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));
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);
}
}
}
{
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
Post a Comment