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)
No comments:
Post a Comment