SharePoint Update UserInfo List From AD
namespace UpdateList
{
class Program
{
static void Main(string[] args)
{
Program pp = new Program();
pp.XFunInsert();
}
private void
XFunInsert()
{
using (SPSite
oSite = new SPSite("http://localhost:650/sites/lms"))
{
using (SPWeb
oWeb = oSite.RootWeb)
{
oWeb.AllowUnsafeUpdates = true;
using (StreamReader
sr = new StreamReader("C:\\Users\\spadmin\\Desktop\\pass.txt"))
{
String line;
List<string>
ComputerNames = new List<string>();
while ((line = sr.ReadLine()) != null)
{
try
{
oWeb.EnsureUser(line);
Console.WriteLine(line);
}
catch
{
}
}
}
oWeb.AllowUnsafeUpdates = false;
}
}
}
}
}
Comments
Post a Comment