Monday, November 18, 2013

Cool feature in Win 8.1 mail app

I noticed I don’t get notifications for incoming emails anymore after upgrading to win8.1,

Sometimes I do, most of the times I don’t.

At first I thought this was a bug, but apparently this is a new awesome feature from Microsoft.image

The guys implemented a new feature into the mail app (not outlook, the native mail app) called “favorites”, and it is adding people you are most commonly communicating with to that list.

The settings by default changed to show the notification only when you get an email from someone from that group, so it does not distract you when you get emails from other people.

If you do want the notification to show all the time you can of course change it, for instance if you work at sales or support I guess most of your emails would not be from a selected few.

But for the most part, this is great in reducing the distraction involved with constantly getting email notifications on my screen. I just wish it was a bit more clear and perhaps even prompted me about this instead of just applying it for me.

You go to your mail app, settings, accounts and this is where you find it!

Friday, November 8, 2013

SPFieldMultiLineText.RichText = true does not update

Interesting thing happened to me today, and I guess I’ve seen it happening at least 10 times in the past but I keep forgetting what the solution was every time I see it again.

Say you create a multiple lines of text field in a list (Note field type of class SPFieldMultiLineText).

Now, you want to make sure it supports HTML but you want to do it via code.

The simple thing to do appears to be:

SPFieldMultiLineText myField = …;
myField.RichText = true;
myField.RichTextMode = FullHtml;

Right? Wrong!

Run that code again, you will find that the RichText and RichTextMode properties were not modified.

Even calling list.Update() doesn’t help.

Apparently, the simple solution is to edit and set the myField.SchemaXml property directly, without calling myField.Update() after. Simple, yet annoying.

Here is an example of a working code:

XDocument xSchema = XDocument.Parse(field.SchemaXml);
var xField = xSchema.Root;
bool needUpdate = false;
var xRichText = xField.Attribute("RichText");
if (xRichText == null)
    needUpdate = true;
    xField.SetAttributeValue("RichText", "TRUE");
else if(xRichText.Value != "TRUE")
    needUpdate = true;
var xRichTextMode = xField.Attribute("RichTextMode");
if (xRichTextMode == null)
    needUpdate = true;
    xField.SetAttributeValue("RichTextMode", "FullHtml");
else if (xRichTextMode.Value != "FullHtml")
    needUpdate = true;
if( needUpdate )
    field.SchemaXml = xSchema.ToString();