Retrieving data from Azure Mobile Services

0 votes

When I try to retrieve data for a Windows 10 app I am developing with an Azure backend that I have begun to integrate, I receive the strangest error. Please see the code below:

Code in App.xaml.cs

// Setting up a client to retrieve data, using localhost just to try it out
public static MobileServiceClient DigestsTrackerClient = new MobileServiceClient("http://localhost:28451/");

Code on WeekItem.cs

// Method to get data from Mobile Services
public static async void GetWeekItems(List<WeekItem> passer)
{
    // Getting a InvalidOperationException down here
    IMobileServiceTable<WeekItem> weekTable = App.DigestsTrackerClient.GetTable<WeekItem>();
    passer = await weekTable.ToListAsync();    
}

More information on the exception:

An exception of type 'System.InvalidOperationException' occurred in 
Microsoft.WindowsAzure.Mobile.dll but was not handled in user code

Additional information: No 'id' member found on type 'TechDigest.Model.WeekItem'.

Here is the model for the object I'm attempting to retrieve as well:

public class WeekItem
{
    public int WeekID { get; set; }
    public string Title { get; set; }
    public string ImageURI { get; set; }
}

Any assistance would be greatly appreciated as I basically copied the code from a demo created by an Azure engineer  and mine throws this strange exception.

Feb 14, 2023 in Azure by Damonlang
• 1,230 points

edited 5 days ago 17 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP