Tag: checkin

Unpublish and Checkout SharePoint Page: SPSecurity.RunWithElevatedPrivileges(delegate() { using (SPSite site = new SPSite("YOURSITE")) { using (SPWeb web = site.OpenWeb()) { //Obtain the Page PublishingPageCollection publishingPages = PublishingWeb.GetPublishingWeb(web).GetPublishingPages(); PublishingPage page = publishingPages.FirstOrDefault(f => f.Uri.AbsoluteUri == "YOURPAGEURL"); if (page != null) { //Allow file modifications bool webAllow = web.AllowUnsafeUpdates; web.AllowUnsafeUpdates = true; SPFile file = page.ListItem.File; //Unpublish […]
Sometimes we could have some problems to access to a specific machine where we have some of our code checked out. Maybe the person who was programming those files left, or maybe for some reason we lost connection with that environment. That’s when we have to force TFS to check-in the files, or if we […]