Windows Phone Error code: 85010014

The Short Version

My phone suddenly began reporting Error Code: 85010014 when attempting to sync my work email.

The Fix

It turns out I had a calendar event with a status of “Meeting Elsewhere”.  Changing the status to “Free/Busy/Tentative/Out Of Office” fixed the problem immediately.

The Long Story

Four days ago, my work email suddenly refused to sync on my phone, giving me error code 85010014.  I searched the web, over and over and over and over, to no avail (which is why I’m posting this), so figuring it out was up to me.

What made it look like a device issue:

Because my Outlook and my Web Access functioned properly, from the business side anyway, it looked as though the problem was on my device somehow.  The first thing I attempted was to change my password, but that didn’t fix the problem.

Why a device issue just didn’t feel right:

There were several reasons why I was sure it wasn’t a problem on my device.  I observed the following:

  • Restarting device didn’t fix
  • Removing and Re-Adding the account didn’t fix
  • Removing and Restarting and Re-Adding the account didn’t fix
  • Outlook.com address was working
  • School email (exchange also) was working

Then, I started reading a forum post I came across, which linked to another post, which linked to another post….anyway, I eventually made my way to a post from a problem someone experienced several years ago on their WP7 device with similar symptoms.  They fixed it by unchecking all the boxes for “Content to sync”, then syncing, then adding “Email”, then syncing, then “Contacts”, sync, “Calendar”, sync, “Tasks”, sync.  He observed that by adding the services back one-by-one, the sync was successful and his problem went away.  So I did the same thing, and noticed the same thing…until I checked the box next to Calendar.  The sync failed.  So, I was able to observe that my account would sync, as long as I didn’t attempt to sync the calendar.  So, I pulled out my old WP 7 device and sure enough, I was able to duplicate this behavior.  So, this helped me narrow down the problem, and eliminate my device. 

I kept reading about “try refreshing your cache”, and I wasn’t sure if that was IE cache, or some special device cache or what, but the Microsoft support folks in the forums kept saying, “contact your device manufacture for instructions to clear the cache”.  So, I updated to Windows Phone 8.1.  I’ve been wanting it anyway, and it was released to developers that day, so I downloaded it.  I assumed it would clear my cache, but whether it did or not, the problem persisted.

So, I added my account to my co-workers phone (another WP8, different manufacturer), and was able to duplicate the behavior.  All the while, his account continued to function properly.

So, now I’m convinced that there is a problem with my account, or my calendar or something, but no one knows what to do, and officially, my employer doesn’t support email on devices.  So, I’ve been dealing with this for four days, and tonight I decided to really dig in and try to get this figured out.

I started by looking at the properties of my calendar in Outlook.  I noticed that I’ve never cleaned my calendar since I started with the company two years ago, so it had well over 400 items.  I thought surely not, but maybe-just-maybe, I’ve reached some sort of threshold and the sync process can’t handle so many calendar items.  So, I performed an archive and removed all events older than 90 days.  Still nothing.

So, I started looking through my upcoming events and found one that had my status as “Meeting Elsewhere”, because I’m trying anything and everything I can think of at this point, I change it to “Free” and try syncing on my phone, success!  I thought maybe it just took a while for the clean-up to take effect, so I changed the status back to “Meeting Elsewhere” and sure enough, it broke again, and to fix it, just switch it back to “Free”.

Advertisements

Remove Recipients From Email When Not In Release Mode

Often, we need our applications to send emails to people.  When this is the case, if we are not careful, we can end up sending test emails to our external users.  We can get around this very easily by using preprocessor directives and writing our own SmtpClient class.

This isn’t a tutorial on sending email through .net, but here is a very basic function that will do that.  First the usings:

using System.Collections.Generic;
using System.Net.Mail;

Then the function:

public void sendEmail(string message, string subject, MailAddress fromAddress, 
            List<MailAddress> toAddressList, List<MailAddress> ccAddressList, 
            List<MailAddress> bccAddressList)
{
    MailMessage mail = new MailMessage();
    SmtpClient client = new SmtpClient();

    mail.From = fromAddress;
    mail.Subject = subject;
    mail.Body = message;

    foreach (MailAddress address in toAddressList)
    {
        mail.To.Add(address);
    }

    foreach (MailAddress address in ccAddressList)
    {
        mail.CC.Add(address);
    }

    foreach (MailAddress address in bccAddressList)
    {
        mail.Bcc.Add(address);
    }

    client.Host = "smtp.gmail.com";
    client.Port = 587;
    client.Credentials = new System.Net.NetworkCredential("username", "****");
    client.EnableSsl = true;

    client.Send(mail);
}

Now, that is just a generic function that will send an email.  I’m not going to bother explaining it.  See that last line though: “client.Send(mail);”?  That Send function is what we want to change.  To do that, we create a new class, with SmtpClient as the base, and then overload the Send function.

Our usings are the same:

using System.Collections.Generic;
using System.Net.Mail;

And here is our new class:

class NewSmtpClient : SmtpClient
{
    public void Send(MailMessage message)
    {
#if DEBUG
        List<MailAddress> toList = new List<MailAddress>(message.To);
        List<MailAddress> ccList = new List<MailAddress>(message.CC);
        List<MailAddress> bccList = new List<MailAddress>(message.Bcc);

        foreach(MailAddress address in toList)
        {
            if(address.Host.ToLower() != "gmail.com")
            {
                message.To.Remove(address);
            }
        }

        foreach (MailAddress address in ccList)
        {
            if (address.Host.ToLower() != "gmail.com")
            {
                message.CC.Remove(address);
            }
        }

        foreach (MailAddress address in bccList)
        {
            if (address.Host.ToLower() != "gmail.com")
            {
                message.Bcc.Remove(address);
            }
        }
#endif

        //there must be at least one recipient 
        if ((message.To.Count + message.CC.Count + message.Bcc.Count) > 0)
        {
            base.Send(message);
        }
    }
}

Of course, now that we have our new class, we need to change our calling function.  So, in our generic function we will change

SmtpClient client = new SmtpClient();

to

NewSmtpClient client = new NewSmtpClient();

So, I want to explain a few things here.  See that fifth line, #if DEBUG?  That’s a preprocessor directive.  Visual Basic has them to, but MSDN just called them directives.  Anyway, these directives are processed before the compiler runs.  Anything between #if DEBUG and #endif will not even show up in the IL Code if you compile in Release mode.

What is happening in our example class here, is that when you call client.Send(mail), if you are in DEBUG mode, then we remove any email recipient whose host is not “gmail.com”.  Of course, you would use any host that you want.  This results in a recipient list that is any of the original recipients but, no emails will be sent to “gmail.com”.  I don’t think that is worded very well, so let me visualize it for you.

  • To List
    • one@gmail.com
    • one@yahoo.com
    • one@bing.com
  • CC List
    • two@gmail.com
    • two@yahoo.com
    • two@bing.com
  • BCC List
    • three@gmail.com
    • three@yahoo.com
    • three@bing.com

After we call Send, but before the email is actually sent, the new recipient list looks like this:

  • To List
    • one@gmail.com
  • CC List
    • two@gmail.com
  • BCC List
    • three@gmail.com

The if statement at the end is because it is possible that we will end up removing all of our recipients, in which case we don’t want to send the email.  In this scenario, but without such an if statement, an exception will be thrown.

If this post has helped you in any way, please leave a comment below. Or, if you solved this method another way, please leave a comment.  I would like to hear from you!