google api v3 C# cant read file permissions details (filePermissions.Permissions[i].EmailAddress) -
my issue can't read email or user name each file permission
i need read have permission on each files in google drive api v3
var service = new driveservice(new baseclientservice.initializer() { httpclientinitializer = credential, applicationname = applicationname, }); // define parameters of request filesresource.listrequest listrequest = service.files.list(); //*///////////////// getdataitem share file me listrequest.q = "(sharedwithme = true)"; listrequest.fields = "*"; var results = listrequest.execute(); //*////////////end getdataitem share file me listrequest.pagesize = 10; listrequest.fields = "nextpagetoken, files(id,name,viewedbyme)"; // list files. ilist<google.apis.drive.v3.data.file> files = listrequest.execute() .files; console.writeline("files:"); if (files != null && files.count > 0) { foreach (var file in files) { response.write("<br>file name = " + file.name.tostring() + " *file id = * " + file.id.tostring() + "<br>"); try { response.write("createdtime = " + file.createdtime.tostring() + "<br>"); } catch (exception ex) { response.write(ex.message.tostring() + " ex && <br> "); } try { permissionlist filepermissions = service.permissions.list(file.id.tostring()).execute(); int permissionc = filepermissions.permissions.count; response.write("count:" + permissionc.tostring() + " // "); (int = 1; < permissionc; i++) { string permissionid = filepermissions.permissions[i].id.tostring(); var ff = service.permissions.get(file.id.tostring(), permissionid); response.write("permissionid = " + permissionid + "<br> "); response.write("kind = " + filepermissions.kind.tostring() + "<br> "); //response.write("etag = " + filepermissions.permissions[i].etag.tostring() + "<br> "); response.write("role = " + filepermissions.permissions[i].role.tostring() + "<br> "); var email = ""; if (filepermissions.permissions[i].emailaddress != null) { email = filepermissions.permissions[i].emailaddress.tostring(); } response.write("emailaddress = " + email + "<br> "); response.write("type = " + filepermissions.permissions[i].type.tostring() + "<br> "); if (filepermissions.permissions[i].displayname != null) { response.write("<br> name : " + filepermissions.permissions[i].displayname.tostring() + "** "); } } } catch (exception er) { response.write(er.message.tostring() + " err && <br> "); }
Comments
Post a Comment