Thursday, November 22, 2012

Building apps in visual studio with TFS gives a build error


Something I came across and didn’t find any documentation for,

I started a Napa SharerPoint Office 365 app, and later on exported it to visual studio to get access to some more features that Napa does not provide.

Once I checked in all my code to TFS I started getting errors during deploy:

Access to the path ‘…..\pkgobj\Release\AppManifest.xml’ is denied.


Access to the path ‘…..\pkgobj\Debug\AppManifest.xml’ is denied.

well, looking at the file it seems every time the package was built – this file was marked as read only.

I tried to unmark it but again, after every build it was marked as read only.

this let me to believe that the file is being copied as-is from the project into the package folder, which means that if it is read only in the project – it will be read only in the package!

Now, I guess this specific file has some tokens that needs to be replaced during the packaging, so when visual studio tries to edit this file it gets the access denied error above.

The fix was simple: check out this file in the main project, and delete it from the pkgobj folder. this would make sure the file is not marked as read only when being copied and will allow visual studio to edit it while building the package.

A bug, hopefully that will be fixed soon (I reported it to MSFT).


Tuesday, October 16, 2012

Control the way your site looks in Windows 8 Metro

I just stumbled upon this cool site,

It allows you to control the tile created in windows 8 metro UI for your web site when a user pin it to start menu.

Here is KWizCom site before:


and here is after:


Now, I know I am no design genius, but still – much better, no?

All you need to do is upload a 114x114 image, and add this code to your home page HTML, right inside your <head> tag:

<meta name="application-name" content="KWizCom Corp"/>
<meta name="msapplication-TileColor" content="#ffffff"/>
<meta name="msapplication-TileImage" content="002a8685-b8ff-4a45-8922-fcb0966fcb43.png"/>

I wish we could add a parameter for search, to have a text box inside, or maybe some more functionality, but right now we can control the background color, image and caption.

Tuesday, October 2, 2012

Traps in SharePoint 2013 API

So, SharePoint 2013 has almost full API backward compatibility? Sure. That’s great!

I mean, Microsoft did a great job making our lives easy in upgrades.

But I did find some traps while upgrading to 2013 I want to share with your guys,

I am sure these things won’t be documented anywhere – which is why I call them “traps”…

I’ll try to collect more info and add it here as I move forward.

Note: these issues are found on a pre release version and might change before production is released.

Trap #1:

We run a query on tasks list, using the default all tasks view from that list. Thing is, we got “Object not set to an instance” error coming from our query parser.

Digging in code, I found SPListView.Query used to be an empty string in 2007/2010. In some lists in 2013 this changed to null now… So, any code using or parsing the query should now check if the view query is null before accessing it, like so:

string query = listview.Query ?? “”; //Takes listview.Query if not null, otherwise takes empty string.
… work and parse query as you would before

Trap #2:

We had some code that allows the user to select a list template and aggregate all items from that list type (in our list aggregator web part). So, I set it up to run on tasks lists, after fixing Trap #1, there was no error but still no items were returned.

Reason: I added a tasks “App” in 2013, which I assumed was the same as a tasks list. but to my surprise, tasks list type is 107, while the tasks App creates a list that uses type 151 (TasksWithTimelineAndHierarchy)

In our code, I collected all available list templates on the current site, but I had a code that prevented duplicate items from being added. I checked the SPListTemplate.Name and only added the first.

It appears, that in SharePoint 2013, both list types (107 and 151) have the same name “Tasks”! So, my code was only adding the first one, 107.

I had to modify my code to take the SPListTemplate.Type.ToString() in case of a duplicate entry, which seems to do the trick, Only added a space before every capital letter so it would be formatted nicer for the user.


Comment if you found more interesting upgrade traps!

Wednesday, July 18, 2012

i luv my prezi!

Just found this amazing presentation engine, free to use, build and present online and offline decks.

Thanks to my wife for this amazing catch! Spend some time converting one of my existing decks from power point to their engine,

