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;
myField.Update();

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;
    xRichText.SetValue("TRUE");
}
var xRichTextMode = xField.Attribute("RichTextMode");
if (xRichTextMode == null)
{
    needUpdate = true;
    xField.SetAttributeValue("RichTextMode", "FullHtml");
}
else if (xRichTextMode.Value != "FullHtml")
{
    needUpdate = true;
    xRichTextMode.SetValue("FullHtml");
}
                                                                        
if( needUpdate )
    field.SchemaXml = xSchema.ToString();

Tuesday, October 29, 2013

Using office 2013 with SharePoint 2010?

You might noticed DataSheet view doesn't work.

you get a alert, something like:

The list cannot be displayed in Datasheet view for one or more of the following reasons:

- A datasheet component compatible with Microsoft SharePoint Foundation is not installed.

- Your Web browser does not support ActiveX controls.

- A component is not properly configured for 32-bit or 64-bit support.

 

Now, assuming you installed 32 bit office and using 32 bit IE, you might be puzzled as to why this doesn’t work.

I found that if you install this component data sheet will start working:

http://www.microsoft.com/en-us/download/details.aspx?id=23734

I am using windows 8.1, but I am pretty sure this issue happens on all windows clients with Office 2013.

Enjoy!

Friday, October 18, 2013

Upgraded to Win 8.1

Just upgraded my Windows 8.1 preview to the released version.

Few tips:

  1. Windows 8.1 update was not showing in windows store on my PC running 8.1 preview. This was very easy to fix by typing this into the IE address bar: “ms-windows-store:WindowsUpgrade” very cool, classy fix I found by marcoes here: http://answers.microsoft.com/en-us/windows/forum/windows8_1_pr-windows_install/windows-81-update-not-showing-up-in-windows-store/db21fb30-4dfa-4828-8024-02e310449ba9?page=3
  2. Good thing to know, what happens to apps or desktop applications after you upgrade? Well, they say it depends how you upgrade and how you installed your windows. I upgraded using the store, after installing the preview using a CD, here is what I experienced:
    1. My start menu apps were all marked and ready to be installed. They were installed the first time i clicked them.
    2. My desktop applications were all gone. Had to reinstall them (skype, visual studio, office, etc).
    3. Install kept windows.old in my C: drive
    4. As usual, any shared folders will need to be re-shared
  3. There are many new cool features and customizations to the start menu. I strongly advise you right click your task bar –> properties and play with the options there:
    image 
    Which makes my start menu now looks like this:
    image
  4. In case you didn’t hear about it, the best reason to upgrade is being able to snap multiple apps at the same time, see twitter / desktop / music split on my right screen:
     image
  5. Now, for the real reason I upgraded from 8.1 preview… it appears that MSFT did not release windows updates to the preview version so time zone changes did not update correctly which meant all meetings invites I got from Israel were offset by 1 hour… after the upgrade – it all works well so far.

Wednesday, August 7, 2013

How to enforce unique answers with SharePoint survey’s Rating-Scale questions?


SharePoint surveys support various types of questions, one of them is the Rating-Scale question type which is used to collect users’ ratings.

Example:
Let’s say we want to get employees’ opinion about the upcoming company event, and learn which activities are most preferred. In this case the following survey might do the work:
 

 
In this case, users may also give different activities the same rating.
For example: in the following survey the user likes "Spa" and "Cooking class" in the same level so he gave them the same rating:


 
However, there are other scenarios which require unique answers, or unique ratings. In these cases we would like to prevent users from giving the same rating to several answers.
The problem is that SharePoint does not support that, so you cannot enforce unique ratings in Rating-scale questions.
 
To answer this business challenge, we at KWizCom have added a feature to KWizCom’s Survey Plus web part, which enables enforcing unique answers in rating-scale questions.
When using this new feature, end-users will not be able to provide the same rating for different options; when an end-user rates an option in the rating-scale question, this rating becomes disabled (grayed) for all other options as you can see in the following screenshot:
 
 
 
 
So, as you can see in this example, after a user rated "Cooking class" as 5 he can rate other options between 1 and 4, but not 5.
You can check-out this new feature by downloading a trail version of the Survey Plus web part, please feel free to give us your feedback!
 
 
 
 

Friday, August 2, 2013

IE10 error on SharePoint 2013 sites “The system cannot find the path specified.”

After upgrading the IE browser to IE10, all SharePoint 2013 sites stopped working.

