I'm trying to fetch Google Drive items & adding my own item dynamically for temporary use.
IList<File> Files = new List<File>();
FilesResource.ListRequest list = service.Files.List();
FileList filesFeed = list.Execute();
ParentReference pitem = new ParentReference();
File fileitem = new File();
fileitem.Id = RootId;
fileitem.Title = "MainDrive";
pitem.Id = null;
pitem.IsRoot = true;
fileitem.Parents.Add(pitem);
Files.Add(fileitem);
In the above code I'm able to add Google Drive file items plus my own fileitem
to Files
List.
To fetch the parent id I have to write the below code
(x => x.Files[0].Parent[0].Id)
But for the item which I added has fileitem.Parents
itself is null, then how can I add parent id equal null(pitem.Id = null;)?? Throwing exception.
When i'm trying to add parent reference to List, It's throwing the error
"Object reference not set to an instance of an object."
Yes,I got it... fileitem.Parents = new List() { new ParentReference() { Id = _parent } };
from the below link: http://www.daimto.com/google-drive-api-c-upload/[^]
Thank you soo much Ms.Linda ;-)