none
How to delete Major or overwrite versions for a document library in sharepoint online progrmatically ? RRS feed

All replies

  • Hi SimhaVL,

    There is no option to hide/delete those highlighted option from SharePoint, because it's one of the required functionality for the document versioning.

    So you need to find a alternative way to do not use this option.

    _______________________ 

    Thivagar SEGAR
    [If this Post helps you, then please don't forget to mark it answer or Vote for this post]

    Friday, February 8, 2019 2:13 PM
  • Hi SimhaVL,

    As Segar's said, SharePoint will automatically generate the Version History based on item modification and can't delete manually. 

    If you really don't want these versions in the list item, you could directly disable Versions settings in List Settings:

    Thanks

    Best Regards


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Monday, February 11, 2019 6:12 AM
  • Hi  Jerry Zy,

                       I wnat CSOM or JSOM using Hide document library check out files major version hide.

    Thanks

    Best Regards

    simha

    Monday, February 11, 2019 1:01 PM
  • Hi,

    SharePoint Online not provide CSOM/JSOM interface to hide the "Major Version" Check in option for a library. This is by design which will let user choose the Check in option based on requirement.

    A workaround is , if not want user check in with Major version, then could build a custom add-in with the CSOM code below to check in file with Minor version instead of using UI:

                string userName = "username@Tenant.onmicrosoft.com";
                string password = "********";
                var siteurl = "https://Tenant.sharepoint.com/sites/dev";
                var securePassword = new SecureString();
                foreach (char c in password)
                {
                    securePassword.AppendChar(c);
                }
                using (var clientContext = new ClientContext(siteurl))
                {
                    var onlineCredentials = new SharePointOnlineCredentials(userName, securePassword);
                    clientContext.Credentials = onlineCredentials;
                    Web web = clientContext.Web;
                    clientContext.Load(web, a => a.ServerRelativeUrl);
                    clientContext.ExecuteQuery();
                    Microsoft.SharePoint.Client.File file = clientContext.Web.GetFileByServerRelativeUrl("/sites/dev/Pages/test.aspx");
                    clientContext.Load(file);
                    clientContext.ExecuteQuery();
                    if (file.CheckOutType!=CheckOutType.None)
                    {
                        file.CheckIn("test", CheckinType.MinorCheckIn);
                        file.Update();
                        clientContext.ExecuteQuery();
                    }
    
    
                }

    Thanks

    Best Regards


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Tuesday, February 12, 2019 4:38 AM
  • Hi,

     

    I am checking to see how things are going there on this issue. Please let us know if you would like further assistance.

     

    You can mark the helpful post as answer to help other community members find the helpful information quickly.

     

    Thanks

     

    Best Regards


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Friday, February 15, 2019 2:52 AM