The /_layouts/15/start.aspx page was stuck on “working on it” forever, with a javascript error:

image

Almost every page in SharePoint threw this error. In Chrome and FireFox by the way – it worked perfectly.

A bit of JavaScript debugging revealed that SharePoint is trying to use window.localStorage object, which was the root cause for this error.

While I couldn’t figure out why or how to fix it – I found a simple workaround: disable the IE10 local storage feature (which I believe is a part of the HTML5).

Simply go to internet options –> advanced, scroll down to “Enable DOM Storage” and uncheck it’s checkbox:

image

And all done – SharePoint works again, even MDS (or partial page rendering which is how I call it) works!

SharePoint 2013 Error 401 Unauthorized on /_layouts/15/start.aspx

I encountered this error today, along with a log message in the ULS saying: cannot find site lookup info for request uri

When browsing directly to the site home page or any other page it worked perfectly. Just this page /_layouts/15/start.aspx returned access denied error.

I googled googled, and even binged but could not find a solution.

Until it occurred to me – alternate access mappings!!!

It appears I didn’t set the site URL as an alternate access mapping for this web application.

A quick trip to central administration fixed that:

Client on “Configure alternate access mappings”:

image_thumb3

Change to your web application:

image_thumb5

Click “Edit Public URLs”

image_thumb7

And add your new header in any of the text boxes:

image_thumb9

done! now it is working as expected.

Tuesday, July 30, 2013

New to SharePoint?

Want to learn about SharePoint, application development and solutions using this amazing platform?

I always run into people in the IT business who heard about SharePoint but want to know what it’s all about.

I used to answer in emails or private messages but decided it might be a good idea to share some good links to good online learning materials for the autodidacts among us.

Enjoy, and feel free to share and add more in comments!

(Links to other non related sites in comments will not be approved. Links to commercial sites won’t be approved either.)

My favorite, Microsoft’s Channel 9:

http://channel9.msdn.com/Tags/sharepoint

Super quick start on your own development environment, use cloudshare. You get 30 days free trial, and they have lots of templates to start from (incl. SharePoint 2007, 2010 and 2013)

http://www.cloudshare.com

And, if you have the hardware and just want a SharePoint virtual machine image to play with – you can download and install one from here, but you will have to install and configure your dev environment yourself:

http://technet.microsoft.com/en-us/evalcenter/hh973397.aspx

* This product key is good for 180 days, I suggest you take a snapshot of the virtual machine before you activate it to make sure you can restart your trial period. Obviously, this is great for dev but can’t be used for production as you need to revert and reactivate every 180 days.

There used to be a demo Hyper-V machine preinstalled and available from Microsoft.com, but it appears they have removed the link. I will post as soon as I find it.

Of course, you can also enjoy SharePoint online as a part of Office 365. This will allow you to use SharePoint, perhaps deploy some apps on it – but won’t allow you to develop on it (no full trust solutions and not even apps).

There is a developer version of this which allows you to use “Napa” in order to build SharePoint 2013 apps, and you can open your trial account here:

http://msdn.microsoft.com/en-us/library/fp179924.aspx

Depending on your relationship with Microsoft you can get anywhere from 30 days trial up to 1 year of free subscription. All information is at the abovementioned link.

I will post more info as I get it, please feel free to add stuff in the comments.

 

Good luck!

Tuesday, May 14, 2013

One solution to rule them all

My prezi is ready for SharePoint Saturday LA!
This session will be heavy on the visual studio live demo, hope that part goes well :)
But for the first part of the talk I thought I could use prezi to explain the challenge in building a solution that can be deployed on both SharePoint 2010 and 2013, without doubling the R&D efforts, QA efforts and overall maintenance.
We had a very long discussion about this in house, and we are still not entirely convinced this is the best solution to this problem, but it is the best we’ve got so far.
In the past we used to have 2 different solutions for each version of the product. This forced us to constantly sync code between the two versions, having to fix and retest every issue on both versions, which of course wasn’t done perfectly so we ended up with bugs that were fixed in one version only, features that were missing from the other version and basically it was very hard to maintain them.
Now, with the introduction of versioned root folders in SharePoint 2013 this have become a bit more challenging since the code would be different and target different folders in 2010 and 2013. While in server code its rather simple to test the version and use the right path, doing it in config xml files (like web part gallery icon, feature icon for example) is not something we can change in runtime.
This is why we came up with a set of tools that allows us to keep working on one solution, and producing 2 packages from the same source code in one build. One for SharePoint 2010 and the other for SharePoint 2013.
It didn’t take a long time before we then learned about the challenges in trying to debug this code on the SharePoint 2013 machine. Since it wasn’t build on that machine, and didn’t target the .NET framework 4 – this proved to be a bit more complex than what we expected.
To find out more on how we got everything working – come see my session!

