コード例 #1
0
        /// <summary>
        /// Example #15.
        /// Create a session for the file we uploaded from Example #1 all of the options.
        /// </summary>
        public static void Example15()
        {
            Console.WriteLine("Example #15 - Create a session for a file with more of the options.");
            Console.Write("  Creating... ");

            try
            {
                Session2 = Document1.CreateSession(
                    expiresAt: DateTime.Now.AddMinutes(10),
                    isDownloadable: true,
                    isTextSelectable: false
                    );

                Console.WriteLine("success :)");
                Console.WriteLine("  Session id is " + Session1.Id + ".");
                Console.WriteLine("  Session expires on " + Session1.ExpiresAt + ".");
                Console.WriteLine("  Session view URL is " + Session1.ViewUrl + ".");
                Console.WriteLine("  Session assets URL is " + Session1.AssetsUrl + ".");
                Console.WriteLine("  Session realtime URL is " + Session1.RealtimeUrl + ".");
            }
            catch (BoxViewException e)
            {
                Console.WriteLine("failed :(");
                Console.WriteLine("  Error Code: " + e.Code);
                Console.WriteLine("  Error Message: " + e.Message);
            }

            Console.WriteLine();
        }
コード例 #2
0
        /// <summary>
        /// Example #14.
        /// Create a session for the file we uploaded from Example #1 with default options.
        /// </summary>
        public static void Example14()
        {
            Console.WriteLine("Example #14 - Create a session for a file with default options.");
            Console.Write("  Creating... ");

            try
            {
                Session1 = Document1.CreateSession();

                Console.WriteLine("success :)");
                Console.WriteLine("  Session id is " + Session1.Id + ".");
                Console.WriteLine("  Session expires on " + Session1.ExpiresAt + ".");
                Console.WriteLine("  Session view URL is " + Session1.ViewUrl + ".");
                Console.WriteLine("  Session assets URL is " + Session1.AssetsUrl + ".");
                Console.WriteLine("  Session realtime URL is " + Session1.RealtimeUrl + ".");
            }
            catch (BoxViewException e)
            {
                Console.WriteLine("failed :(");
                Console.WriteLine("  Error Code: " + e.Code);
                Console.WriteLine("  Error Message: " + e.Message);
            }

            Console.WriteLine();
        }