using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint;
using Microsoft.Office.InfoPath;
using System.IO;
using System.Xml;
using System.Xml.XPath;
using System.Collections;
using System.Data;
using System.Data.Common;
using System.Security.Principal;
using Microsoft.SharePoint.Utilities;
namespace DeleteAllitem
{
class Program
{
static List<DocumentName> doclist = new List<DocumentName>();
static void Main(string[] args)
{
using (SPSite site = new SPSite("http://win-0c3p6kepvck:100/kkk/"))
{
site.AllowUnsafeUpdates = true;
using (SPWeb web = site.OpenWeb())
{
web.AllowUnsafeUpdates = true;
SPDocumentLibrary list =(SPDocumentLibrary)web.Lists["JS"];
SPListItemCollection itemcoll = list.Items;
foreach (SPListItem item in itemcoll)
{
DocumentName d = new DocumentName
{
Name1= Convert.ToString(item["Name"]),
Title1=Convert.ToString(item["Title"]),
FileUrl=item.File.ServerRelativeUrl,
Department=Convert.ToString(item["Department"])
};
doclist.Add(d);
}
Console.WriteLine("Please Enter FileName....");
string s=Console.ReadLine();
Console.WriteLine("Please Enter Department....");
string departmentt=Console.ReadLine();
var fileName=doclist.Where(w=>w.Name1.Contains(s) && w.Department==departmentt);
foreach (var c in fileName)
{
Console.WriteLine(c.Name1);
Console.WriteLine(c.FileUrl);
}
Console.WriteLine("end....");
Console.Read();
web.AllowUnsafeUpdates = false;
}
site.AllowUnsafeUpdates = false;
}
}
public class DocumentName
{
private string Name;
public string Name1
{
get { return Name; }
set { Name = value; }
}
private string Title;
public string Title1
{
get { return Title; }
set { Title = value; }
}
private string fileUrl;
public string FileUrl
{
get { return fileUrl; }
set { fileUrl = value; }
}
private string department;
public string Department
{
get { return department; }
set { department = value; }
}
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint;
using Microsoft.Office.InfoPath;
using System.IO;
using System.Xml;
using System.Xml.XPath;
using System.Collections;
using System.Data;
using System.Data.Common;
using System.Security.Principal;
using Microsoft.SharePoint.Utilities;
namespace DeleteAllitem
{
class Program
{
static List<DocumentName> doclist = new List<DocumentName>();
static void Main(string[] args)
{
using (SPSite site = new SPSite("http://win-0c3p6kepvck:100/kkk/"))
{
site.AllowUnsafeUpdates = true;
using (SPWeb web = site.OpenWeb())
{
web.AllowUnsafeUpdates = true;
SPDocumentLibrary list =(SPDocumentLibrary)web.Lists["JS"];
SPListItemCollection itemcoll = list.Items;
foreach (SPListItem item in itemcoll)
{
DocumentName d = new DocumentName
{
Name1= Convert.ToString(item["Name"]),
Title1=Convert.ToString(item["Title"]),
FileUrl=item.File.ServerRelativeUrl,
Department=Convert.ToString(item["Department"])
};
doclist.Add(d);
}
Console.WriteLine("Please Enter FileName....");
string s=Console.ReadLine();
Console.WriteLine("Please Enter Department....");
string departmentt=Console.ReadLine();
var fileName=doclist.Where(w=>w.Name1.Contains(s) && w.Department==departmentt);
foreach (var c in fileName)
{
Console.WriteLine(c.Name1);
Console.WriteLine(c.FileUrl);
}
Console.WriteLine("end....");
Console.Read();
web.AllowUnsafeUpdates = false;
}
site.AllowUnsafeUpdates = false;
}
}
public class DocumentName
{
private string Name;
public string Name1
{
get { return Name; }
set { Name = value; }
}
private string Title;
public string Title1
{
get { return Title; }
set { Title = value; }
}
private string fileUrl;
public string FileUrl
{
get { return fileUrl; }
set { fileUrl = value; }
}
private string department;
public string Department
{
get { return department; }
set { department = value; }
}
}
}
}
No comments:
Post a Comment