Please feel free to leave a comment here if you want more info, or if you been to my session and would like me to add or change something.
Code sample:
http://sdrv.ms/14kRdt3

More info on deferred site collection upgrade:
http://kwizcom.blogspot.ca/2014/03/sharepoint-2010-deferred-site.html

Since I get asked a lot during this session, "are FTC solutions dead?"
Here is a short presentation with points to consider:


Wednesday, March 13, 2013

VS build error 438

 

here is something you don’t see every day…

“There is not enough space on the disk.” Smile

image

I wonder why I’m getting this error… I have a full 37.5 MB of free space!

image

LOL (time to increase the disk size for the VM I guess…)

Thursday, March 7, 2013

SharePoint 2007 language packs with SP3

Quick reference if anyone needs it…

Took me a while to find the links

WSS:

KB - http://support.microsoft.com/kb/2526305

Download - http://www.microsoft.com/en-us/download/details.aspx?id=27809

MOSS:

KB - http://support.microsoft.com/kb/2526299

Download - http://www.microsoft.com/en-us/download/details.aspx?id=27827

Upgrading SharePoint 2010 VS2010 solution to VS2012

Hey,

I *was* going to write a long post on how to upgrade a SharePoint 2010 project and solution from VS2010 to VS2012,

based on past experience, we all know upgrading visual studio was a bit of a pain…

Well, it turns out the guys at Microsoft did such a great job – I have nothing to write about!!!

You open your VS2010 solution in VS2012, it runs a short upgrade and shows you the results, and boom – you got yourself an upgraded solution, everything works beautifully – and the best part is: the upgraded solution works on both VS2010 and VS2012 with no problems!

After upgrading about 10 different solutions, I am confident to say I have nothing else to say.

So… It’s snowing outside… Nice… Ok, ok – its not that kind of a blog…

Coming up soon: Upgrading your full trust solutions to SP2013 – here I do have some insight!

Have a wonderful week!

Friday, January 18, 2013

Fixing JavaScript Intellisense completion

If you are doing a lot of JavaScript development, especially if you are doing SharePoint Apps development, you have come to love the great script IntelliSense feature in visual studio.

This gives you great auto-completion on client side objects and members and makes your development experience much better, especially if you are used to all this goodness from working with other rich languages like C#:

image

This auto-completion is easy to achieve, all you need to do is add a “_references.js” file and reference all script libraries in it:

image

Now, once you do some real JavaScripting – you will soon start working with prototypes, defining classes and instances and so on.

Once inside a method, you will notice that if you define a member inside the method it will keep the autocomplete working:

image

But once you start declaring and using class members, you will see a strange warning message and autocomplete will show you all known objects instead of just the relevant members for this variable type:

image

“IntelliSense was unable to determine an accurate completion list for this expression.
The provided list contains all identifiers in the file.”

The reason for that is, that if you define the variable member before this point, in the class level, and set it’s value later on in a constructor or other init method – Visual Studio does not know the type of object this variable is going to be set to, so it cannot build the correct auto-complete list.

The fix is simple, you can tell visual studio what type of variable you are creating by adding a ///<field> comment just above it’s definition:

image

And now, when we try to access this member again – auto-completion will work as expected:

image

The tricky part is finding out the exact type name for each variable. here are a few that I found, hope it would come in handy:

/// <field name="context" type="SP.ClientContext">Current client context</field>
/// <field name="web" type="SP.Web">Parent web hosting the app</field>
/// <field name="webInfo" type="SP.WebInformation">Parent web info hosting hte app</field>
/// <field name="lists" type="SP.ListCollection">current web lists</field>
/// <field name="list" type="SP.List">selected list (by _ListName)</field>
/// <field name="view" type="SP.View">selected view (by _ViewName)</field>
/// <field name="defaultView" type="SP.View">default list view</field>
/// <field name="query" type="SP.CamlQuery">caml query to run</field>
/// <field name="listItems" type="SP.ListItemCollection">result list item collection</field>
/// <field name="listItem" type="SP.ListItem">current list item</field>

