2014-04-30 8 views
0

Google 드라이브 C# 애플리케이션을 만들고 있는데 해결 방법을 모르는 오류가 있습니다. 나는 다음과 같은 오류가 폴더를 만들려고 할 때 : 당신은 폴더에 미디어를 업로드하려는Google 드라이브 Api 폴더 생성 오류

File body = new File(); 
body.Title = "NewFolder"; 
body.Description = "testtest"; 
body.MimeType = "application/vnd.google-apps.folder"; 
// service is an authorized Drive API service instance 

FilesResource.InsertMediaUpload request = service.Files.Insert(body); 
request.Upload(); 
File file = request.ResponseBody; 
+1

오류 메시지가 명확하지 않다? 암시 적으로'InsertRequest' 타입을'InsertMediaUpload'로 변환 할 수 없습니다. 나는 google-drive-sdk에 익숙하지 않지만 그들이 명백한 대화를하고 있는지 확인합니다. –

+0

자바 스크립트로 해봤지만이 링크는 C# https://developers.google.com/google-apps/documents-list/#retrieving_a_list_of_collections를 사용하는 데 도움이 될 수 있습니다. – TheDean

답변

0

: 여기

Cannot implicitly convert type 'Google.Apis.Drive.v2.FilesResource.InsertRequest' to 'Google.Apis.Drive.v2.FilesResource.InsertMediaUpload'

를 코드입니다. 폴더에는 미디어가 없으므로 사용자가하려는 것은 의미가 없습니다.

0

사용이 VAR 또는 FilesResource.InsertMediaUpload 대신 :

File body = new File(); 
body.Title = "NewFolder"; 
body.Description = "testtest"; 
body.MimeType = "application/vnd.google-apps.folder"; 
// service is an authorized Drive API service instance 


var request = service.Files.Insert(body); 
request.Upload(); 
File file = request.ResponseBody;