Menu

Azure App Service: Offline Sync – Do not use CreatedAt for Display

In the Azure App Service Mobile Client Offline Sync:

With offline sync, the CreatedAt field for a new record that has not been synced is null. If you set CreatedAt to DateTime.Now or another value, on sync, CreatedAt will be replaced with the DateTime of when the sync occurred (used for incremental syncs among other things). If you need to have a created time that corresponds to the actual time the user created the record, created your own property, say DateUTC, and set it yourself to DateUTC.Now;. This value will not change. The only concern with doing this is if the user somehow has the date wrong on their device, the DateUTC will be wrong as well. Hopefully everyone has figured out that having their device date/time set automatically is a good thing.

Update Azure App Service Mobile Apps Beta to GA (General Availability) for Production

Microsoft has gone GA (General Availability) with the new Azure App Services Mobile Apps which means it is available for production use!

To update to the latest NuGet packages, you’ll need to remove the WindowsAzure.MobileServices* packages from your projects and add the new Microsoft.Azure.Mobile.Client* (currently 2.0.0) packages.

No code changes are necessary because even though they changed the NuGet package name, the dll names and namespaces have not changed.

From Xamarin Studio:
Azure Mobile Client SDK

Local Debugging with User Authentication of an Azure Mobile App Service

Azure Mobile Apps

Local debugging of an Azure Mobile App Service can be a real timesaver, however, using provider authentication such as Facebook or Google throws a wrench in process. In the past, I resorted to logging on the server side and viewing the streaming logs. This was cumbersome and not to mention time consuming. Thankfully, that can be changed. Local debugging with user authentication of an Azure Mobile App Service is now super easy.

Thanks to the documentation, I knew it was possible, but a few things weren’t entirely clear. The steps below bring everything you need to configure local debugging with authentication into one place.

I assume you are working with the following:

In the [Project]/App_Start/Startup.MobileApp.cs file of your Mobile Apps Service, add the following highlighted code:

You’ll need to grab the WEBSITE_AUTH_SIGNING_KEY for your service. This key is highly sensitive and should never be included in a client application. This should be only used on the service side.

  1. Open a browser and navigate to https://{servicename}.scm.azurewebsites.net/, replacing the {servicename}. This will take you to the Kudu settings.
  2. If you do not know your Service Name, you can find it as follows:
    1. Login to the Azure Portal.
    2. Navigate to your App Service.
    3. Click on Tools in the top bar underneath Mobile App Code.
    4. Under the Tools, find Develop and then click on Kudu in that section.
  3. You should now be on the Kudu settings site mentioned in step 1. Click on Environment on the top navigation bar.
  4. Search for “WEBSITE_AUTH_SIGNING_KEY” without quotes. It should be under the environment variable section.
  5. Copy this value for the the next section.

Still in your Mobile Apps Service, in the [Project]/Web.config, add the following highlighted code making sure to replace the {} items with their appropriate values:

In your Mobile App using Azure Mobile Services (in my case, this is for a Xamarin Mobile App) you will need the following code where you are currently instantiating your MobileServiceClient:

The key issue I was running into originally was that I did not set the AlternateLoginHost  to the actual service. This had resulted in a 404 error being displayed on my mobile app when clicking an authentication provider. Setting the this value makes all authentication calls still hit your Azure Service while your data calls hit the local service for easy debugging.

Note: This does not allow you to debug your service with authentication without an internet connection. You will still need an active internet connection, especially if your service hits other services. An example would be calling  GetAppServiceIdentityAsync<FacebookCredentials>  which calls out to the login provider service and requires an internet connection.

Being able to locally debug a service that uses authentication is an absolute timesaver. Hopefully this will help you get it up and running.

Editing a list item in SharePoint 2010 causes my appended column data to disappear or get overwritten

You’re likely here because you have a SharePoint list that contains a multi-line text column with appending enabled. The issue as it presents itself is that your list items are losing the appended column data when someone updates the item. It may be that the appended data is completely gone or that it loses all but the latest entry.

When you first add a “Multiple lines of text” column to a SharePoint list you have the option to enable “Append Changes to Existing Text”. If you don’t already have versioning enabled on the list you’ll get the following dialog box when you click OK to create the column:

versioning_required

I’m not going to go into enabling versioning in this post. The assumption is that you’re seeing the issue in the title because you had versioning enabled on a list and you created a multi-line text column that enabled appending.

What we’ve discovered as the most likely cause is that versioning at some point has now been disabled on this particular SharePoint list. Having version history disabled and then updating a list item will actually overwrite all of the previously appended comments with whatever the last update contained. If it was blank it will blank out the comments.

The underlying issue here is that disabling version history on a list in SharePoint 2010 that has a column that appends text does NOT give a warning. I have yet to test this on SharePoint 2013 to see if the same flaw still exists.

In summary, adding a multi-line text column with appended text to a list and then later disabling version history on said list is something you want to avoid. To resolve the issue simply re-enable version history on the list.

doubleTwist Automatically Mounts SD Card on Android Phone Despite Choosing Charge Only

I recently made the move from the iPhone 3GS to the HTC EVO with Sprint. There are plenty of articles out there comparing Apple’s phones to those running Android so I will leave any comparisons out of this post and stick to the problem I was trying to solve.

As I was learning the nuances of Android, I ran into an issue where any time I plugged in the phone via USB to my computer I could no longer use any phone applications that needed to access the SD Card. What perplexed me was that I was choosing, via HTC’s Sense UI popup, that I only wanted to charge the phone. What was even more frustrating was that any time I wanted to listen to music or watch a video from the phone’s SD Card I would have to unplug the USB cable. I could not charge my phone while using the applications I wanted to.

After looking through multiple settings on the phone, trying to find the cause of the problem, I finally stumbled on the cause and solution. I had, upon purchasing the phone, installed doubleTwist as my media player replacement. What I had not realized is that doubleTwist has an option to auto mount the SD Card any time you plug in a USB cable that is attached to a computer. As soon as I changed the setting in doubleTwist my problem went away. So what setting do you need to change?

Open doubleTwist on your Android phone. Open the Menu and choose Settings. Under the Settings look for Auto USB drive and uncheck the box. This should prevent doubleTwist from auto mounting your SD Card when you plug in your Android phone via USB.