Exemplo n.º 1
0
        //List files in child folder and store File Id in a LIst
        public IList <File> listFilesInitial(DriveService service)

        {
            m_getAllId_init.Clear();
            string queryFolder = "name='MplSample1' and mimeType = 'application/vnd.google-apps.folder' and trashed=false";
            IList <Google.Apis.Drive.v3.Data.File> gFolder = MplGoogleDriveHelper.GetFiles(service, queryFolder);

            string queryFiles = "mimeType = 'image/jpeg'";
            IList <Google.Apis.Drive.v3.Data.File> gFiles = MplGoogleDriveHelper.GetFiles(service, queryFiles);

            if (gFiles != null && gFolder != null)
            {
                foreach (Google.Apis.Drive.v3.Data.File item in gFiles)
                {
                    if (null != item.Parents && gFolder[0].Id == item.Parents[0])
                    {
                        if (!m_getAllId_init.Contains(item.Id))
                        {
                            m_getAllId_init.Add(item.Id);
                        }
                    }

                    m_getAllId = m_getAllId_init;
                }
            }
            return(null);
        }
Exemplo n.º 2
0
        ///Get Folder Id
        public string GetGDriveFolderId(string Name, DriveService service)
        {
            String returnId       = String.Empty;
            String returnFileName = String.Empty;
            string Q = "mimeType = 'application/vnd.google-apps.folder'";
            IList <Google.Apis.Drive.v3.Data.File> _Files = MplGoogleDriveHelper.GetFiles(service, Q);

            foreach (var file in _Files)
            {
                if (file.Name == Name)
                {
                    returnId = file.Id;
                }
            }
            return(returnId);
        }