Beispiel #1
0
        static void Main(string[] args)
        {
            //  Read the Office365 Url from Console
            var siteUrl = GetSite();

            // Prompt for Credentials
            Console.WriteLine("Enter Credentials for {0}", siteUrl);

            string userName = GetUserName();
            SecureString pwd = GetPassword();

            /* End Program if no Credentials */
            if (string.IsNullOrEmpty(userName) || (pwd == null))
            {
                Console.WriteLine("Please provide credentials...");
                return;
            }

            Console.WriteLine();

            // Open connection to Office365 tenant
            var clientContext = new ClientContext(siteUrl)
            {
                AuthenticationMode = ClientAuthenticationMode.Default,
                Credentials = new SharePointOnlineCredentials(userName, pwd)
            };

            /*  provide the clientcontext of target web */
            var ratingEnabler = new RatingsEnabler(clientContext);

            /*  Set 
             *  1. Library name as per locale
             *  2. Experience Ratings/Likes
            */  
            ratingEnabler.Enable("Documents",VotingExperience.Likes);

            // Disable rating option 
            // - Right now does not however remove fields from the list using CSOM - disables though the option. 
            // ratingEnabler.Disable("Documents");
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            //  Read the Office365 Url from Console
            var siteUrl = GetSite();

            // Prompt for Credentials
            Console.WriteLine("Enter Credentials for {0}", siteUrl);

            string       userName = GetUserName();
            SecureString pwd      = GetPassword();

            /* End Program if no Credentials */
            if (string.IsNullOrEmpty(userName) || (pwd == null))
            {
                Console.WriteLine("Please provide credentials...");
                return;
            }

            Console.WriteLine();

            // Open connection to Office365 tenant
            var clientContext = new ClientContext(siteUrl)
            {
                AuthenticationMode = ClientAuthenticationMode.Default,
                Credentials        = new SharePointOnlineCredentials(userName, pwd)
            };

            /*  provide the clientcontext of target web */
            var ratingEnabler = new RatingsEnabler(clientContext);

            /*  Set
             *  1. Library name as per locale
             *  2. Experience Ratings/Likes
             */
            ratingEnabler.Enable("Documents", VotingExperience.Likes);

            // Disable rating option
            // - Right now does not however remove fields from the list using CSOM - disables though the option.
            // ratingEnabler.Disable("Documents");
        }