if you want to find out the type name of other returned objects, you can alert() their “.constructor.getName()” value.

Have a wonderful scripting day!

Monday, January 14, 2013

Building list view SharePoint hosted app part

Building a SharePoint hosted app is a simple thing, thanks to Napa.

The whole thing can take less than a day (if you know you client side API) even, but filling those gaps that Napa does not cover can be a bit tricky, and remember: once you go visual studio, I can never go back!

So, I thought I would write about a few things I found Napa was missing and I had to spend some time trying to figure out how to make them work:

1. Set the app part gallery icon:


image

As much as I tried and wanted, it turns out changing the app part icon is not currently supported! Only Microsoft built-in app parts can have different icons for now. This comes directly from Microsoft, so I stopped researching this issue and gave up… Sad smile

2. Custom web part properties:


image

A vary basic need in deed, adding customizable parameters to app parts so that the user can configure it further. Apparently this was not supported in Napa, so I had to take my app to visual studio to add them.

Adding parameters is not very difficult, and since you app part is running in an iframe, all parameters will eventually be sent to your app part as query string parameters.

In order to add the parameters to the tool part, all you have to do is add them to the ClientWebPart elements file, like so:

<Elements>
    <ClientWebPart ….>
        <Content … />
        <Properties>
            <Property Name=”PropName” Type=”string” WebBrowsable=”true” WebDisplayName=”Prop Name” WebDescription=”Property description (tooltip)” WebCategory="Prop Category" DefaultValue="" RequiresDesignerPermission="true" />
       <Properties>
    </ClientWebPart>
</Elements>

Property “Type” can be string, enum, int or boolean.
For enum types a dropdown will be rendered. You can add the available options inline in the XML like so:


<Property …>
    <EnumItems>
        <EnumItem Value=”Val1” WebDisplayName=”Value 1” />
        <EnumItem Value=”Val2” WebDisplayName=”Value 2” />
        <EnumItem Value=”Val3” WebDisplayName=”Value 3” />
    </EnumItems>
</Property>

3. Accessing information from the current site, and not from the app sub site

You may know this already, but apps are deployed to their own sub site, that runs off a different web application than the site the app was deployed to.

Well, I wanted to display information from the user’s site, not from the app site. Which means I had to get the parent web in client object model to work on. not too difficult, but here is the code examples just for quick reference (if you have a better way of doing it – leave a comment I’d love to hear!):

First run this code:
this.context = new SP.ClientContext.get_current();
this.webInfo = this.context.get_web().get_parentWeb();//return SP.WebInformation not SP.Web
this.context.load(this.webInfo);
this.context.executeQueryAsync …

On load success, run this code:
this.web = this.context.get_site().openWebById(this.webInfo.get_id());
this.lists = this.web.get_lists();

then you can start using this.web to get the parent web and get information from it’s lists.

4. Auto-complete for SharePoint objects stops working for members

One last annoying thing I learned: although in most cases visual studio can auto-complete members and functions for javascript types, when I set the object to a member in javascript (this.web = xxx) and try to use it later in a different function it loses the auto-complete for this object.

This was rather simple to fix, when defining the member in my javascript class I had to add an attribute to it defining its expected type:

/// <field name="webInfo" type="SP.WebInformation">Parent web info hosting hte app</field>
webInfo: null,

This seemed to do the trick.

I’ll post back once I have more tips,

Shai.

Speaking Engagements 2013

My 2013 speaking engagements are posted below,
If you are around – come see me!
If you were in one of my sessions, you can find links to the session code and presentation below. Also – if you have any comments on my session – feel free to post it here!

February 20 2013Toronto SharePoint User Group – How-to: SharePoint hosted list viewer app part (Had a baby girl! Bill covered this meeting. I will reschedule, sorry!)

April 18 2013Hamilton SharePoint User Group - Developer's Guide: How to enhance your SharePoint performance - Understand Caching

May 18 2013 – SharePoint Saturday LA - One Solution to rule them all: One SharePoint Solution for both 2010/2013 & All about the SharePoint ribbon for developers

June 19 2013Toronto SharePoint User Group - One Solution to rule them all: One SharePoint Solution for both 2010/2013

July 20 2013 – SPS Toronto - Developer's Guide: How to enhance your SharePoint performance - Understand Caching

October 16 2013NYC SharePoint Developers User Group - One Solution to rule them all: One SharePoint Solution for both 2010/2013

My 2012 speaking engagements can be found here.