none
Checkout page unlock

    Question

  • How can I unlock a file that has been checkuot by onother person?

    This is my problem:
    I need to work on the master page file, I am using MOSP Designer, the page status is checkout by other user that user works no longer with us. How can I check in that page so I can work with it.
    Monday, June 23, 2008 1:31 PM

Answers

  • Base on my test, you should have permissions on both discarding check out and check in the file in the master page gallery,

    Besides using Manage Checked Out files link, there are also several methods to achieve that.

    1.     In the document library (master page gallery is also a document library), navigate to the checked out item, in the popup menu, click Check In or Discard Check Out.

    2.     In SharePoint Designer 2007, navigate to the checked out master page file, right click and choose Undo Check Out.

    3.     Using SharePoint OM.

    Here is the sample code to check in files manually. You should modify it based on your needs.

    Code Snippet

     

    using System;

    using Microsoft.SharePoint;

    using Microsoft.SharePoint.Administration;

    using Microsoft.SharePoint.Utilities;

    using System.Collections.Specialized;

    using System.Security.Principal;

     

    namespace DocumentLibraryCheckIn

    {

     

        class Class1

        {

            /// <summary>

            /// The main entry point for the application.

            /// </summary>

            [STAThread]

            static void Main(string[] args)

            {

     

                SPGlobalAdmin globalAdmin = new SPGlobalAdmin();

                string strSite = "http://yousite";

                bool bInvalidArgs = false;

     

                //Make sure that user is an admin

                if (!globalAdmin.IsCurrentUserMachineAdmin())

                {

                    Console.WriteLine(SPResource.GetString(Strings.AccessDenied));

                    Console.WriteLine();

                    return;

                }

     

                try

                {

                   

                    SPFolder docLibFolder = new SPSite(strSite).OpenWeb().Folders["your folder"];

                    //Username as comment

                    string strUsername = "your name";

                    System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToString();

                    SPFileCollection docLibFiles = docLibFolder.Files;

     

                    for (int i = 0; i < docLibFiles.Count; i++)

                        docLibFiles[i].CheckIn("Checked in by: " + strUsername);

     

     

     

                }

                catch (Exception ex)

                {

                    Console.WriteLine(ex.Message.ToString());

                    return;

                }

     

            }

     

        }

     

    }

     

     

    Hope the information can be helpful and let me know the result if possible.

    -lambert

    Wednesday, June 25, 2008 9:51 AM

All replies

  • If you are admin, goto

     

    Site Actions / Site Settings / Modify all site settings

    Under Galleries, click "Master pages and page layouts"

    Click on Settings and then on "Document library settings"

    Under "Permissons and Management", click on "Manage checked out files"

    --> Check the file and bring under your control.

     

    Hope this helps

     

    Monday, June 23, 2008 2:53 PM
  • I try this before but there are no files showing uder the list but the files apperar as check out to x user.
    Monday, June 23, 2008 3:01 PM
  • Do you mean that the file does not appear when you click on "Manage checked out files"?

     

    Does the file appear when you click on "Master Pages and page layouts" link as checkeout ? In that case, click on pulldown menu of the file and cancel the extraction.

     

    Monday, June 23, 2008 3:16 PM
  • No it does not appear.

    Yes, is there, but I don't see the cancel extraction option in the drop down menu.
    I got access as administrator and developer, do I need to do something to see this option?
    Monday, June 23, 2008 4:45 PM
  • Base on my test, you should have permissions on both discarding check out and check in the file in the master page gallery,

    Besides using Manage Checked Out files link, there are also several methods to achieve that.

    1.     In the document library (master page gallery is also a document library), navigate to the checked out item, in the popup menu, click Check In or Discard Check Out.

    2.     In SharePoint Designer 2007, navigate to the checked out master page file, right click and choose Undo Check Out.

    3.     Using SharePoint OM.

    Here is the sample code to check in files manually. You should modify it based on your needs.

    Code Snippet

     

    using System;

    using Microsoft.SharePoint;

    using Microsoft.SharePoint.Administration;

    using Microsoft.SharePoint.Utilities;

    using System.Collections.Specialized;

    using System.Security.Principal;

     

    namespace DocumentLibraryCheckIn

    {

     

        class Class1

        {

            /// <summary>

            /// The main entry point for the application.

            /// </summary>

            [STAThread]

            static void Main(string[] args)

            {

     

                SPGlobalAdmin globalAdmin = new SPGlobalAdmin();

                string strSite = "http://yousite";

                bool bInvalidArgs = false;

     

                //Make sure that user is an admin

                if (!globalAdmin.IsCurrentUserMachineAdmin())

                {

                    Console.WriteLine(SPResource.GetString(Strings.AccessDenied));

                    Console.WriteLine();

                    return;

                }

     

                try

                {

                   

                    SPFolder docLibFolder = new SPSite(strSite).OpenWeb().Folders["your folder"];

                    //Username as comment

                    string strUsername = "your name";

                    System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToString();

                    SPFileCollection docLibFiles = docLibFolder.Files;

     

                    for (int i = 0; i < docLibFiles.Count; i++)

                        docLibFiles[i].CheckIn("Checked in by: " + strUsername);

     

     

     

                }

                catch (Exception ex)

                {

                    Console.WriteLine(ex.Message.ToString());

                    return;

                }

     

            }

     

        }

     

    }

     

     

    Hope the information can be helpful and let me know the result if possible.

    -lambert

    Wednesday, June 25, 2008 9:51 AM
  • Thanks for the code.

    I fix it adding me as a Site Collection Administrator, after this I was able to check in the files.

    Thanks again.
    Wednesday, June 25, 2008 6:50 PM