How to Check If the Taxonomy Group for the Current Site is a Read-Only Site Collection Group

Navigate to the site collection http://c4968397007/sites/vijai. Click on Settings, and then click on Site Settings. Click on Term store management which is available under Site Administration section. You could be able to see all the groups in the Taxonomy Term Store. In this blog you will see how to check if the taxonomy group for the current site is a read-only site collection group in SharePoint 2013.

using System;

using System.Collections.Generic;
using System.Linq; 

using System.Text;

using System.Threading.Tasks;

using Microsoft.SharePoint;

using Microsoft.SharePoint.Taxonomy;

using System.Collections.ObjectModel;

 

namespace TaxonomyCodeSamples

{

     class Program

    {
        static void Main(string[] args)

        {

            using (SPSite site = new SPSite("http://c4968397007/sites/Vijai"))

            {
                TaxonomySession taxSession = new TaxonomySession(site);
                //// Get the term store
                TermStore termStore = taxSession.TermStores["MMS"];


                //// Loop through all the groups in the term store
                 foreach (Group group in termStore.Groups)

                {

                   //// Gets a Boolean value that is true if the group for the current site is a read-only site collection group; otherwise, false 

                    if (group.IsReadOnlySiteCollectionGroup)

                    {
                       
//// Display the name of the group

                         Console.WriteLine(group.Name + " is a read only Site Collection Group");

                        break;
                    } 
                }

                Console.ReadLine();

            }

        }

    }

}