Unfortunately I had to rebuild it from scratch – but it didn’t take long.

Here is my new deck for SharePoint ribbon development (keep in mind – it’s a work in progress, original deck is still here

Tell me what you think, isn’t it awesome?

One comment I already got is “Where is KWizCom logo”? :) Will be fixed shortly…

What is missing?

- the ability to embed files into it (like source code examples in ZIP)
- set colors for boxes… strange, but I couldn’t figure out how to do it.

Monday, June 11, 2012

Setting an optional parameter in workflow activity

Just a little something I encountered today, been working on some new custom actions for SharePoint Designer workflow editor.

I wanted to add an action that converts a file to a PDF and stores it somewhere on the server.

Everything was going smooth, except for 1 thing: the target PDF file name parameter – I wanted this parameter to be optional, so that people can either calculate a value for it or leave it empty. Once empty – it would keep the source file name, or will take the list item title as the new file name.

So, looks like marking a workflow activity parameter as optional is not a simple task as I thought it would be.

It starts by changing the attribute on the property in the Activity class:

   1: [Description("Target Filename")]
   2: [Browsable(true)]
   3: [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
   4: [ValidationOption(ValidationOption.Optional)]
   5: public string TargetFilename
   6: {
   7:     get { return ((string)(base.GetValue(TargetFilenameProperty))); }
   8:     set { base.SetValue(TargetFilenameProperty, value); }
   9: }

I had to change the “ValidationOption” from required to optional. First, I tried using “None” but it seemed not to work.

Once I’ve done that, I thought I was done. But still – SharePoint Designer didn’t accept my workflow and prompted for a value.

So, after some more reading and help from Kevin Vieira, he thought we should try and change the direction property on the parameter definition in the actions xml file:

   1: <Parameters>
   2:     <Parameter Name="TargetFilename" Type="System.String, mscorlib" Direction="Optional" />
   3: </Parameters>

Although in several places in MSDN I found that the parameter direction can only be In or Out, Kevin found one page that said “Optional” was also supported. Of course with no other explanation or documentation regarding what is optional and when to use it.

So, marking it as optional saved the day!

Oh, another very important note for those of you writing custom actions/activities and working with SharePoint Designer:

On almost any change you make, you have to clear SharePoint Designer cache before your changes take effect.

Kevin found a nice blog post by Matthew Workman about that as well explaining which folders to clear (this is how I like them – like a mini skirt: short enough to keep it interesting - long enough to cover the story):

“cd "%APPDATA%\Microsoft\Web Server Extensions\Cache"
del *.web /S /Q "%APPDATA%\Microsoft\Web Server Extensions\Cache"
cd "%USERPROFILE%\AppData\Local\Microsoft\WebsiteCache\"
rmdir /S /Q "%USERPROFILE%\AppData\Local\Microsoft\WebsiteCache\."
mkdir "%USERPROFILE%\AppData\Local\Microsoft\WebsiteCache"
dir "%APPDATA%\Microsoft\Web Server Extensions\Cache"
dir "%USERPROFILE%\AppData\Local\Microsoft\WebsiteCache"pause”


Wednesday, March 7, 2012

Datasheet view alternatives

Ok, this is really long overdue…

Ever since Microsoft introduced the datasheet view for editing lists in SharePoint I’ve had mixed emotions about it.

Although datasheet is a great editing tool for SharePoint lists that allows you to quickly edit and update multiple items in an excel-like experience – it has been a challenge getting it to work.

One customer of mine used a proxy server internally to direct traffic into his SharePoint, which made the datasheet view unavailable.

Another customer had deployed office 2010 64 bit on his users computers. Apparently datasheet view does not support office 2010 64bit:

Some other customers complaining that they cannot use FireFox or Chrome with datasheet view, or any OS that does not have office installed.

And finally, datasheet view does not support custom field types – they appear as read only. Actually, even standard OOB fields use a different editing control inside the datasheet view, causing an inconsistent editing experience to the user.

This have been bothering me for a long while, and finally with the help of my friend Igor Goldshtaub we came up with an idea that will allow you to:

  1. Edit multiple list items (bulk edit)
  2. Enjoy fast inline editing in list views on all major browsers
  3. Inline edit custom field types as well as OOB field types
  4. Have a consistent user experience, using the same editing controls as used in the actual “edit” item form
  5. Paste information from excel into a list

The best part is, it potentially supports any 3rd party custom field type, from any other vendor or even ones you develop yourself. Most field types just work, others may need to call a JavaScript method when the content is resized (picker is opened, for example) “OnClientResponseEnded();”

Inline editing demo:

Paste from excel demo:

I’d love to hear what you think about this solution, and if you run into trouble using a custom field type – please let me know! My goal is to be able to support all custom field types in this inline editing platform!

Finally, we have an answer for editing custom field types in datasheet view. It’s not datasheet, but it comes close!

Cheers, Shai.

Tuesday, February 14, 2012

Cache explained - the milk story


I came up with this little story when trying to explain what is caching, how to plan for caching and how to use it. Like many things in software, caching is something we use very widely in our day to day life without even knowing about it. Hopefully this example will give you a different, easier to understand point of view on caching that will help you get your head around it.

The milk story

No cache

Caching is like drinking milk.

When you want to drink milk you have to go to the store and buy it.

You can walk (56k modem) ride your bike (3G) or drive there in your corvette (high speed Internet).

You have to identify yourself, find and get the milk you want, check its expiration and pay for it. Since there are many things at the store it takes more time to find your milk.

Then you have to fight traffic back home. Pour the milk into a glass and drink it.

Caching options

Now, how do we make it better?

We notice that the store keeps the same milk for 10 days.

So, we can buy 10 days worth of milk ahead. We calculate our milk usage to be 0.5 liter a day, do we need 5 liters.

Wow - this is when we discover bulk discounts!

But - then we discover we need to store it all in the fridge. This type of storage is very expensive since it has many uses and is limited.

So we compromise and fetch only 2 liters at a time, knowing we will be back at the store once every 4 days.

Now, we notice we go to the store to get cookies with our milk. So when we go in for milk we use that same opportunity to get cookies as well.

Now every time we want milk we need to check our fridge first. If there is milk we can use it and we saved a lot of time and resources!

But, if there is no milk we have to go and get it. In the case we added some overhead by checking the fridge first...

Now, milk is known to go bad from time to time. So we have to check its expiration. If the milk gone bad we have to throw it.

That's another overhead every time we want milk.


Milk is your data.

The store is your data base.

Your fridge is your quick accessible cache storage.

Throwing out bad milk is flushing the cache when invalidated.

Cache is life ( ok, I went too far… ).

We use caching techniques every day!

Microsoft Canada - Imagine Cup

Are you ready to change the world?

All it takes is one good idea. Imagine Cup, one of the premiere worldwide technology competitions, is looking for students, to help solve some of the world’s toughest problems through technology.

This year, Microsoft will be hosting a Canadian Imagine Cup competition with two categories: Software Design and Windows Phone 7 Game Design. You could win a trip to Toronto for the Canadian Finals, a trip to Australia for the Worldwide Finals, international acclaim and cash grants. What are you waiting for? Get involved »

Wednesday, January 4, 2012

Speaking Engagements 2012

My 2012 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!

January 7 2012SPS Virginia Beach – Session unknown… – Cancelled due to other obligations. Sorry I couldn’t make it!

January 18 2012Toronto SharePoint User Group - Developer’s guide: how to enhance your SP performance: Understanding caching

May 16 2012Toronto SharePoint Summit- Developer’s guide: how to enhance your SP performance: Understanding caching

July 7 2012SPS TorontoAll about the SharePoint Ribbon for developers

September 22 2012SPS NHAll about the SharePoint Ribbon for developers

November 3 2012SPS Twin CitiesDeveloper’s guide: how to enhance your SP performance: Understanding caching


My 2011 speaking engagements can be found here.