Get Inserted Item IMobileServiceSyncTable RRS feed

  • Question

  • Helo, I'm new with IMobileServiceClient, and I have a problem...

    I want to know how to get the inserted Item Id after InsertAsync, if any one knows any way, pleas help me.

    Tuesday, June 11, 2019 9:17 PM

All replies

  • Thanks for asking Question! To get the inserted Item after InsertAsync, item new will contain the Id that it got on the server after the InsertAsync line.


    //Creates an empty item (id is now null)

    MyClass newItem = new MyClass();

    //Uploading the item

    await MobileService.GetTable<MyClass>().InsertAsync(newItem);

    //Returning the id which is now the Id of the row on the server

    return newItem.Id;

    Wednesday, June 12, 2019 5:52 PM