Wednesday, May 13, 2009

The file is checked out or locked for editing by

using (SPSite site = new SPSite("siteAddress"))

{

using (SPWeb web = site.OpenWeb("webAddress"))

{

SPListItem listItem = web.Lists["Project Documents"].GetItemById(_id);

try

{

listItem.File.CheckIn("Checked in by force");

listItem.Update();

}

catch (Exception ex)

{

Console.WriteLine(ex.Message);

Console.ReadKey();

}

}

}

No comments: