Exemple #1
0
        private async Task PostFolders(DriveService service, string[] files, string path)
        {
            int          count = 0;
            bool         bichl = false;
            File         file  = new File();
            IList <File> fl    = await this.RetrieveAllFilesAsList(service);

            About about = await service.About.Get().ExecuteAsync();

            String RootID = about.RootFolderId;

            for (int i = 0; i < files.Length; i++)
            {
                FileAndFolderInformation fafi = new FileAndFolderInformation(files[i], path);
                bichl = false;

                foreach (string s in fafi.RelPathToData)
                {
                    if (!fafi.IsFile && !String.IsNullOrEmpty(s))
                    {
                        fl = await this.RetrieveAllFilesAsList(service);

                        if (bichl == false)
                        {
                            await CreateFolderGD(service, s, RootID);

                            bichl = true;
                        }
                        else
                        {
                            String id = await this.getIdFromTitle(service, fl, fafi.RelPathToData[count - 1]);
                            await CreateFolderGD(service, s, id);
                        }
                    }
                    count++;
                }
                count = 0;
            }
        }
        private async Task PostFolders(DriveService service, string[] files, string path)
        {
            int count = 0;
            bool bichl = false;
            File file = new File();
            IList<File> fl = await this.RetrieveAllFilesAsList(service);
            About about = await service.About.Get().ExecuteAsync();
            String RootID = about.RootFolderId;

            for (int i = 0; i < files.Length; i++)
            {
                FileAndFolderInformation fafi = new FileAndFolderInformation(files[i], path);
                bichl = false;

                foreach (string s in fafi.RelPathToData)
                {
                    if (!fafi.IsFile && !String.IsNullOrEmpty(s))
                    {
                        fl = await this.RetrieveAllFilesAsList(service);

                        if (bichl == false)
                        {
                            await CreateFolderGD(service, s, RootID);
                            bichl = true;
                        }
                        else
                        {
                            String id = await this.getIdFromTitle(service, fl, fafi.RelPathToData[count - 1]);
                            await CreateFolderGD(service, s, id);
                        }

                    }
                    count++;

                }
                count = 0;
            }

        }