예제 #1
0
        static void TestUpload()
        {
            var siteUrl    = Input("請輸入站台網址 (例如:https://xxxx.sharepoint.com):", true);
            var docLibName = Input("請輸入文件庫名稱(例如:文件):");
            var uploadPath = Input("請輸入查詢路徑(例如:/資料夾名稱/子資料夾名稱):");

            SPDocLibHelper.InsertOrUpdateFile(siteUrl, docLibName, uploadPath, Encoding.UTF8.GetBytes(DateTime.Now.ToString("HH:mm:ss.fff")));
        }
예제 #2
0
        static void FullList()
        {
            var siteUrl    = Input("請輸入站台網址 (例如:https://xxxx.sharepoint.com):", true);
            var docLibName = Input("請輸入文件庫名稱(例如:文件):");

            Console.ForegroundColor = ConsoleColor.Cyan;
            var root = SPDocLibHelper.GetDocLibStructure(siteUrl, docLibName);

            Console.WriteLine($"Directory [{root.Path}]");
            RecursiveDisplay(root.Children, 0);
        }
예제 #3
0
        static void DirFolder()
        {
            var siteUrl    = Input("請輸入站台網址 (例如:https://xxxx.sharepoint.com):", true);
            var docLibName = Input("請輸入文件庫名稱(例如:文件):");
            var folderPath = Input("請輸入查詢路徑(例如:/資料夾名稱/子資料夾名稱):");
            var items      = SPDocLibHelper.DirDocLibrary(siteUrl, docLibName, folderPath);

            Console.ForegroundColor = ConsoleColor.Cyan;
            Console.WriteLine($"資料夾[{folderPath}]下的項目:");
            foreach (var item in items)
            {
                if (item.FsoType == Microsoft.SharePoint.Client.FileSystemObjectType.Folder)
                {
                    Console.WriteLine($"資料夾 <{item.Name}>");
                }
                else
                {
                    Console.WriteLine($"檔案 {Path.GetFileName(item.Path)}");
                    Console.WriteLine(item.Url);
                }
            }
        }