When listing a Drive folder's changes (via ChangeResource) for the first time, what page token should be used?










0















Lets say the user already has files synchronized (via my app) to their Drive folder. Now they sign into my app on a second device and is ready to sync files for the first time. Do I use the Changes API for the initial sync process?



I ask because using the Changes API requires a StartPageToken, which requires that there had been a previous sync operation. Well there is no possible way for user to already have a StartPageToken if they are synchronizing data on a device for the first time.



Google's documentation is a joke. They shouldn't leave it up to us to read between the lines and just figure this out. I'm sure I can cook up something that will "work", but how do I ever know that it is the "appropriate" and EFFICIENT way to go about handling this?



public async Task<AccessResult> GetChangesAsync(CancellationToken cancellationToken, string fields = "*")

ChangesResource.ListRequest listRequest = new ChangesResource.ListRequest(DriveService, startPageToken)

Spaces = Folder_appDataFolder,
Fields = fields + ", nextPageToken",
IncludeRemoved = true,
PageSize = 20
;

ChangeList changeList = await listRequest.ExecuteAsync(cancellationToken);



Here, I am looking to start syncing the user's for the first time and so a page token doesn't even make sense for that because during the first sync your goal is to get all of the users data. From then on you are looking to only sync any further changes.



One approach I thought of is to simply use ListRequest to list all of the users data and start downloading files that way. I can then simply request a start page token and store it to be used during sync attempts that occur later...



...But what if during the initial download of the user's files (800 files, for example) an error occurs, and the ListRequest fails on file 423? Because I cannot attain a StartPageToken in the middle of a ListRequest to store in case of emergency, do I have to start all over and download all 800 files again, instead of starting at file 423?










