google blog에 따르면 Google API를 사용하여 개인 문서에 모든 종류의 파일을 업로드 할 수 있습니다 (비즈니스 계정에서는 이미 가능함).google api로 파일 업로드
하지만 지금 URI에 ?convert=false
을 추가하려고하면 서비스에서 403 응답을 받았습니다. 이 코드를 사용
는 잘 작동 ?convert=false
없이
int CHUNK_SIZE = 1;
ClientLoginAuthenticator cla = new ClientLoginAuthenticator("uploader", ServiceNames.Documents, "username", "password");
// Set up resumable uploader and notifications
ResumableUploader ru = new ResumableUploader(CHUNK_SIZE);
ru.AsyncOperationCompleted += new AsyncOperationCompletedEventHandler(ru_AsyncOperationCompleted);
ru.AsyncOperationProgress += new AsyncOperationProgressEventHandler(ru_AsyncOperationProgress);
// Set metadata for our upload.
Document entry = new Document();
entry.Title = "test file";
entry.MediaSource = new MediaFileSource(fileName, "application/msword");
// Add the upload uri to document entry.
Uri createUploadUrl = new Uri("https://docs.google.com/feeds/upload/create-session/default/private/full?convert=false");
AtomLink link = new AtomLink(createUploadUrl.AbsoluteUri);
link.Rel = ResumableUploader.CreateMediaRelation;
entry.DocumentEntry.Links.Add(link);
ru.InsertAsync(cla, entry.DocumentEntry, new object());
(이것은 SVN 트렁크에서 google-gdata C# API 클라이언트를 사용).
어떤 도움을 주셔서 감사합니다. 예를 들어 서비스에서 실제로 게시/수신하는 API 클라이언트를 확인하는 방법입니다.
? convert = false는 정확히 무엇을합니까? –
@Ramhound by reference -이 옵션은 자동 문서 변환을 끕니다 (따라서 - 파일을 업로드 할 수 있습니다) – Meta