将docx转换为gdoc(OpenWithLinks = null)

时间:2015-06-15 08:16:52

标签: google-drive-api google-docs google-docs-api google-api-dotnet-client

我正在使用Google Drive API上传docx文件。我需要在编辑模式下打开文档,但OpenWithLinks为空。

我正在使用c#客户端库。

    var mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
    var filename = "Document1.docx";
    Google.Apis.Drive.v2.Data.File body = new Google.Apis.Drive.v2.Data.File();
    body.Title = filename;        
    body.Description = "Document 1";
    body.MimeType = mimeType;
    body.Parents = new List<Google.Apis.Drive.v2.Data.ParentReference>() { new Google.Apis.Drive.v2.Data.ParentReference() { Id = gSubFolderId } };

    byte[] byteArray = System.IO.File.ReadAllBytes(filename);
    System.IO.MemoryStream stream = new System.IO.MemoryStream(byteArray);

    FilesResource.InsertMediaUpload uploadRequest = service.Files.Insert(body, stream, mimeType);
    uploadRequest.Upload();

这些是文件属性(注意OpenWithLinks为null:S):

Editable: true
    EmbedLink: null
    ETag: "\"V1-oYosm7Hqin5z0Mtb-CnZdXIE/MTQzNDM0ODI4NDc4Mg\""
    ExplicitlyTrashed: null
    ExportLinks: null
    FileExtension: "docx"
    FileSize: 17640
    FolderColorRgb: null
    HeadRevisionId: "0Bxc5uNPKiV0zckhLY01MM3c1azBpb1cxcXkzWnJsVEtLa2xFPQ"
    IconLink: "https://ssl.gstatic.com/docs/doclist/images/icon_10_word_list.png"
    Id: "0Bxc5uNPKiV0zVjhMeDBwUDNBMjg"
    ImageMediaMetadata: null
    IndexableText: null
    Kind: "drive#file"
    Labels: {Google.Apis.Drive.v2.Data.File.LabelsData}
    LastModifyingUser: {Google.Apis.Drive.v2.Data.User}
    LastModifyingUserName: "User 1"
    LastViewedByMeDate: {6/15/2015 4:04:44 PM}
    LastViewedByMeDateRaw: "2015-06-15T06:04:44.782Z"
    MarkedViewedByMeDate: {1/1/1970 10:00:00 AM}
    MarkedViewedByMeDateRaw: "1970-01-01T00:00:00.000Z"
    Md5Checksum: "0fd61ff6879e7c7d1b1cadb5deb313c6"
    MimeType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
    ModifiedByMeDate: {6/15/2015 4:04:44 PM}
    ModifiedByMeDateRaw: "2015-06-15T06:04:44.782Z"
    ModifiedDate: {6/15/2015 4:04:44 PM}
    ModifiedDateRaw: "2015-06-15T06:04:44.782Z"
    OpenWithLinks: null

0 个答案:

没有答案