share|improve this question




























    0















    Lets say the user already has files synchronized (via my app) to their Drive folder. Now they sign into my app on a second device and is ready to sync files for the first time. Do I use the Changes API for the initial sync process?



    I ask because using the Changes API requires a StartPageToken, which requires that there had been a previous sync operation. Well there is no possible way for user to already have a StartPageToken if they are synchronizing data on a device for the first time.



    Google's documentation is a joke. They shouldn't leave it up to us to read between the lines and just figure this out. I'm sure I can cook up something that will "work", but how do I ever know that it is the "appropriate" and EFFICIENT way to go about handling this?



    public async Task<AccessResult> GetChangesAsync(CancellationToken cancellationToken, string fields = "*")

    ChangesResource.ListRequest listRequest = new ChangesResource.ListRequest(DriveService, startPageToken)

    Spaces = Folder_appDataFolder,
    Fields = fields + ", nextPageToken",
    IncludeRemoved = true,
    PageSize = 20
    ;

    ChangeList changeList = await listRequest.ExecuteAsync(cancellationToken);



    Here, I am looking to start syncing the user's for the first time and so a page token doesn't even make sense for that because during the first sync your goal is to get all of the users data. From then on you are looking to only sync any further changes.



    One approach I thought of is to simply use ListRequest to list all of the users data and start downloading files that way. I can then simply request a start page token and store it to be used during sync attempts that occur later...



    ...But what if during the initial download of the user's files (800 files, for example) an error occurs, and the ListRequest fails on file 423? Because I cannot attain a StartPageToken in the middle of a ListRequest to store in case of emergency, do I have to start all over and download all 800 files again, instead of starting at file 423?










    share|improve this question


























      0












      0








      0








      Lets say the user already has files synchronized (via my app) to their Drive folder. Now they sign into my app on a second device and is ready to sync files for the first time. Do I use the Changes API for the initial sync process?



      I ask because using the Changes API requires a StartPageToken, which requires that there had been a previous sync operation. Well there is no possible way for user to already have a StartPageToken if they are synchronizing data on a device for the first time.



      Google's documentation is a joke. They shouldn't leave it up to us to read between the lines and just figure this out. I'm sure I can cook up something that will "work", but how do I ever know that it is the "appropriate" and EFFICIENT way to go about handling this?



      public async Task<AccessResult> GetChangesAsync(CancellationToken cancellationToken, string fields = "*")

      ChangesResource.ListRequest listRequest = new ChangesResource.ListRequest(DriveService, startPageToken)

      Spaces = Folder_appDataFolder,
      Fields = fields + ", nextPageToken",
      IncludeRemoved = true,
      PageSize = 20
      ;

      ChangeList changeList = await listRequest.ExecuteAsync(cancellationToken);



      Here, I am looking to start syncing the user's for the first time and so a page token doesn't even make sense for that because during the first sync your goal is to get all of the users data. From then on you are looking to only sync any further changes.



      One approach I thought of is to simply use ListRequest to list all of the users data and start downloading files that way. I can then simply request a start page token and store it to be used during sync attempts that occur later...



      ...But what if during the initial download of the user's files (800 files, for example) an error occurs, and the ListRequest fails on file 423? Because I cannot attain a StartPageToken in the middle of a ListRequest to store in case of emergency, do I have to start all over and download all 800 files again, instead of starting at file 423?










      share|improve this question
















      Lets say the user already has files synchronized (via my app) to their Drive folder. Now they sign into my app on a second device and is ready to sync files for the first time. Do I use the Changes API for the initial sync process?



      I ask because using the Changes API requires a StartPageToken, which requires that there had been a previous sync operation. Well there is no possible way for user to already have a StartPageToken if they are synchronizing data on a device for the first time.



      Google's documentation is a joke. They shouldn't leave it up to us to read between the lines and just figure this out. I'm sure I can cook up something that will "work", but how do I ever know that it is the "appropriate" and EFFICIENT way to go about handling this?



      public async Task<AccessResult> GetChangesAsync(CancellationToken cancellationToken, string fields = "*")

      ChangesResource.ListRequest listRequest = new ChangesResource.ListRequest(DriveService, startPageToken)

      Spaces = Folder_appDataFolder,
      Fields = fields + ", nextPageToken",
      IncludeRemoved = true,
      PageSize = 20
      ;

      ChangeList changeList = await listRequest.ExecuteAsync(cancellationToken);



      Here, I am looking to start syncing the user's for the first time and so a page token doesn't even make sense for that because during the first sync your goal is to get all of the users data. From then on you are looking to only sync any further changes.



      One approach I thought of is to simply use ListRequest to list all of the users data and start downloading files that way. I can then simply request a start page token and store it to be used during sync attempts that occur later...



      ...But what if during the initial download of the user's files (800 files, for example) an error occurs, and the ListRequest fails on file 423? Because I cannot attain a StartPageToken in the middle of a ListRequest to store in case of emergency, do I have to start all over and download all 800 files again, instead of starting at file 423?







      c# google-api google-drive-sdk google-api-dotnet-client






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 13 '18 at 8:10









      DaImTo

      46.5k1166246




      46.5k1166246










      asked Nov 13 '18 at 6:04









      LeBrown JonesLeBrown Jones

      343213




      343213






















          1 Answer
          1






          active

          oldest

          votes


















          0














          When doing changes.list for the first time you should call getStartPageToken this will return the page token you can use to get the change list. If its the first time then there will be no changes of course.



          If the user is using your application from more then one device then the logical course of action would be for you to save the page token in a central location when the user started the application for the first time on the first deceive. This will enable you to use that same token on all additional devices that the user may chose to use.



          This could be on your own server or even in the users app data folder on drive



          I am not exactly user what your application is doing but i really dont think you should be downloading the users files unless they try to access it. There is no logical reason i can think of for your application to store a mirror image of a users drive account. Access the data they need when they need it. You shouldn't need everything. Again i dont know exactly what your application does.






          share|improve this answer























          • Thanks for reply. I guess it’s too late to implement that approach since the app already has users. I guess there is no way to get the token that existed before there were any modifications to the users folder (which was when the user initially created account)....

            – LeBrown Jones
            Nov 13 '18 at 8:13











          • Its never to late to fix design issues with your application. Its just a question about how you go about it.

            – DaImTo
            Nov 13 '18 at 8:14











          • Also. It is a app where user notes are synchronized to their drive. Think of Google Keep as example. Upon initial sync they would need a copy of all data. From then on they only would sync changes

            – LeBrown Jones
            Nov 13 '18 at 8:14











          • You should never be downloading all a users data. Think of users on low data connections they could never use your application. Getting a time specific change token is a good idea you sould add a feature request issuetracker.google.com/issues?q=componentid:191650%2B

            – DaImTo
            Nov 13 '18 at 8:16











          • Umm when I used note taking apps like google keep on my iPhone or wherever, all of the data is downloaded to my device. Maybe not large media files, but the text in the note is downloaded. This indeed makes sense for my needs. But I don’t want to get too far off topic here lol. I need more detail for accomplishing my goal. :)

            – LeBrown Jones
            Nov 13 '18 at 8:19










          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53274751%2fwhen-listing-a-drive-folders-changes-via-changeresource-for-the-first-time-w%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          When doing changes.list for the first time you should call getStartPageToken this will return the page token you can use to get the change list. If its the first time then there will be no changes of course.



          If the user is using your application from more then one device then the logical course of action would be for you to save the page token in a central location when the user started the application for the first time on the first deceive. This will enable you to use that same token on all additional devices that the user may chose to use.



          This could be on your own server or even in the users app data folder on drive



          I am not exactly user what your application is doing but i really dont think you should be downloading the users files unless they try to access it. There is no logical reason i can think of for your application to store a mirror image of a users drive account. Access the data they need when they need it. You shouldn't need everything. Again i dont know exactly what your application does.






          share|improve this answer























          • Thanks for reply. I guess it’s too late to implement that approach since the app already has users. I guess there is no way to get the token that existed before there were any modifications to the users folder (which was when the user initially created account)....

            – LeBrown Jones
            Nov 13 '18 at 8:13











          • Its never to late to fix design issues with your application. Its just a question about how you go about it.

            – DaImTo
            Nov 13 '18 at 8:14











          • Also. It is a app where user notes are synchronized to their drive. Think of Google Keep as example. Upon initial sync they would need a copy of all data. From then on they only would sync changes

            – LeBrown Jones
            Nov 13 '18 at 8:14











          • You should never be downloading all a users data. Think of users on low data connections they could never use your application. Getting a time specific change token is a good idea you sould add a feature request issuetracker.google.com/issues?q=componentid:191650%2B

            – DaImTo
            Nov 13 '18 at 8:16











          • Umm when I used note taking apps like google keep on my iPhone or wherever, all of the data is downloaded to my device. Maybe not large media files, but the text in the note is downloaded. This indeed makes sense for my needs. But I don’t want to get too far off topic here lol. I need more detail for accomplishing my goal. :)

            – LeBrown Jones
            Nov 13 '18 at 8:19















          0














          When doing changes.list for the first time you should call getStartPageToken this will return the page token you can use to get the change list. If its the first time then there will be no changes of course.



          If the user is using your application from more then one device then the logical course of action would be for you to save the page token in a central location when the user started the application for the first time on the first deceive. This will enable you to use that same token on all additional devices that the user may chose to use.



          This could be on your own server or even in the users app data folder on drive



          I am not exactly user what your application is doing but i really dont think you should be downloading the users files unless they try to access it. There is no logical reason i can think of for your application to store a mirror image of a users drive account. Access the data they need when they need it. You shouldn't need everything. Again i dont know exactly what your application does.






          share|improve this answer























          • Thanks for reply. I guess it’s too late to implement that approach since the app already has users. I guess there is no way to get the token that existed before there were any modifications to the users folder (which was when the user initially created account)....

            – LeBrown Jones
            Nov 13 '18 at 8:13











          • Its never to late to fix design issues with your application. Its just a question about how you go about it.

            – DaImTo
            Nov 13 '18 at 8:14











          • Also. It is a app where user notes are synchronized to their drive. Think of Google Keep as example. Upon initial sync they would need a copy of all data. From then on they only would sync changes

            – LeBrown Jones
            Nov 13 '18 at 8:14











          • You should never be downloading all a users data. Think of users on low data connections they could never use your application. Getting a time specific change token is a good idea you sould add a feature request issuetracker.google.com/issues?q=componentid:191650%2B

            – DaImTo
            Nov 13 '18 at 8:16











          • Umm when I used note taking apps like google keep on my iPhone or wherever, all of the data is downloaded to my device. Maybe not large media files, but the text in the note is downloaded. This indeed makes sense for my needs. But I don’t want to get too far off topic here lol. I need more detail for accomplishing my goal. :)

            – LeBrown Jones
            Nov 13 '18 at 8:19













          0












          0








          0







          When doing changes.list for the first time you should call getStartPageToken this will return the page token you can use to get the change list. If its the first time then there will be no changes of course.



          If the user is using your application from more then one device then the logical course of action would be for you to save the page token in a central location when the user started the application for the first time on the first deceive. This will enable you to use that same token on all additional devices that the user may chose to use.



          This could be on your own server or even in the users app data folder on drive



          I am not exactly user what your application is doing but i really dont think you should be downloading the users files unless they try to access it. There is no logical reason i can think of for your application to store a mirror image of a users drive account. Access the data they need when they need it. You shouldn't need everything. Again i dont know exactly what your application does.






          share|improve this answer













          When doing changes.list for the first time you should call getStartPageToken this will return the page token you can use to get the change list. If its the first time then there will be no changes of course.



          If the user is using your application from more then one device then the logical course of action would be for you to save the page token in a central location when the user started the application for the first time on the first deceive. This will enable you to use that same token on all additional devices that the user may chose to use.



          This could be on your own server or even in the users app data folder on drive



          I am not exactly user what your application is doing but i really dont think you should be downloading the users files unless they try to access it. There is no logical reason i can think of for your application to store a mirror image of a users drive account. Access the data they need when they need it. You shouldn't need everything. Again i dont know exactly what your application does.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 13 '18 at 8:09









          DaImToDaImTo

          46.5k1166246




          46.5k1166246












          • Thanks for reply. I guess it’s too late to implement that approach since the app already has users. I guess there is no way to get the token that existed before there were any modifications to the users folder (which was when the user initially created account)....

            – LeBrown Jones
            Nov 13 '18 at 8:13











          • Its never to late to fix design issues with your application. Its just a question about how you go about it.

            – DaImTo
            Nov 13 '18 at 8:14











          • Also. It is a app where user notes are synchronized to their drive. Think of Google Keep as example. Upon initial sync they would need a copy of all data. From then on they only would sync changes

            – LeBrown Jones
            Nov 13 '18 at 8:14











          • You should never be downloading all a users data. Think of users on low data connections they could never use your application. Getting a time specific change token is a good idea you sould add a feature request issuetracker.google.com/issues?q=componentid:191650%2B

            – DaImTo
            Nov 13 '18 at 8:16











          • Umm when I used note taking apps like google keep on my iPhone or wherever, all of the data is downloaded to my device. Maybe not large media files, but the text in the note is downloaded. This indeed makes sense for my needs. But I don’t want to get too far off topic here lol. I need more detail for accomplishing my goal. :)

            – LeBrown Jones
            Nov 13 '18 at 8:19

















          • Thanks for reply. I guess it’s too late to implement that approach since the app already has users. I guess there is no way to get the token that existed before there were any modifications to the users folder (which was when the user initially created account)....

            – LeBrown Jones
            Nov 13 '18 at 8:13











          • Its never to late to fix design issues with your application. Its just a question about how you go about it.

            – DaImTo
            Nov 13 '18 at 8:14











          • Also. It is a app where user notes are synchronized to their drive. Think of Google Keep as example. Upon initial sync they would need a copy of all data. From then on they only would sync changes

            – LeBrown Jones
            Nov 13 '18 at 8:14











          • You should never be downloading all a users data. Think of users on low data connections they could never use your application. Getting a time specific change token is a good idea you sould add a feature request issuetracker.google.com/issues?q=componentid:191650%2B

            – DaImTo
            Nov 13 '18 at 8:16











          • Umm when I used note taking apps like google keep on my iPhone or wherever, all of the data is downloaded to my device. Maybe not large media files, but the text in the note is downloaded. This indeed makes sense for my needs. But I don’t want to get too far off topic here lol. I need more detail for accomplishing my goal. :)

            – LeBrown Jones
            Nov 13 '18 at 8:19
















          Thanks for reply. I guess it’s too late to implement that approach since the app already has users. I guess there is no way to get the token that existed before there were any modifications to the users folder (which was when the user initially created account)....

          – LeBrown Jones
          Nov 13 '18 at 8:13





          Thanks for reply. I guess it’s too late to implement that approach since the app already has users. I guess there is no way to get the token that existed before there were any modifications to the users folder (which was when the user initially created account)....

          – LeBrown Jones
          Nov 13 '18 at 8:13













          Its never to late to fix design issues with your application. Its just a question about how you go about it.

          – DaImTo
          Nov 13 '18 at 8:14





          Its never to late to fix design issues with your application. Its just a question about how you go about it.

          – DaImTo
          Nov 13 '18 at 8:14













          Also. It is a app where user notes are synchronized to their drive. Think of Google Keep as example. Upon initial sync they would need a copy of all data. From then on they only would sync changes

          – LeBrown Jones
          Nov 13 '18 at 8:14





          Also. It is a app where user notes are synchronized to their drive. Think of Google Keep as example. Upon initial sync they would need a copy of all data. From then on they only would sync changes

          – LeBrown Jones
          Nov 13 '18 at 8:14













          You should never be downloading all a users data. Think of users on low data connections they could never use your application. Getting a time specific change token is a good idea you sould add a feature request issuetracker.google.com/issues?q=componentid:191650%2B

          – DaImTo
          Nov 13 '18 at 8:16





          You should never be downloading all a users data. Think of users on low data connections they could never use your application. Getting a time specific change token is a good idea you sould add a feature request issuetracker.google.com/issues?q=componentid:191650%2B

          – DaImTo
          Nov 13 '18 at 8:16













          Umm when I used note taking apps like google keep on my iPhone or wherever, all of the data is downloaded to my device. Maybe not large media files, but the text in the note is downloaded. This indeed makes sense for my needs. But I don’t want to get too far off topic here lol. I need more detail for accomplishing my goal. :)

          – LeBrown Jones
          Nov 13 '18 at 8:19





          Umm when I used note taking apps like google keep on my iPhone or wherever, all of the data is downloaded to my device. Maybe not large media files, but the text in the note is downloaded. This indeed makes sense for my needs. But I don’t want to get too far off topic here lol. I need more detail for accomplishing my goal. :)

          – LeBrown Jones
          Nov 13 '18 at 8:19



















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53274751%2fwhen-listing-a-drive-folders-changes-via-changeresource-for-the-first-time-w%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

          Crossroads (UK TV series)

          ữḛḳṊẴ ẋ,Ẩṙ,ỹḛẪẠứụỿṞṦ,Ṉẍừ,ứ Ị,Ḵ,ṏ ṇỪḎḰṰọửḊ ṾḨḮữẑỶṑỗḮṣṉẃ Ữẩụ,ṓ,ḹẕḪḫỞṿḭ ỒṱṨẁṋṜ ḅẈ ṉ ứṀḱṑỒḵ,ḏ,ḊḖỹẊ Ẻḷổ,ṥ ẔḲẪụḣể Ṱ ḭỏựẶ Ồ Ṩ,ẂḿṡḾồ ỗṗṡịṞẤḵṽẃ ṸḒẄẘ,ủẞẵṦṟầṓế