which country user step here?

Tag Cloud

MOSS (46) SharePoint 2007 (31) admin (16) MOSS admin (15) developer (15) WSS (14) List (13) MOSS SP2 (13) SharePoint 2010 (13) end user (11) sql query (9) wss V3 (9) Moss issue (8) permission (7) scripting (7) search (7) Service Pack (6) reportadmin (6) client object model (5) database (5) sql (5) CU (4) Client Code (4) Command (4) Cumulative Updates (4) Excel (4) SharePoint designer (4) stsadm (4) workflow (4) ASP.NET (3) Groove (3) Patch (3) PowerShell (3) Tutorial (3) alert (3) batch file (3) codeplex (3) Index (2) Internet (2) News (2) People Picker (2) Share Document (2) View (2) Web Development with ASP.NET (2) coding (2) column (2) domain (2) download (2) enumsites (2) error (2) june CU (2) network (2) orphan site (2) performance (2) project server (2) query (2) restore (2) theme (2) training (2) upload (2) web master (2) web.config (2) 70-630 (1) Approval (1) Caching (1) Cerificate (1) Consultants (1) Content Type (1) DOS (1) Excel Services (1) Folder (1) HTML calculated column (1) ISA2006 (1) IT Knowledge (1) ITIL (1) Install (1) Link (1) MCTS (1) Macro (1) Migration (1) My Sites (1) NLBS (1) Office (1) Reporting Services (1) SPDisposeCheck.exe (1) SSRS (1) Shared Services Administration (1) Site template (1) Steelhead (1) VLOOKUP (1) WSS SP2 (1) XCOPY (1) add user (1) admi (1) aspx (1) availabilty (1) branding sharepoint (1) calendar (1) counter (1) crawl (1) custom list (1) exam (1) facebook (1) filter (1) fun (1) group (1) iis log (1) import list (1) improment (1) interview (1) load balance (1) metada (1) mossrap (1) profile (1) resource (1) server admin (1) size (1) sps2003 (1) sub sites (1) system (1) table (1) task list (1) user porfile (1) vbs (1) web part (1) widget (1) windows 2008 (1) windows account (1) wsp (1)

Friday, November 18, 2011

Client Object Model - retrieve document library permission




 public void CheckPermission(string siteUrl, string ListName)

        {
            ClientContext clientContext = new ClientContext(siteUrl);
            List curList = clientContext.Web.Lists.GetByTitle(ListName);

            clientContext.Load(curList.RoleAssignments);
            clientContext.ExecuteQuery();


 foreach(RoleAssignment ra in curList.RoleAssignments)

         {
             var p = ra.Member;
             clientContext.Load(p);
             var q = ra.RoleDefinitionBindings;
             clientContext.Load(q);
             clientContext.ExecuteQuery();
               
       
           foreach (RoleDefinition subq in q)
           {
               Console.WriteLine(p.Title+"=="+subq.Name);
         
           }
                                 
            }

         }

Wednesday, October 12, 2011

client code : check all the Sharepoint 2010 group Owner

static void Main(string[] args)
       {

           String sURL = "http://xxxxx/sites/yyyyy";
          
          
           ClientContext clientContext = new ClientContext( sURL);
           GroupCollection collGroup = clientContext.Web.SiteGroups;
                     

           clientContext.Load(collGroup);

           clientContext.Load(collGroup);
               //groups => groups.Include(
                //   group => group.Owner));

           clientContext.ExecuteQuery();

           foreach (Group oGroup in collGroup)
           {
               Console.WriteLine(oGroup.Title +"== "+ oGroup.OwnerTitle);
          
           }

          
           Console.ReadLine();

       }

Thursday, October 6, 2011

Retrieve all document library View method with console c#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint.Client;
using SP = Microsoft.SharePoint.Client;

namespace ExtractView
{
    class SPView
    {
        public void allview(string siteUrl , string doclib )
       
        {

            ClientContext clientContext = new ClientContext(siteUrl);
            Web site = clientContext.Web;

            List targetList = site.Lists.GetByTitle(doclib);
            ViewCollection collView = targetList.Views;

            ViewCreationInformation viewInfo = new ViewCreationInformation();
          

            clientContext.Load(collView);
            clientContext.ExecuteQuery();

            Console.WriteLine("this is for document lib" + doclib);

            foreach (View oneView in collView)
             Console.WriteLine(oneView.Title);

            
        }


        public void alldoc(string siteUrl)
        {

             ClientContext clientContext = new ClientContext(siteUrl);
            ListCollection collList = clientContext.Web.Lists;                             
          
            clientContext.Load(collList);
            clientContext.ExecuteQuery();

            foreach (SP.List olist in clientContext.Web.Lists)

            {

                allview(siteUrl, olist.Title);
                       
            }

        }

    }
}

=============================================================================================================

to call this method please create static void main to call it.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint.Client;

namespace ExtractView
{
    class Program
    {
        static void Main(string[] args)
        {
               SPView listview = new SPView();

               listview.alldoc(args[0]);         

        }

        
    }
}

=================================================================================================================

run the xxx.exe parameter(URL)

Wednesday, September 14, 2011

Code to retrieve all the list item detail

using System;
using System.Linq;
using Microsoft.SharePoint.Client;
using SP = Microsoft.SharePoint.Client;

namespace Microsoft.SDK.SharePointServices.Samples
{
class RetrieveListItemsInclude
{
static void Main()
{
string siteUrl = "http://MyServer/sites/MySiteCollection";

ClientContext clientContext = new ClientContext(siteUrl);
SP.List oList = clientContext.Web.Lists.GetByTitle("Announcements");

CamlQuery camlQuery = new CamlQuery();
camlQuery.ViewXml = "<View><RowLimit>100</RowLimit></View>";

ListItemCollection collListItem = oList.GetItems(camlQuery);

clientContext.Load(collListItem,
items => items.Include(
item => item.Id,
item => item.DisplayName,
item => item.HasUniqueRoleAssignments));

clientContext.ExecuteQuery();

foreach (ListItem oListItem in collListItem)
{
Console.WriteLine("ID: {0} \nDisplay name: {1} \nUnique role assignments: {2}",
oListItem.Id, oListItem.DisplayName, oListItem.HasUniqueRoleAssignments);
}Console.ReadLine();
}
}
}
 
source code from here

Monday, September 5, 2011

my first client object testing with the windows form :)

follow the step here : http://www.sharepointkings.com/2011/07/client-object-model-part-1.html 

please remember to add the  Microsoft.Sharepoint.Client and Microsoft.Sharepoint.Client.Runtime to References.

*my small step over the cilent obkect model over sp2010

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Microsoft.SharePoint.Client;


namespace SP2010
{
    public partial class Form1 : System.Windows.Forms.Form
    {
        public Form1()
        {
            InitializeComponent(); //not sure this is for what Smile with tongue out 
        }

 

      public void LoadData()
        {
            string webUrl = "http://xxxxx/sites/content/support"; //replace this with your site URL

            ClientContext context = new ClientContext(webUrl);

            Web web = context.Web;

            context.Load(web);


            context.ExecuteQuery();

            this.label1.Text = web.Title + " " + web.Description;

            this.label2.Text = webUrl;
           

        }

 

        private void button1_Click(object sender, EventArgs e)
        {

              LoadData();
        }
    }
}