tag:blogger.com,1999:blog-31200415749779535732024-03-21T02:23:42.652+00:00What's the SharePointStuff and nonsense from developing solutions for SharePointStephen Brownhttp://www.blogger.com/profile/03547644424344780488noreply@blogger.comBlogger39125tag:blogger.com,1999:blog-3120041574977953573.post-12554574399513937882015-02-11T09:37:00.004+00:002015-02-11T09:37:59.314+00:00SharePoint 2013 Search Configuration for TitleIf you have had to configure Search in SharePoint 2013, you will know that, post-October 2013 CU, there is a new property included in the Title managed property called MetadataExtractorTitle. This is an intelligent crawled property which is used to determine the title of a document (primarily) based on the document structure...not the actual metadata someone might attach to the document through SharePoint.<br />
<br />
However, if you should need to return the actual metadata value for Title entered by a user, and not what SharePoint thinks the Title is, then the configuration of this is not intuitive by any stretch of the imagination. Personally, I spent the best part of a few days looking at the configuration and it was only with the assistance of colleague and his contact within Microsoft that the problem was resolved.<br />
<br />
The thing with the Title managed property is that it uses a weighting factor to determine which crawled property to use. Each crawled property within the managed property has it's only "weighting factor" and it's only the combination of this weighting factor combined with where it appears in the order which determines which crawled property is returned by Search for the Title value - it's basically some kind of complex algorithm to determine which property to use. <br />
<br />
I can only thank my colleague Amar for his immense knowledge and his extremely useful contact within Microsoft for this ordering. I've not seen anything on the web as yet which shows this, so I'm hoping that this will prove useful to not just myself, but to many others.<br />
<br />
Here's the order that worked for us (and it has to be this ordering). Note that MetadataExtractorTitle is pushed right to the bottom - this has to happen, otherwise it nearly always gets used due to it's weighting:<br />
<br />
<span style="font-family: inherit;">TermTitle<o:p></o:p></span><br />
<span style="font-family: inherit;">
Office:2<o:p></o:p></span><br />
<span style="font-family: inherit;">
ows_BaseName<o:p></o:p></span><br />
<span style="font-family: inherit;">
Title<o:p></o:p></span><br />
<span style="font-family: inherit;">
MailSubject<o:p></o:p></span><br />
<span style="font-family: inherit;">
Mail:5<o:p></o:p></span><br />
<span style="font-family: inherit;">
People:PreferredName<o:p></o:p></span><br />
<span style="font-family: inherit;">
Basic:displaytitle<o:p></o:p></span><br />
<span style="font-family: inherit;">
ows_Title<o:p></o:p></span><br />
<span style="font-family: inherit;">
Basic:10<o:p></o:p></span><br />
<span style="font-family: inherit;">
Basic:9<o:p></o:p></span><br />
<span style="font-family: inherit;">
MetadataExtractorTitle<o:p></o:p></span><br />
<span style="font-family: inherit;">
</span><br />
This returned the Title metadata property (not the one determined from the document structure) as well as working correctly for other items returned by Search.<br />
Stephen Brownhttp://www.blogger.com/profile/03547644424344780488noreply@blogger.com10tag:blogger.com,1999:blog-3120041574977953573.post-41455723576350794032014-07-01T08:11:00.003+01:002014-07-01T08:11:42.375+01:00_spPageContextInfo in SharePoint 2010/2013I've used _spPageContextInfo several times over the last couple of years and never thought to blog it myself. Someone finally had some common sense and decided to put fingers to keyboard and write-up some of the useful properties available on every SharePoint page via this useful JavaScript object. Here's the link from Sahil Malik: <a href="http://blah.winsmarts.com/2013-2-_sppagecontextinfo_is_your_new_best_friend.aspx">http://blah.winsmarts.com/2013-2-_sppagecontextinfo_is_your_new_best_friend.aspx</a>Stephen Brownhttp://www.blogger.com/profile/03547644424344780488noreply@blogger.com0tag:blogger.com,1999:blog-3120041574977953573.post-25677500363684658542014-02-12T13:03:00.001+00:002014-02-12T13:03:09.115+00:00DateTime fields in custom Page LayoutsThis was an interesting problem I came across with SP2013 for which, unfortunately, there doesn't appear to be any real resolution. So, the scenario is this: you develop a custom Page Layout and set up your content types and columns to use within that Page Layout and decide you need a date/time field in the metadata you'll collect.<br />
<br />
You promptly add the DateTime field to your custom Page Layout to capture the information and everything appears to be working fine. However, if you attempt to Save the page using the normal ribbon Save button you get a "save conflict" error, despite no-one else editing the page (and in my case, no-one else using the system at that time). I tested this in both SharePoint on-premise and Office365 - and both tests showed the same problem.<br />
<br />
After some investigation (many hours of it actually) I found one other lonely developer who had experienced a <a href="http://partnersupport.microsoft.com/en-us/mpnprodcomm/forum/mpnpcoff-mpnsharepoint/using-datetime-fields-in-page-layouts-causes-save/46be6132-8f04-434e-93b4-53db703b07f1?tm=1388655933393" rel="nofollow" target="_blank">similar problem</a> and suggested using the <em>alternate</em> Save button which, in SP2013, appears between the ribbon and the Suite Bar on the right-hand side (if you're using a right-to-left reading culture). This little Save button only appears once you're in Edit mode. Well, I tried it and surprisingly it worked - no "Save Conflict". I say "surprisingly" as I would have thought these 2 save buttons would share the same common "save" functionality, but apparently that is not the case at all. It is a work-around, but not exactly very workable as it means users having to understand when to use that button and when not to, and knowing either not to use the "other" ribbon Save button in certain circumstances or to never use it at all. Rubbish.<br />
<br />
There is also a second/third work-around which may or may not be useful, which is to use the "Check-in" option or do a straight "Publish" (if content approval is set up): both not necessarily ideal, but do get around the issue.<br />
<br />
Following several questions put up on the Microsoft partner forums, the MS engineer I was discussing the issue with admitted that there <em>did </em>appear to be an issue which I was very happy about at the time as it mean that I hadn't done something stupid in the Page Layout. <br />
<br />
So, I thought I would post this here in case someone else experiences the same problem and if you do, you can at least have some comfort in the fact that it's not entirely your fault!Stephen Brownhttp://www.blogger.com/profile/03547644424344780488noreply@blogger.com0tag:blogger.com,1999:blog-3120041574977953573.post-71771594688624761962013-08-02T11:14:00.001+01:002013-08-02T11:14:20.213+01:00SharePoint 2013 and the Noteworthy section<span id="ms-rterangecursor-start"></span><span style="font-family: Arial, Helvetica, sans-serif;">If you have added an App to a
SharePoint 2013 site you will have seen the "Noteworthy" section which lists what
appears to be favourites or well used items. These Apps are by default Custom
List, Document Library and Tasks but additional Apps can be included which are
administered via the App settings in Central Administration. SharePoint Apps are added into a normal SharePoint list and simply ticking the
"Featured" property of the corresponding list item means it appears in the "Noteworthy" section
(see </span><a href="http://office.microsoft.com/en-gb/sharepoint-help/use-the-app-catalog-to-make-custom-business-apps-available-for-your-sharepoint-online-environment-HA102772362.aspx"><span style="font-family: Arial, Helvetica, sans-serif;">http://office.microsoft.com/en-gb/sharepoint-help/use-the-app-catalog-to-make-custom-business-apps-available-for-your-sharepoint-online-environment-HA102772362.aspx</span></a><span style="font-family: Arial, Helvetica, sans-serif;">).</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">
</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">However, if you think you can add something useful like a List Template
- perhaps one created by your Users who do not want to page through <em>all
</em>the available Apps in your farm - then you will be mistaken (unless someone knows better, which is very possible!). </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">After
doing some research, it does <em>not</em> appear to be possible to use a List Template in
the "Noteworthy" section through the normal SharePoint UI and approaches open to normal users as it appears that this section is reserved for "real" Apps
and not list templates and the like - therefore to appear in here it
<em>has</em> to be an App (I'm willing to be challenged on this point, but I
could not see a way to include a List Template in the "Noteworthy" section).</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">
</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">However, after doing some digging, it does appear to be possible to include an
item like a List Template under the "Noteworthy" section but only by deploying some customisation which
is not always a good thing. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">
</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">The page you navigate to when you want to add an App (AddAnApp.aspx) is generated mainly from JavaScript which
makes several calls back into itself to get JSON in order to generate the Apps UI.
There are various JavaScript objects created in the page, most notably the "SP.Storefront" object which houses all of the App
store front information.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">
</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">To add an item to Noteworthy is simple enough once you get passed the
obfuscation of objects and methods. The SP.Storefront contains a StorefrontApp object which itself contains a method "get_currentView()". This method gives me the Management View of the App store front. This is the object that contains
all the view information - what Apps are listed, categories and so on. One of
the properties of the Management View is $L_3 which is an array containing all
the available Apps while the property $2i_3 is another array containing only the
"Noteworthy" items.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">
</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Both of these arrays, $L_3 and £2i_3, contain a number of SPAppMetadata objects which themselves contain a
property $2Q_0. $2Q_0 gives us access to the JSON returned from AddAnApp.aspx
for this particular App, so therefore includes more readable properties like ID,
Title, Language and so on. These can be used to identify the App you want to
promote into the Noteworthy section, and once identified it's simply a case of
adding the item from the $L_3 array into the $2i_3 array.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">
</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Of course, that's not the end of the story, adding the object into the array
simply means the data is now available, but the UI doesn't update. To force the
UI to catch up, you need to also make a call to SP.Storefront.StorefrontApp.get_currentView().updateUI() and the animation you normally see runs
making your new Noteworthy App available.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">
</span><br />
<span style="font-family: Arial;">The obvious question is "how do I get the custom JavaScript into the page?". Well, t</span><span style="font-family: Arial, Helvetica, sans-serif;">he AddAnApp.aspx page uses minimal.master. Therefore, it's possible that you could add in a delegate control
to run some JavaScript in order to update the UI - probably coding it to be
specific to the AddAnApp.aspx page rather than running on every page. You may
also be able to use something like a Custom Action using the location of ScriptLink as in SharePoint 2010.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">
</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Hope this helps someone out there save some time as it took me a while to work it all
out! There are always better ways to do these things, so if you feel you want to you can let me know if you found another way that works as well.</span>Stephen Brownhttp://www.blogger.com/profile/03547644424344780488noreply@blogger.com3tag:blogger.com,1999:blog-3120041574977953573.post-1618978683828234522013-06-24T12:34:00.005+01:002013-06-24T12:34:48.046+01:00Public-facing Websites in Office 356<span id="ms-rterangecursor-start"></span><span id="ms-rterangepaste-start">In my research/learning of Office 365, I came across this great article outlining the features available/unavailable in Office 365 when you
create a public-facing website. Covers most of what I had already experienced
myself and some things I hadn't, so it's a nice guide to read through:</span><br />
<br />
<a href="http://techblurt.com/2013/05/09/creating-a-public-facing-website-on-office-365-part-1/">http://techblurt.com/2013/05/09/creating-a-public-facing-website-on-office-365-part-1/</a><span id="ms-rterangepaste-end"></span><br />
<br />
Of note are some of the "hidden" bits and pieces which still appear to be
available - although I'm not sure where this places a site from a support
perspective if you do alter some of these "hidden" settings.<span id="ms-rterangecursor-end"></span>Stephen Brownhttp://www.blogger.com/profile/03547644424344780488noreply@blogger.com1tag:blogger.com,1999:blog-3120041574977953573.post-92130272078098311132013-06-20T11:06:00.002+01:002013-06-20T11:06:34.812+01:00Setting up SharePoint 2013 Apps<span style="font-family: Arial, Helvetica, sans-serif;">What a pain.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">After spending almost a day configuring an environment to make SharePoint 2013 Apps work, I can only say that this is a painful process, but one that most developers will have to go through if they want to control an environment they wish to develop against.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">I decided that I would plot my steps through this process to help someone else through the same journey, at least it's a map of URLs I visited and information I gathered while on my way through. Hopefully, it will be useful...but if you have problems after reading and trying everything, don't ask me: I wouldn't consider myself an expert in configuring these things. I get what I need done and working, then leave well alone so I can concentrate on using and developing against the product!</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">So here we go.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">First of all I was starting with an OOTB SharePoint 2013 single-server installation - no tweaks, no customisations. The server had Active Directory and Domain Name Server roles set up on it. The server itself was running on my desktop as a HyperV with Window 2008 R2, and had 8GB of memory allocated to it (half the recommended settings of 16GB which, as you will see, did play a role in some of my problems).</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"></span><br />
<strong><span style="font-family: Arial, Helvetica, sans-serif;">Stage 1: Getting started</span></strong><br />
<span style="font-family: Arial, Helvetica, sans-serif;"></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Start: Set up the development environment for SharePoint 2013 - </span><a href="http://msdn.microsoft.com/en-us/library/ee554869.aspx"><span style="font-family: Arial, Helvetica, sans-serif;">http://msdn.microsoft.com/en-us/library/ee554869.aspx</span></a><br />
<span style="font-family: Arial, Helvetica, sans-serif;">How to: Set up an on-premises development environment for apps for SharePoint - </span><a href="http://msdn.microsoft.com/en-us/library/fp179923.aspx"><span style="font-family: Arial, Helvetica, sans-serif;">http://msdn.microsoft.com/en-us/library/fp179923.aspx</span></a><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Configure an environment for apps for SharePoint (SharePoint 2013) - </span><br />
<a href="http://technet.microsoft.com/en-us/library/fp161236.aspx"><span style="font-family: Arial, Helvetica, sans-serif;">http://technet.microsoft.com/en-us/library/fp161236.aspx</span></a><br />
<span style="font-family: Arial, Helvetica, sans-serif;"> </span><br />
<strong><span style="font-family: Arial, Helvetica, sans-serif;">Stage 2: Setting up Apps</span></strong><br />
<strong><span style="font-family: Arial, Helvetica, sans-serif;"></span></strong><br />
<span style="font-family: Arial, Helvetica, sans-serif;">At this point I thought that I was on the home straight - everything appeared to run fine with few issues. Running the PowerShell did throw up an error in the last command in the example (Set<span style="color: grey;">-</span>SPAppSiteSubscriptionName <span style="color: grey;">-</span>Name <span style="color: #a31515;">"app"</span> <span style="color: grey;">-</span>Confirm:<span style="color: orangered;">$false) <span style="color: black;">which I investigated and found the following article:</span></span></span><br />
<span style="color: orangered; font-family: Arial, Helvetica, sans-serif;"></span><br />
<span style="color: orangered;"></span><span style="font-family: Arial, Helvetica, sans-serif;">Creating SharePoint 2013 Apps – Set the App Domain - </span><a href="http://yalla.itgroove.net/2012/09/creating-sharepoint-2013-apps-set-the-app-domain/"><span style="font-family: Arial, Helvetica, sans-serif;">http://yalla.itgroove.net/2012/09/creating-sharepoint-2013-apps-set-the-app-domain/</span></a><br />
<span style="font-family: Arial, Helvetica, sans-serif;"></span><br />
<strong><span style="font-family: Arial, Helvetica, sans-serif;">Stage 3: Server Optimisation</span></strong><br />
<strong><span style="font-family: Arial, Helvetica, sans-serif;"></span></strong><br />
<span style="font-family: Arial, Helvetica, sans-serif;">The article seemed to indicate a memory issue so I then went down the road of optimizing my server, reducing the number of Service Applications that were necessary and applications running (I usually leave a PowerShell command window running, alongside Windows Explorer windows and IE, with Visual Studio, but I closed everything except my PowerShell window which I closed and re-opened to release any memory it may have been holding onto):</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Optimizing Server Configuration for Development Farm - </span><a href="http://www.spdeveloper.co.in/sharepoint2013/optimizing-the-configuration-of-development-farm.aspx"><span style="font-family: Arial, Helvetica, sans-serif;">http://www.spdeveloper.co.in/sharepoint2013/optimizing-the-configuration-of-development-farm.aspx</span></a><br />
<span style="font-family: Arial, Helvetica, sans-serif;"> </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Eventually, after shutting down all running applications and trying again, and still receiving the same error, I rebooted and tried again and I got the command to work. It was time to create my first SharePoint 2013 App.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"></span><br />
<strong><span style="font-family: Arial, Helvetica, sans-serif;">Stage 4: My First SharePoint 2013 App (Part 1)</span></strong><br />
<strong><span style="font-family: Arial, Helvetica, sans-serif;"></span></strong><br />
<span style="font-family: Arial, Helvetica, sans-serif;">How to: Create a basic SharePoint-hosted app - </span><a href="http://msdn.microsoft.com/en-us/library/fp142379.aspx"><span style="font-family: Arial, Helvetica, sans-serif;">http://msdn.microsoft.com/en-us/library/fp142379.aspx</span></a><br />
<span style="font-family: Arial, Helvetica, sans-serif;"></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">So, I followed the example in the article (at this point I hadn't read the comments) but had several issues trying to deploy the project which led me to look at the following pages - the most obvious was the fact that the System Account cannot deploy an App (?):</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Error Installing SharePoint 2013 App - </span><a href="http://social.msdn.microsoft.com/Forums/sharepoint/en-US/2bd11645-5ba2-40c5-8259-b0496b42d534/error-installing-sharepoint-2013-app"><span style="font-family: Arial, Helvetica, sans-serif;">http://social.msdn.microsoft.com/Forums/sharepoint/en-US/2bd11645-5ba2-40c5-8259-b0496b42d534/error-installing-sharepoint-2013-app</span></a><br />
<span style="font-family: Arial, Helvetica, sans-serif;">App deployment in SharePoint 2013 RTM - </span><a href="http://social.msdn.microsoft.com/Forums/sharepoint/en-US/9988a434-2787-4315-aeea-9f1707fb5a0b/app-deployment-in-sharepoint-2013-rtm"><span style="font-family: Arial, Helvetica, sans-serif;">http://social.msdn.microsoft.com/Forums/sharepoint/en-US/9988a434-2787-4315-aeea-9f1707fb5a0b/app-deployment-in-sharepoint-2013-rtm</span></a><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Error occurred in deployment step 'Install app for SharePoint': The provided App differs from another App with the same version and product ID - </span><a href="http://social.msdn.microsoft.com/Forums/sharepoint/en-US/152f3e26-fa84-49d9-a43c-6d339cddc435/error-occurred-in-deployment-step-install-app-for-sharepoint-the-provided-app-differs-from"><span style="font-family: Arial, Helvetica, sans-serif;">http://social.msdn.microsoft.com/Forums/sharepoint/en-US/152f3e26-fa84-49d9-a43c-6d339cddc435/error-occurred-in-deployment-step-install-app-for-sharepoint-the-provided-app-differs-from</span></a><br />
<span style="font-family: Arial, Helvetica, sans-serif;"> </span><br />
<strong><span style="font-family: Arial, Helvetica, sans-serif;">Stage 5: Memory</span></strong><br />
<strong><span style="font-family: Arial, Helvetica, sans-serif;"></span></strong><br />
<span style="font-family: Arial, Helvetica, sans-serif;">I had gone through everything but I was starting experience strange errors, which I considered unrelated to SharePoint specifically:</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Compiler Error CS1012 - </span><a href="http://msdn.microsoft.com/en-us/library/185szk2f(v=vs.80).aspx"><span style="font-family: Arial, Helvetica, sans-serif;">http://msdn.microsoft.com/en-us/library/185szk2f(v=vs.80).aspx</span></a><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Too many characters in character literal? - </span><a href="http://stackoverflow.com/questions/7912819/too-many-characters-in-character-literal"><span style="font-family: Arial, Helvetica, sans-serif;">http://stackoverflow.com/questions/7912819/too-many-characters-in-character-literal</span></a><br />
<span style="font-family: Arial, Helvetica, sans-serif;"></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Perhaps these too were memory errors, so I decided to run Visual Studio 2012 outside of my DEV HyperV server on my local machine instead, letting the server simply run SharePoint and nothing else.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"></span><br />
<strong><span style="font-family: Arial, Helvetica, sans-serif;">Stage 6: My First SharePoint 2013 App (Part 2)</span></strong><br />
<strong></strong><span style="font-family: Arial, Helvetica, sans-serif;"> </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">I copied my files across from the server and opened them in Visual Studio 2012 locally, setting up my site path etc correctly and hit F5. Errors again. But this time it appeared that there were issues with the Content Database as I was seeing "The content database on the server is temporarily unavailable" in the output window, even though I could hit the site fine.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">So that was my next trail to follow:</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Install of Apps from visual studio 2012 + The content database on the server is temporarily unavailable - </span><a href="http://social.msdn.microsoft.com/Forums/sharepoint/en-US/77fd536f-35e1-478a-ade0-d56ced8de102/insall-of-apps-from-visual-studio-2012-the-content-database-on-the-server-is-temporarily"><span style="font-family: Arial, Helvetica, sans-serif;">http://social.msdn.microsoft.com/Forums/sharepoint/en-US/77fd536f-35e1-478a-ade0-d56ced8de102/insall-of-apps-from-visual-studio-2012-the-content-database-on-the-server-is-temporarily</span></a><br />
<span style="font-family: Arial, Helvetica, sans-serif;"> </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">This led me to this SharePoint 2013 Configure Non-Farm User Account for App Development - </span><a href="http://community.zevenseas.com/Blogs/Akhilesh/Lists/Posts/Post.aspx?ID=10"><span style="font-family: Arial, Helvetica, sans-serif;">http://community.zevenseas.com/Blogs/Akhilesh/Lists/Posts/Post.aspx?ID=10</span></a><span style="font-family: Arial, Helvetica, sans-serif;"> which seemed to indicate that insufficient rights were granted to the account I was using. Despite using an account that was a Site Administrator on my DEV site, the account itself needed certain privileges granted in the Database. I tried this but it still did not work.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"> </span><br />
<strong><span style="font-family: Arial, Helvetica, sans-serif;">Stage 7: My First SharePoint 2013 App (Part 3)</span></strong><br />
<strong></strong><span style="font-family: Arial, Helvetica, sans-serif;"> </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Frustration set in.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"> </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">I then found this article from Microsoft which appears to accompany the March 2013 Cumulative Update: Enable apps in AAM or host-header environments for SharePoint 2013 - </span><a href="http://technet.microsoft.com/en-us/library/dn144963.aspx"><span style="font-family: Arial, Helvetica, sans-serif;">http://technet.microsoft.com/en-us/library/dn144963.aspx</span></a><span style="font-family: Arial, Helvetica, sans-serif;">. Some of the SQL User Mappings granted to the account I was using differ from the article from I found just before. So I updated SQL again.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"> </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Still not working. Taking a step back, I read an article about a similar problem which suggested the project had somehow become corrupted. I looked back through what I had done and realised that it was certainly a possibility, after all, I had copied it from a separate server and assumed it would work. So I deleted the project and retried it.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"></span><br />
<strong><span style="font-family: Arial, Helvetica, sans-serif;">Stage 8: My First SharePoint 2013 App (Part 4) - the Ecstasy</span></strong><br />
<strong><span style="font-family: Arial, Helvetica, sans-serif;"></span></strong><br />
<span style="font-family: Arial, Helvetica, sans-serif;">As you can guess from the title here, it was a moment of happiness that my App finally deployed. It was short-lived, I have admit, as the example in the Microsoft article (How to: Create a basic SharePoint-hosted app - </span><a href="http://msdn.microsoft.com/en-us/library/fp142379.aspx"><span style="font-family: Arial, Helvetica, sans-serif;">http://msdn.microsoft.com/en-us/library/fp142379.aspx</span></a><span style="font-family: Arial, Helvetica, sans-serif;">) didn't work. After I scrolled down through the comments of the article, some benevolent being had posted a working example of the JavaScript (App.js) which did sort things out fortunately. Why Microsoft would put up something so blatantly wrong I don't know, but at least the correct version accompanies it, even if it is in the comments (my advice here is always check the comments: my experience of Microsoft code examples is at about a 50% success rate). </span><br />
<span style="font-family: Arial;"></span><span style="font-family: Arial, Helvetica, sans-serif;"></span><br />
<strong><span style="font-family: Arial, Helvetica, sans-serif;">Final Thoughts</span></strong><br />
<span style="font-family: Arial, Helvetica, sans-serif;"></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Once things are done, it's done and you don't ever need to worry again...at least that's the theory. In short, memory did play a part in my problems, so even an 8GB HyperV server isn't quite up to the job of serving up SharePoint 2013 without error, which, in fairness to Microsoft, is lower than their recommended 16GB. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Hopefully, if you do encounter problems, some of the above will help. I've seen plenty of people on the 'net struggling with this configuration and I guess any advice or help is useful.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"></span>Stephen Brownhttp://www.blogger.com/profile/03547644424344780488noreply@blogger.com2tag:blogger.com,1999:blog-3120041574977953573.post-48852571801364437582013-06-19T11:14:00.002+01:002013-06-19T12:04:55.386+01:00Composed Looks in SP2013 and the SPCOLOR fileThe reason for this post is to explain some of the SPCOLOR attributes and their purpose - where they are used and what for. A colleague and myself put this together (so thanks to Olly for the majority of this work) and I'm sure some people may be able to add more details to some of the explanations below.<br />
<br />
While Composed Looks in SharePoint 2013 have opened up a whole new way to design SharePoint it comes with some serious limitations. Heather Solomon's blog on "<a href="http://blog.sharepointexperience.com/2013/05/when-to-use-a-sharepoint-2013-composed-look/" target="_blank">When to use a SharePoint 29013 Composed Look</a>" is an excellent starter to understand some of these limitations and explains things much better than I could. <br />
<br />
Microsoft have also put out some pretty decent articles on Composed Looks (<a href="http://msdn.microsoft.com/en-us/library/jj927175(v=office.15).aspx">http://msdn.microsoft.com/en-us/library/jj927175(v=office.15).aspx</a> is a good starting point) but the main article has one bit missing IMHO: there are no updates to the SPWeb Master Page properties (MasterUrl and CustomMasterUrl). <br />
<br />
So here is the file: please feel free to cut and paste into something more readable and use as a starting point for your own exploration.<br />
<br />
<?xml version="1.0" encoding="utf-8"?><br />
<s:colorPalette isInverted="false" previewSlot1="BackgroundOverlay" previewSlot2="BodyText" previewSlot3="AccentText" xmlns:s="<a href="http://schemas.microsoft.com/sharepoint/">http://schemas.microsoft.com/sharepoint/</a>"><br />
<!--========================================================================<br />
Notes<br />
============================================================================<br />
When setting colour codes, use HEX values. Opacity can be added on to these values. An example of this would be: E5FFFFFF.<br />
The first 2 ('E5'FFFFFF) characters of that code are the opacity, resulting in a transparent white.<br />
--><br />
<!--========================================================================<br />
Text Colour Styles<br />
=========================================================================--><br />
<s:color name="BodyText" value="444444" /> <!-- Normal body text. --><br />
<s:color name="SubtleBodyText" value="777777" /> <!-- Body text that must be lighter than normal. An example is metadata text. --><br />
<s:color name="StrongBodyText" value="262626" /> <!-- Body text color for text that must stand out from normal body text. --><br />
<s:color name="DisabledText" value="B1B1B1" /> <!-- Disabled text. For example, unavailable items in menus. --><br />
<s:color name="SiteTitle" value="262626" /> <!-- The text color of the page title. --><br />
<s:color name="WebPartHeading" value="444444" /> <!-- Text color for Web Part headings. --><br />
<s:color name="ErrorText" value="FF0000" /> <!-- The main error color that is used for error text, borders, and backgrounds, as needed. --><br />
<s:color name="AccentText" value="f44c0a" /> <!-- Text color for accented body text. --><br />
<s:color name="SearchURL" value="358700" /> <!-- Text color for the URL found in search results. Also used to highlight new items or successful status notifications. --><br />
<!--========================================================================<br />
Hyper Link Styles<br />
=========================================================================--><br />
<s:color name="Hyperlink" value="f44c0a" /> <!-- Text color for hyperlinks. --> <br />
<s:color name="Hyperlinkfollowed" value="4F6DBB" /> <!-- Text color for followed hyperlinks. --><br />
<s:color name="HyperlinkActive" value="1789C1" /> <!-- Hyperlink color when pressed. --><br />
<!--========================================================================<br />
Command Links<br />
=========================================================================--><br />
<s:color name="CommandLinks" value="666666" /> <!-- Large command links that must be a bit lighter than body text because of their size. --><br />
<s:color name="CommandLinksSecondary" value="262626" /> <!-- Command link color for links that are smaller, and therefore have a stronger color to stand out. --><br />
<s:color name="CommandLinksHover" value="f44c0a" /> <!-- Command link color on hover and color of "Add an App" and "New subsite" icons --><br />
<s:color name="CommandLinksPressed" value="1789C1" /> <!-- Command link color when pressed. --><br />
<s:color name="CommandLinksDisabled" value="B1B1B1" /> <!-- Command link color when command link is disabled. --><br />
<!--========================================================================<br />
Background Styles<br />
=========================================================================--><br />
<s:color name="BackgroundOverlay" value="E5FFFFFF" /> <!-- The main background color that is visible between the optional background image and the page content. --><br />
<s:color name="DisabledBackground" value="FDFDFD" /> <!-- Background for disabled elements such as browser controls, for example, input box or select box (except buttons). --><br />
<s:color name="PageBackground" value="FFFFFF" /> <!-- The background color of the page. Appears behind the optional background image. --><br />
<s:color name="HeaderBackground" value="D9F8F8F8" /> <!-- The background color for the header area of the page. --><br />
<s:color name="FooterBackground" value="CBEFEFEF" /> <!-- The background color for the footer area of the page. --><br />
<s:color name="SelectionBackground" value="7F95D3F1" /> <!-- The background color for selected list items and drop-down menu items. --><br />
<s:color name="HoverBackground" value="65CDE9F7" /> <!-- The background color for list items and drop-down menu items on hover. --><br />
<br />
<!--========================================================================<br />
Border Styles<br />
=========================================================================--> <br />
<s:color name="RowAccent" value="f44c0a" /> <!-- The accented left border on selected list items. --><br />
<s:color name="StrongLines" value="78C8EE" /> <!-- Borders for browser controls on hover. --><br />
<s:color name="Lines" value="ABABAB" /> <!-- Borders for browser controls. --><br />
<s:color name="SubtleLines" value="E5E5E5" /> <!-- Subtle border color. For example, gridlines for inline editing. --><br />
<s:color name="DisabledLines" value="E1E1E1" /> <!-- Border color for disabled browser controls such as input boxes and select boxes. --><br />
<s:color name="AccentLines" value="3BAFE7" /> <!-- Focused border color for selected browser controls. --><br />
<s:color name="DialogBorder" value="E5E5E5" /> <!-- Dialog box border color. --><br />
<br />
<!--========================================================================<br />
Navigation Styles<br />
=========================================================================--><br />
<s:color name="Navigation" value="666666" /> <!-- Text color for horizontal and vertical navigation items. --><br />
<s:color name="NavigationAccent" value="f44c0a" /> <!-- Text color for a selected horizontal navigation item. --><br />
<s:color name="NavigationHover" value="f44c0a" /> <!-- Navigation text color on hover. Applies to top navigation, and to Quick Launch in horizontal mode. --><br />
<s:color name="NavigationPressed" value="1789C1" /> <!-- Text color of navigation item when pressed. Applies to top navigation, and to Quick Launch in horizontal mode. --><br />
<s:color name="NavigationHoverBackground" value="65CDE9F7" /> <!-- Background color of Quick Launch items in vertical mode on hover over the navigation item. --><br />
<s:color name="NavigationSelectedBackground" value="C6EFEFEF" /> <!-- Background color of Quick Launch items in vertical mode after the navigation item is selected. --><br />
<!--========================================================================<br />
Emphasis Styles<br />
=========================================================================--> <br />
<s:color name="EmphasisText" value="FFFFFF" /> <!-- The text color that appears on top of emphasis background. --><br />
<s:color name="EmphasisBackground" value="f44c0a" /> <!-- The accented background color that appears directly behind emphasis text and the "Site Content" icons --><br />
<s:color name="EmphasisHoverBackground" value="1789C1" /> <!-- Background color on hover, for elements that are using emphasis background. --><br />
<s:color name="EmphasisBorder" value="1789C1" /> <!-- Border color for elements that are using emphasis background. --><br />
<s:color name="EmphasisHoverBorder" value="1375A5" /> <!-- Border color on hover for elements that are using emphasis background. --><br />
<br />
<!--========================================================================<br />
Hyper Link Styles<br />
=========================================================================--> <br />
<s:color name="SubtleEmphasisText" value="666666" /> <!-- Text that appears on top of subtle emphasis background. --><br />
<s:color name="SubtleEmphasisCommandLinks" value="262626" /> <!-- Command link color for links that appear on top of subtle emphasis background. --><br />
<s:color name="SubtleEmphasisBackground" value="C6EFEFEF" /> <!-- Background that appears directly behind subtle emphasis text. --><br />
<br />
<!--========================================================================<br />
Top Bar Styles<br />
=========================================================================--> <br />
<s:color name="TopBarText" value="333333" /> <!-- Text and glyph color for the welcome menu, quick access toolbar icons, and closed ribbon tabs. --><br />
<s:color name="TopBarBackground" value="CBEFEFEF" /> <!-- The background color for the top bar, which is seen below and to the right of the suite navigation. --><br />
<s:color name="TopBarHoverText" value="333333" /> <!-- Text and glyph color on hover for the welcome menu, quick access toolbar icons, and closed ribbon tabs. --><br />
<s:color name="TopBarPressedText" value="333333" /> <!-- Text and glyph color for when the welcome menu, quick access toolbar icons, or closed ribbon tabs are pressed. --><br />
<!--========================================================================<br />
Header Styles<br />
=========================================================================--> <br />
<s:color name="HeaderText" value="444444" /> <!-- The base text color for anything in the header area. --><br />
<s:color name="HeaderSubtleText" value="777777" /> <!-- Helper text for the search box when in the header area. --><br />
<s:color name="HeaderDisableText" value="B1B1B1" /> <!-- Text for the search box, if the search box is disabled when in the header area. --><br />
<s:color name="HeaderNavigationText" value="666666" /> <!-- Base text color for navigation links in the header area. --><br />
<s:color name="HeaderNavigationHoverText" value="f44c0a" /> <!-- Text color for navigation links in the header area when you hover over the link. --><br />
<s:color name="HeaderNavigationPressedText" value="1789C1" /> <!-- Text color for navigation links in the header area when you press the link. --><br />
<s:color name="HeaderNavigationSelectedText" value="f44c0a" /> <!-- Text color for navigation links in the header area after the link is selected. --><br />
<s:color name="HeaderLines" value="ABABAB" /> <!-- Search box lines when the search box is in the header area. --><br />
<s:color name="HeaderStrongLines" value="78C8EE" /> <!-- Search box lines on hover when the search box is in the header area. --><br />
<s:color name="HeaderAccentLines" value="3BAFE7" /> <!-- Search box lines on focus when the search box is in the header area. --><br />
<s:color name="HeaderSubtleLines" value="C6C6C6" /> <!-- Subtle lines found inside the header area. Not used in default CSS. --><br />
<s:color name="HeaderDisabledLines" value="E1E1E1" /> <!-- Search box lines if the search box is disabled when it's in the header area. --><br />
<s:color name="HeaderDisabledBackground" value="FDFDFD" /> <!-- Search box background if the search box is disabled when it's in the header area. --><br />
<s:color name="HeaderFlyoutBorder" value="D1D1D1" /> <!-- Border for drop-down menus when originating from the header area. --><br />
<s:color name="HeaderSiteTitle" value="262626" /> <!-- Text color for the site title when in the header area. --><br />
<br />
<!--========================================================================<br />
Suite Styles<br />
=========================================================================--> <br />
<s:color name="SuiteBarBackground" value="f44c0a" /> <!-- Background color for the suite navigation. --><br />
<s:color name="SuiteBarHoverBackground" value="63BFEC" /> <!-- Background color on hover for the suite navigation. --><br />
<s:color name="SuiteBarText" value="FFFFFF" /> <!-- Text and glyph color for the suite navigation items. --><br />
<s:color name="SuiteBarDisabledText" value="D3D3D3" /> <!-- Text and glyph color for disabled suite items. Not used in default CSS. --><br />
<br />
<!--========================================================================<br />
Button Styles<br />
=========================================================================--> <br />
<s:color name="ButtonText" value="444444" /> <!-- Text color for buttons. --><br />
<s:color name="ButtonDisabledText" value="B1B1B1" /> <!-- Text color for disabled buttons. --><br />
<s:color name="ButtonBackground" value="FDFDFD" /> <!-- Background color for buttons. --><br />
<s:color name="ButtonHoverBackground" value="D9EFFA" /> <!-- Background color for buttons on hover. --><br />
<s:color name="ButtonPressedBackground" value="9ED7F2" /> <!-- Background color for buttons while pressed. --><br />
<s:color name="ButtonDisabledBackground" value="FDFDFD" /> <!-- Background color for disabled buttons. --><br />
<s:color name="ButtonBorder" value="ABABAB" /> <!-- Border color for buttons. --><br />
<s:color name="ButtonHoverBorder" value="9ED7F2" /> <!-- Border color for buttons on hover. --><br />
<s:color name="ButtonPressedBorder" value="63BFEC" /> <!-- Border color for buttons while pressed. --><br />
<s:color name="ButtonDisabledBorder" value="E1E1E1" /> <!-- Border color for buttons that are disabled. --><br />
<s:color name="ButtonGlyph" value="666666" /> <!-- Glyph color for a glyph that appears in a button. --><br />
<s:color name="ButtonGlyphActive" value="444444" /> <!-- Glyph color on hover, for a glyph that appears in a button. --><br />
<s:color name="ButtonGlyphDisabled" value="B1B1B1" /> <!-- Glyph color for a disabled button. --><br />
<!--========================================================================<br />
Title Styles<br />
=========================================================================--> <br />
<s:color name="TileText" value="FFFFFF" /> <!-- The text that appears on top of the tile background overlay. --><br />
<s:color name="TileBackgroundOverlay" value="99000000" /> <!-- The background overlay color for tiles. --><br />
<!--========================================================================<br />
Rich Text Editor Accents<br />
=========================================================================--> <br />
<s:color name="ContentAccent1" value="f44c0a" /> <!-- The first accent color that a user can select from the Rich Text Editor color picker. --><br />
<s:color name="ContentAccent2" value="FF0097" /> <!-- The second accent color that a user can select from the Rich Text Editor color picker. --><br />
<s:color name="ContentAccent3" value="996600" /> <!-- The third accent color that a user can select from the Rich Text Editor color picker. --><br />
<s:color name="ContentAccent4" value="F09609" /> <!-- The fourth accent color that a user can select from the Rich Text Editor color picker. --><br />
<s:color name="ContentAccent5" value="A200FF" /> <!-- The fifth accent color that a user can select from the Rich Text Editor color picker. --><br />
<s:color name="ContentAccent6" value="00ABA9" /> <!-- The sixth accent color that a user can select from the Rich Text Editor color picker. --><br />
</s:colorPalette>Stephen Brownhttp://www.blogger.com/profile/03547644424344780488noreply@blogger.com4tag:blogger.com,1999:blog-3120041574977953573.post-66657150337502646712013-05-01T12:41:00.001+01:002013-05-01T12:55:10.918+01:00Xslt Timeout<span style="font-family: Arial, Helvetica, sans-serif;">Following on from an earlier article I wrote (<a href="http://whats-the-sharepoint.blogspot.co.uk/2013/03/xsllink-property-and-xsltlistviewwebpart.html">XslLink Property and XsltListViewWebParts</a>), I've continued to see intermittent performance issues
with XsltListViewWebParts where custom Xsl has been implemented - both in remote files or added as an inline property to a page. The performance problem surfaces in the UI as a
correlation ID on a List View Web Part which, when the page is refreshed, works fine. Most often the error occurs following an IISRESET or the deployment of a solution package. When interrogating the SharePoint ULS logs to investigate, the log files reveal
problems with the Xslt Transform process going on behind the scenes.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">
</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">While investigating yet another occurrence of the same problem recently, the error showed up in the logs as a Stack Overflow error. As usual, I started to search the internet for any more advice about the same problem to see if any further advances had been made.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">
</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Fortunately, there does appear to now be some help in the February 2012 CU
which adds or allows access to a new property on the Farm called
XsltTransformTimeout which, by default, is set to 1 second. Using PowerShell we
can update this to cater for high demand peaks in service levels.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">
</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Here's the details from a Microsoft SharePoint TechCenter issue: </span><a href="http://social.technet.microsoft.com/Forums/en-US/sharepointgeneralprevious/thread/1a38bdff-e40a-4e50-a2e8-47cbcb31cc6b/" rel="nofollow" target="_blank"><span style="font-family: Arial, Helvetica, sans-serif;">http://social.technet.microsoft.com/Forums/en-US/sharepointgeneralprevious/thread/1a38bdff-e40a-4e50-a2e8-47cbcb31cc6b/</span></a><br />
<br />
<span style="font-family: Arial, Helvetica, sans-serif;">Also see: </span><a href="http://support.microsoft.com/default.aspx?scid=kb;EN-US;2639184"><span style="font-family: Arial, Helvetica, sans-serif;">http://support.microsoft.com/default.aspx?scid=kb;EN-US;2639184</span></a><span style="font-family: Arial, Helvetica, sans-serif;"> for symptoms and also the MSDN blogs: </span><a href="http://blogs.msdn.com/b/joerg_sinemus/archive/2012/03/07/xslt-and-timeout-problem-when-transforming-runs-more-than-one-second.aspx"><span style="font-family: Arial, Helvetica, sans-serif;">http://blogs.msdn.com/b/joerg_sinemus/archive/2012/03/07/xslt-and-timeout-problem-when-transforming-runs-more-than-one-second.aspx</span></a>.Stephen Brownhttp://www.blogger.com/profile/03547644424344780488noreply@blogger.com0tag:blogger.com,1999:blog-3120041574977953573.post-1941192854717329382013-03-01T15:01:00.001+00:002013-03-01T15:01:38.803+00:00XslLink Property and the XsltListViewWebPart<div class="ExternalClass71BD88D9E9AC49719A9B875132CD7593">
<span style="font-family: Arial, Helvetica, sans-serif;">
</span><span id="ms-rterangecursor-start"></span><span style="font-family: Arial, Helvetica, sans-serif;">In some recent deployments for
different clients, I've had problems with the
XsltListViewWebPart when custom XSL is used, specifically when the custom XSL is
deployed to the server and the XslLink property of the Web Part is used.</span><br />
<span style="font-family: Arial;"></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">
</span><span><span style="font-family: Arial, Helvetica, sans-serif;">There's a couple of specific problems that I've encountered and I
thought it useful to blog about their symptoms to help anyone else that might
have similar issues. </span></span><br />
<span><span style="font-family: Arial;"></span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">
</span><span><span style="font-family: Arial, Helvetica, sans-serif;">One of the problems I've seen is based on a significant performance
degradation (see this post: </span><a href="http://blog.vossers.com/2012/01/28/how-the-xsltlistviewwebpart-in-sharepoint-2010-can-be-a-real-performance-killer/"><span style="font-family: Arial, Helvetica, sans-serif;">http://blog.vossers.com/2012/01/28/how-the-xsltlistviewwebpart-in-sharepoint-2010-can-be-a-real-performance-killer/</span></a><span style="font-family: Arial, Helvetica, sans-serif;">). If
there are multiple XsltListViewWebParts on a page that employ custom XSL using
the XslLink property of the web part then this issue might show up. It appears
that the way the XSL on the server is cached, especially on load-balanced
environments, can cause a problem if the timestamps are different, i.e. the
files deployed at different times. Microsoft appear to have issued a </span><a href="http://support.microsoft.com/kb/2598348"><span style="color: #0072bc; font-family: Arial, Helvetica, sans-serif;">HotFix</span></a><span style="font-family: Arial, Helvetica, sans-serif;"> to resolve some of this problem, but based on the blog post I
link to above, I don't think that this will always fix everything. The way the
XSL is cached by SharePoint appears to have an issue and can randomly drop all
the compiled XSL and attempt to re-compile, using a single thread. In a page
with multiple XsltListViewWebParts you can see why this might cause random performance degradation issues.
One of the suggested work-arounds is to place the XSL using the </span></span><span style="font-family: Arial, Helvetica, sans-serif;">
XSL web part property, instead of XslLink. I'll come back to this in a
moment.</span><br />
<span style="font-family: Arial;"></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">
</span><span><span style="font-family: Arial, Helvetica, sans-serif;">The second problem has recently come to light. I had a deployment that
put XSL onto the server. However, I had several XsltListViewWebParts on a page
using several different custom XSL files all set up to be used via the XslLink
property. Internally it all worked fine, but when the files were deployed into
the customer environment, older versions of the XSL files appeared to be used to
generate the HTML, and not the newer versions. Without any action on our part,
the problem resolved itself overnight. Later on that same day, the problem
re-surfaced and the HTML generated was back to the old version. Later again, on
the same day, the problem disappeared again without any interference from
us.</span></span><br />
<span><span style="font-family: Arial;"></span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">
</span><span><span style="font-family: Arial, Helvetica, sans-serif;">Having reviewed the problem and found the following article (from
October 2012) from Microsoft, I would suggest that any customisation of XSL for
the XsltListViewWebPart is done using the XSL property of the web part, and not
the XslLink property. In both scenarios, this appears to mitigate any potential
problems, so from now on when I do these kinds of customisations, I will always adopt this approach:
</span></span><a href="http://blogs.msdn.com/b/spses/archive/2012/10/23/guidance-for-xsllink-property-with-the-xsltlistviewwebpart.aspx"><span style="font-family: Arial, Helvetica, sans-serif;">http://blogs.msdn.com/b/spses/archive/2012/10/23/guidance-for-xsllink-property-with-the-xsltlistviewwebpart.aspx</span></a><span style="font-family: Arial, Helvetica, sans-serif;"><span id="ms-rterangecursor-end"></span></span></div>
Stephen Brownhttp://www.blogger.com/profile/03547644424344780488noreply@blogger.com0tag:blogger.com,1999:blog-3120041574977953573.post-24552361486346467502013-01-29T15:30:00.001+00:002013-01-29T15:33:40.176+00:00SharePoint Content Organiser and Custom Routing<span style="font-family: Arial, Helvetica, sans-serif;">I recently received a request to spend some time reviewing whether or not Content Organiser Routing could be extended and customised. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">The request came out of a problem encountered by one of our consultants when he set up a Content Organiser Rule which routed a document to a separate Site Collection. The destination Site Collection then had its own Content Organiser rules to add a document into a specific library existing in the site and implementing a folder structure based on the metadata included with the document. The folder structure would pre-exist and be set up using a custom Content Type and pre-populated metadata which the document, when it was added into the folder, would inherit. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">This worked fine when a folder matching the metadata in the document already existed, however, if the folder did not already exist, despite setting the Content Organiser rule to create a new folder, SharePoint displayed a strange "security validation time out". After a little digging, I founder references to a "security validation time out" error from Microsoft who had already resolved the problem in the form of a requestable Hotfix (KB2596584 - </span><a href="http://support.microsoft.com/kb/2596584"><span style="font-family: Arial, Helvetica, sans-serif;">http://support.microsoft.com/kb/2596584</span></a><span style="font-family: Arial, Helvetica, sans-serif;">) which as far as I could see did not form part of SharePoint SP1 (which is what the server was running). I requested, downloaded and installed the Hotfix (after snapshotting our VMware Server) and it resolved the issue and functionally the system was working as expected.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"> </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">That was great, so from a client perspective, there was no more odd message that didn't mean much, and not only that but the Content Organiser rule now appeared to working properly.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"> </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">However, based on our requirement it was necessary that the folder that was created automatically would have to use our own custom Content Type, not the standard Folder Content Type. Despite removing the New Folder options from the destination library and making the custom Content Type available, the Content Organiser would always create any new folder using the standard Folder Content Type, which was pretty much what I expected. So, I started looking into Custom Routers.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"> </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">A Custom Router can be created using the simple Interface </span><span style="font-family: Arial, Helvetica, sans-serif;"><a href="http://msdn.microsoft.com/en-us/library/microsoft.office.recordsmanagement.recordsrepository.icustomrouter.aspx">ICustomRouter</a>. It implements a single method <a href="http://msdn.microsoft.com/en-us/library/ff408890.aspx">OnSubmitFile</a> in which you can do some additional or alternate processing before handing back to the <a href="http://msdn.microsoft.com/en-us/library/microsoft.office.recordsmanagement.recordsrepository.ecmdocumentrouter.aspx">EcmDocumentRouter</a>. Registering a Custom Router is straight-forwards. I used a very simple Console Application as I was only researching the issue, but ideally this would be a Web or Site Feature that registers the Custom Router on activation (and removes it on deactivation). </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Once the Custom Router is registered (using the <a href="http://ecmdocumentroutingweb.addcustomrouter/">EcmDocumentRoutingWeb.AddCustomRouter</a> method) it becomes available through the UI when you add or edit a Content Organiser Rule:</span><br />
<span style="font-family: Arial;"></span><br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgYWTTmfrgic03nfexO8LPSYpSo1-Fo7YtdqkEsmzUWIZjBMtzjVlk8a_69kwF_6kWZa7MtfKj4QY5YKjY8JVyjOhbs6Zsj_ifQ4ARx2jJNnGqxork1q84ULo2ovkFEPPmfZIAOt4BbQJc/s1600/CustomRouter001.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="177" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgYWTTmfrgic03nfexO8LPSYpSo1-Fo7YtdqkEsmzUWIZjBMtzjVlk8a_69kwF_6kWZa7MtfKj4QY5YKjY8JVyjOhbs6Zsj_ifQ4ARx2jJNnGqxork1q84ULo2ovkFEPPmfZIAOt4BbQJc/s640/CustomRouter001.png" width="640" /></a><br />
<br />
<div class="ms-rtestate-field ms-rtefield">
</div>
<div class="ms-rtestate-field ms-rtefield">
<span style="font-family: Arial, Helvetica, sans-serif;">When you register the Custom Router the first parameter is the Name - this is what appears in the dropdown above. Once this is set up on the Content Organiser Rule it means that the Content Organiser does its normal processing up to a point and then makes the call into the Custom Router. It appears from what I've seen that the call is made to the Custom Router just prior to actually saving the file to its final destination, therefore, any processing that may be required to make this happen would have already been done, i.e. creating a new folder, which I'll come back to in a moment.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"></span> <br />
<span style="font-family: Arial, Helvetica, sans-serif;"> The Custom Router's OnSubmitFile method call can return one of two <a href="http://msdn.microsoft.com/en-us/library/microsoft.office.recordsmanagement.recordsrepository.customrouterresult.aspx">CustomRouterResult</a> options: SuccessContinueProcess and SuccessCancelFurtherProcessing (obviously no room for failure here)...</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"></span> <br />
<span style="font-family: Arial, Helvetica, sans-serif;"> As I just mentioned, if you are setting a rule up to create a folder if it doesn't exist (which we are in our scenario), regardless of which result you return, the folder will always get created. The difference in result types is more apparent from what happens to the routed file. Returning SuccessContinueProcessing does exactly what it says, it carries on after the Custom Router code and performs the standard and expected behaviour, i.e. routes the document according to what rules you have and actually performs the save to the final destination. SuccessCancelFurtherProcessing, however, doesn't process any further, as the name suggests, therefore, as you can see in the <a href="http://msdn.microsoft.com/en-us/library/microsoft.office.recordsmanagement.recordsrepository.ecmdocumentrouter.aspx">MSDN example</a>, it useful if you are going to handle what happens yourself and you don't need the out-of-the-box routing to do anything. What I would say is that returning SuccessCancelFurtherProcessing will mean that the file is lost: I returned this value during my testing and the routed file disappeared from the Drop-Off Library as expected and never appeared in the destination library which only makes me think that this option is really only useful if you are going to implement the saving of the file yourself.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"></span> <br />
<span style="font-family: Arial, Helvetica, sans-serif;"> Back to our scenario, I was able to use the Custom Router to reset the metadata and Content Type of the already created folder (as we get a reference to this in the OnSubmitFile method) which fitted what we were looking for. I had a quick try and yes, it worked, however, there is a caveat. What I expected was that items subsequently added into the updated folder would inherit the metadata set on the folder. In my short trial of this, it didn't work that way, so I suspect I'm not setting something or some configuration is missing, so just be aware that it may be an issue.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"></span> <br />
<span style="font-family: Arial, Helvetica, sans-serif;"> Hopefully this has been of some use.</span></div>
<div class="ms-rtestate-field ms-rtefield">
</div>
Stephen Brownhttp://www.blogger.com/profile/03547644424344780488noreply@blogger.com0tag:blogger.com,1999:blog-3120041574977953573.post-30991443335138280112012-10-25T16:10:00.004+01:002012-10-25T16:10:57.399+01:00X-UA-Compatible Meta Tag Not Working<span style="font-family: Arial, Helvetica, sans-serif;">You may or may not be aware that you can force IE to render a web page is a specific document mode, which means that an IE9 browser can be forced to render a page as if it was IE8 or IE7. Why you'd do this is most likely due to the fact that forcing an newer browser to render like an older one (for instance, forcing IE9 to render like IE7) provides a convenient baseline when trying to style a page.</span><br />
<span style="font-family: Arial;"></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">You do this by adding the X-UA-Compatible meta tag to the head block of a page as follows:</span><br />
<span style="font-family: Arial;"></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><meta http-equiv="X-UA-Compatible" content="IE=8" /></span><br />
<span style="font-family: Arial;"></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">This particular line forces IE to render using IE8 mode. You can read more about it here: </span><a href="http://msdn.microsoft.com/en-us/library/cc288325(v=vs.85).aspx"><span style="font-family: Arial, Helvetica, sans-serif;">http://msdn.microsoft.com/en-us/library/cc288325(v=vs.85).aspx</span></a><span style="font-family: Arial, Helvetica, sans-serif;">.</span><br />
<span style="font-family: Arial;"></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">There are a couple of caveats to adding this meta tag. The first one is that it must be the first meta tag in the head block (there are a coupld of exceptions to this). The second one is not so obvious, and is the main reason for this article.</span><br />
<span style="font-family: Arial;"></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">If you use conditional comments to render the opening HTML tag of a page (see </span><a href="http://paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/"><span style="font-family: Arial, Helvetica, sans-serif;">http://paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/</span></a><span style="font-family: Arial, Helvetica, sans-serif;"> for details about this) the meta tag just plain doesn't work. It doesn't matter where you place it in the head block, it just doesn't work. If you have the same issue, the way around it, as it turns out, is rather simple if a little weird: move it to before the conditional comments like so:</span><br />
<span style="font-family: Arial;"></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><meta http-equiv="X-UA-Compatible" content="IE=8"/></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><!--[if lt IE 7 ]> <html class="ie6"> <![endif]--></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><!--[if IE 7 ]> <html class="ie7"> <![endif]--></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><!--[if IE 8 ]> <html class="ie8"> <![endif]--></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><!--[if IE 9 ]> <html class="ie9"> <![endif]--></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><!--[if (gt IE 9)|!(IE)]><!--> <html class=""> <!--<![endif]--></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">I've tested this and it appears to continue to work as expected with no downside (apart from ugly HTML). Hopefully this will help someone out there.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"></span>Stephen Brownhttp://www.blogger.com/profile/03547644424344780488noreply@blogger.com0tag:blogger.com,1999:blog-3120041574977953573.post-66825384679839713202012-02-16T08:52:00.003+00:002012-02-16T08:57:57.426+00:00Cookies...and not the munching kind<span id="ms-rterangecursor-start"></span><span style="font-family: Arial, Helvetica, sans-serif;">What am I talking about? Well, due
to an amendment to the law (the Privacy and Electronic Communications (EC
Directive) Regulations 2003, and the new Directive 2009/136/EC) in May last
year, the way information is stored by technology is being changed, and
primarily how cookies should and can be used and stored - hence the nick-name
for this amendment: "The Cookie Law".</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">
</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">The UK government has given businesses a year to comply with the changes,
which means that as from May 2012, any organisation that does business in the UK
(and EU) is affected.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">
</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">To find out more: <span id="ms-rterangepaste-start"></span></span><a href="http://www.ico.gov.uk/for_organisations/privacy_and_electronic_communications/cookie_rules_prepare.aspx"><span style="font-family: Arial, Helvetica, sans-serif;">http://www.ico.gov.uk/for_organisations/privacy_and_electronic_communications/cookie_rules_prepare.aspx</span></a><span id="ms-rterangepaste-end"></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">
</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Just so you don't panic too much, this doesn't appear to affect intranets!
It only applies to public-facing websites.<span id="ms-rterangecursor-end"></span></span>Stephen Brownhttp://www.blogger.com/profile/03547644424344780488noreply@blogger.com0tag:blogger.com,1999:blog-3120041574977953573.post-10158696266412259362012-02-15T14:56:00.004+00:002012-02-15T14:56:59.606+00:00Learning jQuery<span id="ms-rterangecursor-start"></span><span style="font-family: Arial, Helvetica, sans-serif;">If you ever wanted to learn jQuery
but couldn't find the time or the discipline to do so, you can get some daily
force-fed lessons by visiting <span id="ms-rterangepaste-start"></span></span><a href="http://learnjquery.tutsplus.com/"><span style="font-family: Arial, Helvetica, sans-serif;">http://learnjquery.tutsplus.com/</span></a><span id="ms-rterangepaste-end"></span><span style="font-family: Arial, Helvetica, sans-serif;"> and signing up for the "30 days to Learn jQuery"
course from Tuts+.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">
</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">If you're starting out learning this stuff
it should provide some structure (hopefully) to your initial
learning. Have fun.<span id="ms-rterangecursor-end"></span></span>Stephen Brownhttp://www.blogger.com/profile/03547644424344780488noreply@blogger.com0tag:blogger.com,1999:blog-3120041574977953573.post-62286287698462796492012-01-30T12:43:00.005+00:002012-02-16T11:05:22.439+00:00SharePoint Formatted String Control<div class="ExternalClass41DB10144FCB4C63A22472BD0255FDCA">
<span style="font-family: Arial, Helvetica, sans-serif;">
</span><span id="ms-rterangecursor-start"></span><span style="font-family: Arial, Helvetica, sans-serif;">I've come to the conclusion that a
little known but widely used control, the FormattedString control in the
Microsoft.SharePoint.WebControls namespace, is a very useful control. Any
search through the Control Templates delivered with SharePoint shows how often
this control is used when rendering output through SharePoint. It works in the
same way a String.Format would in code, only it's something that can be added to
an ASCX or ASPX asset.</span><br />
<br />
<span style="font-family: Arial, Helvetica, sans-serif;">
</span><span style="font-family: Arial, Helvetica, sans-serif;">Let's have a closer look.</span><br />
<br />
<span style="font-family: Arial, Helvetica, sans-serif;">
</span><span style="font-family: Arial, Helvetica, sans-serif;">In a publishing scenario, if you have some HTML into which you need to inject
a value from the current page then you may be able to use the FormattedString
control to create the HTML, as you might using String.Format. This can include
HTML (i.e. "&gt;p&lt;" instead of "<p>") and any other server-side
control output. </span><br />
<br />
<span style="font-family: Arial, Helvetica, sans-serif;">
</span><span style="font-family: Arial, Helvetica, sans-serif;">In a simple example, to do this you simply add in the usual "{0}" indexed
tokens and then, as child controls, you add in the field values. Here's an
example, after which I'll explain a little more:</span><br />
<br />
<pre class="brush: csharp;tab-size: 10; html-script: true;"><SharePointWebControls:FormattedString runat="server"
FormatText="&lt;p&gt;{0}&lt;/p&gt;&lt;p&gt;{1}&lt;/p&gt;"
EncodeMethod="NoEncode">
<SharePointWebControls:FieldValue
runat="server" FieldName="Title" />
<SharePointWebControls:FieldValue runat="server"
FieldName="Description" />
</SharePointWebControls:FormattedString>
</pre>
<br />
<span style="font-family: Arial, Helvetica, sans-serif;">The 2 child controls (FieldValue) render out the value of the 2 page field
values as strings which are then used by the FormattedString control to replace
the 2 tokens respectively. You could, as child controls, use any server control
to output more complex examples should you wish, or your own custom controls.
The render sequence always processes child controls first, so whatever the
output is from the child control is used. You can have as many tokens as
required. Another scenario might be to get the server-relative URL of the site,
which you can do by using the SPUrl function in an ASP Literal control.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">
</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Going back to my example, the FieldValue control itself, is another
little-documented control which I frequently use as it renders the value of a
field without much or any of the surrounding HTML, which results in cleaner
markup. Using it in the above context makes sense as we only want the actual
values, not the additional HTML a control might output.</span><br />
<br />
<span style="font-family: Arial, Helvetica, sans-serif;">
</span><span style="font-family: Arial, Helvetica, sans-serif;">More information can be found here: </span><a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.webcontrols.formattedstring.aspx"><span style="font-family: Arial, Helvetica, sans-serif;">http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.webcontrols.formattedstring.aspx</span></a><span style="font-family: Arial, Helvetica, sans-serif;"> and
for the FieldValue control, some limited information can be found here: </span><a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.webcontrols.fieldvalue.aspx"><span style="font-family: Arial, Helvetica, sans-serif;">http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.webcontrols.fieldvalue.aspx</span></a><span style="font-family: Arial, Helvetica, sans-serif;">.<span id="ms-rterangecursor-end"></span></span></div>Stephen Brownhttp://www.blogger.com/profile/03547644424344780488noreply@blogger.com0tag:blogger.com,1999:blog-3120041574977953573.post-27131581782876096452011-12-23T11:03:00.003+00:002011-12-23T11:03:36.607+00:00Problem restoring a PowerShell backup<span id="ms-rterangecursor-start"></span><span style="font-family: Arial, Helvetica, sans-serif;">I had a problem today attempting to
restore a backup I had taken using PowerShell. I received the following error in PowerShell when running thr
Restore-SPSite command:</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">
</span><br />
<span id="ms-rterangepaste-start"></span><span style="font-family: Arial, Helvetica, sans-serif;">"Restore-SPSite : Your backup is from
a different version of Microsoft SharePoint Foundation and cannot be restored to
a server running the current version. The backup file should be restored to a
server with version '4.1.10.0' or later."</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">
</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">I checked my SharePoint version numbers against the server where I had taken
the backup and it all looked fine. I took another backup in case the first one
had become corrupt (even though I had already restored it successfully several
times before). I rebooted and restarted my VM, but all to no avail. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">
</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">In a last ditch attempt, I decided to delete 2 empty content databases that
were set up on my machine, and created a new one to replace them and tried
again.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">
</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">To my surprise, it worked. So, if you have the same problem, try removing
content databases (if you can).<br /><span id="ms-rterangecursor-end"></span></span>Stephen Brownhttp://www.blogger.com/profile/03547644424344780488noreply@blogger.com1tag:blogger.com,1999:blog-3120041574977953573.post-19434206811657773832011-12-02T14:12:00.001+00:002011-12-02T15:20:43.786+00:00Usability Testing<span id="ms-rterangecursor-start"></span><span style="font-family: Arial, Helvetica, sans-serif;">Browsing through some of the SPC2011
conference materials, I came upon a useful website that provides usability
testing from the perspective of how a user would interact with your web design.
You simply provide a web design image or HTML I believe and a series of tests are run to assess
how your design is used by real-world users. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">
</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">The click responses to questions about the design are grouped and displayed
so you can see whether what you thought was a prominent design for something
important actually does the job of attracting user interest. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">
</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">It's not a free site, but a test is only $9 (about £5.70 at today's price) which is possibly well worth the
pay-out to get some useful design feedback upfront of any development work.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">
</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Check out <span id="ms-rterangepaste-start"></span></span><a href="http://www.intuitionhq.com/"><span style="font-family: Arial, Helvetica, sans-serif;">http://www.intuitionhq.com</span></a><span style="font-family: Arial, Helvetica, sans-serif;">.<span id="ms-rterangecursor-end"></span></span><span id="ms-rterangepaste-end"></span>Stephen Brownhttp://www.blogger.com/profile/03547644424344780488noreply@blogger.com1tag:blogger.com,1999:blog-3120041574977953573.post-61486004515685078712011-11-30T08:47:00.001+00:002011-11-30T08:47:54.816+00:00Search Refiners and the Search Box<span id="ms-rterangecursor-start"></span><span style="font-family: Arial, Helvetica, sans-serif;">Something that isn't normally the
case is to remove the Search Box from the out-of-the-box search results page.
More often than not, it's a requirement to have it present so the user can see
the query they're currently searching with. However, recently, a client
insisted on removing this from their search results page.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">
</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Now, I've already given the game away here in the title of this article: some
of the search refiners functionality stopped working. Which bit? Well, nothing
overly important - simply the "show more" option that appears in the refiners
when more than a specified number of refiners are present. More to the point is
why it happens?</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">
</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Having examined pages with and without the Search Box, it appears the Search
Box Web Part is responsible for adding a JavaScript function and a reference to
the search.js file. The function is effectively a check for the search.js, but
without it the "show more" option will fail as it calls this function first and
as it can't find it, it doesn't work. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">
</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">The following was an extract I added to my Search Results Xslt to get the
page to function correctly:</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">
</span><br />
<div class="ms-rteFontFace-2">
<span style="font-family: "Courier New", Courier, monospace;">function SearchEnsureSOD() {<br />
EnsureScript('search.js',
typeof(RenderTaggingControl));<br />}<br />_spBodyOnLoadFunctionNames.push('SearchEnsureSOD');</span></div>
<span style="font-family: "Courier New", Courier, monospace;">
</span><br />
<div class="ms-rteFontFace-2">
<span class="ms-rteThemeFontFace-1"><span style="font-family: Arial, Helvetica, sans-serif;">The "typeof" used by
the EnsureScript function call is usually against GoSearch but this is present
only when the Search Box Web Part is present. I've used RenderTaggingControl
instead as this is present when the refiners are present.<span id="ms-rterangecursor-end"></span></span></span></div>Stephen Brownhttp://www.blogger.com/profile/03547644424344780488noreply@blogger.com0tag:blogger.com,1999:blog-3120041574977953573.post-9472390742411848442011-11-28T08:58:00.001+00:002011-11-28T08:59:59.363+00:00CSS and JavaScript Bundling and Minification<span id="ms-rterangecursor-start"></span>Unfortunately, this is not something
immediately available, but it looks like this will be in the next version of
Visual Studio. The bundling features I've read about will automatically bundle
a specified selection of files into a single HTTP request. <br />
<br />
The astute among you will probably already be aware that there's already
support for JavaScript "bundling" in the current version of Visual Studio (and
SharePoint) in the form of the Script Manager control which you can use to
create what's called a Composite Script and something we've exploited in our
SharePoint 2010 publishing projects. As the name implies, it only manages
scripts so what it lacks is any kind of support for CSS. <br />
<br />
The next version appears to not only enhance the current "bundling"
functionality but also extend it for use with CSS files (and there may even be
some possibility of extending this to other file types if the class model will
allow). This means that multiple CSS files can then be "bundled" in the same
way, thereby minimising the number of HTTP requests. Not only can we do that,
but we will also be able to minify the bundled files. <br />
<br />
<span class="ms-rtegenerate-skip" style="white-space: nowrap;"><span class="ms-rtestate-read ms-rtegenerate-skip" contenteditable="false" style="font-size: 8pt;"><a class="ms-rtegenerate-skip" href=""><img alt="Misspelled Word" class="ms-rtegenerate-skip" height="1" src="http://mysite.silversands.co.uk/_layouts/images/blank.gif" style="width: 0px;" width="1" /></a></span><span class="ms-spellcheck-error ms-rtegenerate-skip" id="rnd20679">Minification</span></span> is
the process of removing unnecessary characters from a file, like spaces,
carriage-returns, possibly semi-colons, comments etc. It can be used to reduce
files size considerably, and if the file size is small, the HTTP request will be
quicker to return to the browser. There are already sites out there that can be
used to do this, but to have it within Visual Studio will be very useful. How
much this will be integrated with SharePoint I don't know. As SharePoint is
based on a specific version of the <span class="ms-rtegenerate-skip" style="white-space: nowrap;"><span class="ms-rtestate-read ms-rtegenerate-skip" contenteditable="false" style="font-size: 8pt;"><a class="ms-rtegenerate-skip" href=""><img alt="Misspelled Word" class="ms-rtegenerate-skip" height="1" src="http://mysite.silversands.co.uk/_layouts/images/blank.gif" style="width: 0px;" width="1" /></a></span><span class="ms-spellcheck-error ms-rtegenerate-skip" id="rnd12148">.Net</span></span> framework
this functionality may not make it into the next version - we'll have to wait
and see.<br />
<br />
The main drive behind these changes appear to come from the necessity to
provide a better web UX for mobile devices where low and slow bandwidth can
inhibit use of a website. We'll just have to wait and see how and if it
surfaces in the next version of SharePoint.<br />
<br />
If you want to know more, check out Scott Guthrie's blog post: <a href="http://weblogs.asp.net/scottgu/archive/2011/11/27/new-bundling-and-minification-support-asp-net-4-5-series.aspx">http://weblogs.asp.net/scottgu/archive/2011/11/27/new-bundling-and-minification-support-asp-net-4-5-series.aspx</a><span id="ms-rterangecursor-end"></span>Stephen Brownhttp://www.blogger.com/profile/03547644424344780488noreply@blogger.com2tag:blogger.com,1999:blog-3120041574977953573.post-58203196138296684602011-11-21T10:45:00.001+00:002011-11-21T10:56:53.104+00:00Output a String With Escape Characters<span style="font-family: Arial, Helvetica, sans-serif;">Not something that is often required, but something that popped up today - how to get the literal output from a String object in C# <strong>including the escape characters</strong>.</span><br />
<br />
<span style="font-family: Arial, Helvetica, sans-serif;">So let's take a String variable declared like this:</span><br />
<br />
<span style="font-family: Arial, Helvetica, sans-serif;">string str = @"c:\temp";</span><br />
<br />
<span style="font-family: Arial, Helvetica, sans-serif;">The literal string is c:\temp, but what if we wanted the underlying escaped string which would look something like this:</span><br />
<br />
<span style="font-family: Arial, Helvetica, sans-serif;">"c:\\temp"</span><br />
<br />
<span style="font-family: Arial, Helvetica, sans-serif;">Not so easy. Fortunately, Google being the fount of all knowledge these days, I put it to work in finding some help and unearthed a neat example from Stack Overflow using an Extension Method:</span><br />
<br />
<span style="font-family: "Courier New", Courier, monospace;"><span style="color: blue;">internal static class</span> <span style="background-color: white; color: #3d85c6;">ExtensionFunctions</span></span><br />
<span style="font-family: "Courier New", Courier, monospace;">{</span><br />
<span style="font-family: "Courier New", Courier, monospace;"> <span style="color: blue;">internal static</span> <span style="color: #3d85c6;">String</span> ToLiteral(<span style="color: blue;">this</span> <span style="color: #3d85c6;">String</span> input)</span><br />
<span style="font-family: "Courier New", Courier, monospace;"> {</span><br />
<span style="font-family: "Courier New", Courier, monospace;"> <span style="color: blue;">var</span> writer = <span style="background-color: white; color: blue;">new</span> <span style="color: #3d85c6;">StringWriter</span>();</span><br />
<span style="font-family: "Courier New", Courier, monospace;"> <span style="color: #3d85c6;">CSharpCodeProvider</span> provider = <span style="background-color: white; color: blue;">new</span> <span style="color: #3d85c6;">CSharpCodeProvider</span>();</span><br />
<span style="font-family: "Courier New", Courier, monospace;"> provider.GenerateCodeFromExpression(<span style="color: blue;">new</span> <span style="color: #3d85c6;">CodePrimitiveExpression</span>(input), writer, <span style="color: blue;">null</span>);</span><br />
<span style="font-family: "Courier New", Courier, monospace;"> <span style="color: blue;">return</span> writer.ToString();</span><br />
<span style="font-family: "Courier New", Courier, monospace;"> }</span><br />
<span style="font-family: "Courier New", Courier, monospace;">}</span><br />
<br />
<span style="font-family: Arial, Helvetica, sans-serif;">To use it simply type str.ToLiteral(); and it will return the string complete with the escape sequence intact.</span>Stephen Brownhttp://www.blogger.com/profile/03547644424344780488noreply@blogger.com0tag:blogger.com,1999:blog-3120041574977953573.post-29844003872793176082011-11-18T08:49:00.001+00:002011-11-18T08:52:35.451+00:00Using Parameter Binding<span id="ms-rterangecursor-start"></span>Nothing new here, but Parameter
Bindings (<a href="http://msdn.microsoft.com/en-us/library/ff630170.aspx">see
Microsoft's article on them here</a>) have been around for a while and more
widely publicised for use with the Data Form and Data View Web Parts. Something
not so widely know is that any web part inheriting from the Data Form Web Part
also has the same functionality available. <br />
<br />
This means useful web parts like Search Results, People Search Results,
Content by Query Web Parts, <span class="ms-rtegenerate-skip" style="white-space: nowrap;"><span class="ms-spellcheck-error ms-rtegenerate-skip" id="rnd73237">Xslt</span></span> List View Web
Part, RSS Aggregator web part and more all have this available to them.<br />
<br />
In SharePoint 2010, apparent new functionality made things like the query
string available to the underlying X<span class="ms-rtegenerate-skip" style="white-space: nowrap;"><span class="ms-spellcheck-error ms-rtegenerate-skip" id="rnd92554">slt</span></span> in a Content
by Query Web Part. The truth is that this was available in 2007 by using
Parameter Binding and the Q<span class="ms-rtegenerate-skip" style="white-space: nowrap;"><span class="ms-spellcheck-error ms-rtegenerate-skip" id="rnd14795">ueryString</span></span>
Location property (as I <a href="http://whats-the-sharepoint.blogspot.com/2011/08/getting-todays-date-and-current-user-in.html">blogged previously</a>).<br />
<br />
What is more useful, is that the Search Results and People Search Results now
include a Parameter Binding property available through the web part toolpane
which means that level of configuration can be done through the UI rather than
hacking away at the underlying web part file. Entering the Parameter Binding is
easy enough using the syntax:<br />
<br />
<ParameterBinding Name="[name]"
Location="[selected location]" /> <br />
<br />
for each property you want to use. The [name] is added
into the Xslt for the Web Part as an Xsl Param and it's then available.<br />
<br />
Useful, simply and quick. Something to bear in mind.<span id="ms-rterangecursor-end"></span>Stephen Brownhttp://www.blogger.com/profile/03547644424344780488noreply@blogger.com0tag:blogger.com,1999:blog-3120041574977953573.post-9581641176351870992011-11-03T08:29:00.003+00:002011-11-03T08:29:40.975+00:00Sandbox Solutions and the Update Panel<span id="ms-rterangecursor-start"></span><span style="font-family: Arial, Helvetica, sans-serif;">There are already several articles on
the web relating to the use of the ASP.NET UpdatePanel in sandbox solutions, so
to add to the mix, here's another one.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">
</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Sandbox solutions and the UpdatePanel: the truth of it is that you cannot use
the UpdatePanel in sandbox solutions. If you try to use it you get an error
stating "The control with ID 'UpdatePanel1' requests a ScriptManager on the
page". Using the ScriptManager.GetCurrent returns null. If you try to add your
own you get an error as you can only have one ScriptManager instance at a time.
You <em>can </em>add your own, however, by adding it as the first control in the
Form.Controls control tree, but even this will most likely break the page unless
you duplicate the exact scripts you may be adding to the page in code - the
symptom of this is the ScriptResource.axd that would normally contains your
scripts returns with a 404.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">
</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">That aside, the reason the ScriptManager.GetCurrent doesn't return the actual
ScriptManager you have added to your page or master page is to do with the way
sandbox solutions replace some objects with its own object types. For instance,
the System.Web.UI.Page object is replaced by the SPUserCodePage object.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">
</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">The question for me is why is the ScriptManager not available? Why not allow
the use of the UpdatePanel in a sandbox?<span id="ms-rterangecursor-end"></span></span>Stephen Brownhttp://www.blogger.com/profile/03547644424344780488noreply@blogger.com0tag:blogger.com,1999:blog-3120041574977953573.post-89127550355782798672011-10-26T09:15:00.003+01:002011-10-26T09:15:23.015+01:00Problems Adding Rest Service Reference in Visual Studio<span id="ms-rterangecursor-start"></span>If you ever have to add a Service
Reference for the SharePoint List WCF Service to a project in Visual Studio
2010 you may encounter a "Bad Request" or "There was an error downloading ..."
type message even though you can view the results of the same service through a
browser.<br />
<br />
The way around this is very simple and resolves the problem, however, in my
mind, this should only really be done on development machines to get around this
issue and not rolled out across a Live installation. What you need to do is go
to IIS and change the authentication methods for the _VTI_BIN folder to disable
Anonymous access. That's it. You can then successfully add the service
reference.<span id="ms-rterangecursor-end"></span>Stephen Brownhttp://www.blogger.com/profile/03547644424344780488noreply@blogger.com2tag:blogger.com,1999:blog-3120041574977953573.post-23295962677162186362011-10-18T15:04:00.003+01:002011-10-18T15:04:52.967+01:00Custom Workflow Actions in SharePoint 2010<div class="ExternalClass2D0B32979085443FAB6269CA007409F2">
<span id="ms-rterangecursor-start"></span>On a recent SharePoint 2010 project I
had the opportunity to look at creating custom Workflow Actions which is a way
to extend the actions already available in SharePoint Designer Workflows. <br />
If I'm honest, the foray was both informative and slightly arduous but
perhaps due mostly to my own inability to type properly and my own lack of
understanding. Let's start by having a look at why we decided to look down this
path.<br />
<br />
<div style="text-decoration: underline;">
<strong>Why a Custom Workflow
Action?</strong></div>
<div style="text-decoration: underline;">
<br /></div>
The project in question required a handful of workflows to be developed, all
of which were prepared and written using SharePoint Designer. The problem was
highlighted early on that we needed to port the be able to package the workflows
up to deliver them across multiple platforms during the development life-cycle.
<br />
<br />
For 2 of the workflows, this didn't pose a problem since they were Reusable
Workflows which lend themselves to just this kind of functionality. The 2
workflow, however, was a List-based workflow and as such it was not able to be
exported as a WSP. The reason the workflow was a List-based workflow was due to
the columns necessary to facilitate the workflow actions - Approval Status being
the culprit in this scenario. As it turns out, the "Approval Status" column is
not visible for anything other than a List-based workflow.<br />
<br />
To allow the workflow to be packaged up meant it had to be a Reusable
Workflow, or we had to provide a work-around. After several attempts to package
the workflow up (using this method <a href="http://ikarstein.wordpress.com/2011/02/10/walkthrough-how-to-move-or-copy-a-sharepoint-designer-2010-list-workflow-to-another-list-on-the-same-site-or-another-site/">http://ikarstein.wordpress.com/2011/02/10/walkthrough-how-to-move-or-copy-a-sharepoint-designer-2010-list-workflow-to-another-list-on-the-same-site-or-another-site/</a> was
a way to export a List-based workflow using the "Export to Visio" and "Import
from Visio" options which did work but didn't provide the hands-off approach we
wanted) we decided to try writing a custom Workflow Action to perform the steps
we required.<br />
<br />
<div style="text-decoration: underline;">
<strong>Nuts and Bolts</strong></div>
<div style="text-decoration: underline;">
<br /></div>
As it turns out, creating a custom Workflow Action is pretty
straight-forward. Create a class, create a publicly declared static method in
the class, and away you go. The first parameter must be a context object - we
were deploying as a User Code Solution so this was of type
SPUserCodeWorkflowContext.<br />
<br />
If you're action doesn't need any parameters, do your coding stuff and then
move on to the feature XML.<br />
<br />
One note here - any typos or spelling mistakes mean that your workflow will
not run. I battled for a long time to debug my workflow with only frustration
as my reward. I eventually searched the SharePoint logs and found that I had
mis-named a parameter so my workflow was never being run. Once I had fixed
that, I was away after I had attached to the SharePoint User Code process.<br />
Here's a couple of walk-throughs I found: <a href="http://msdn.microsoft.com/en-us/library/gg615449.aspx">http://msdn.microsoft.com/en-us/library/gg615449.aspx</a> and
<a href="http://msdn.microsoft.com/en-us/library/ff798499.aspx">http://msdn.microsoft.com/en-us/library/ff798499.aspx</a>.
What I would say is that the first article is more accurate. The second one
makes no mention of the fact that the method you implement for your action
should be a static method - even the example code doesn't show this, so
beware.<br />
<br />
End-to-end, the final solution (which wasn't overly complicated) took about a
day, and at the end I had a fully working custom workflow action which I could
use in my workflows. Looking back, it was actually quite painless and easy and
once you know where to look (i.e. SharePoint logs, debugging etc) it was fairly
rapid.<br />
<br />
<div style="text-decoration: underline;">
<strong>The Fairytale Ending(?)</strong></div>
<div style="text-decoration: underline;">
<br /></div>
Unfortunately, there is no happy ending to this story. I went through a day
of trauma and frustration and came out the other side having happily implemented
my custom workflow action into a reusable workflow. I saved the workflow
through SharePoint Designer to a WSP and thought things were making sense.<br />
<br />
I then moved the workflow to another site collection and installed the WSP
and that's where the story currently ends. It didn't work. Well.....I say that
it didn't work, but I don't really know if I'm honest. The only definition I
have to say it didn't work is the fact that the workflow I had created did not
appear anywhere so I was unable to use it. No doubt I will post further about
this once I've figured out what went wrong here.<br />
<br />
<div style="text-decoration: underline;">
<strong>Final Thoughts</strong></div>
<div style="text-decoration: underline;">
<br /></div>
Looking back at the reasons behind our decision to use a workflow it was
mostly dictated by the approach to the required functionality we had already
started: namely the other 2 reusable workflows. Keeping to the same model for
the third workflow made sense as it followed the same technology instead of
departing in a different direction and introducing custom code instead of
manully created workflow (i.e. event receivers). <br />
<br />
As it turned out, writing a custom workflow action still meant code in order
to achieve the portability we wanted so at that point, perhaps, it would have
been better to write an event receiver. The influence to stick with workflow
came from the technology angle - keeping to the same "hymn sheet" as it were.
Yes, it was custom code, but at least it was still workflow.<br />
<br />
Fortunately, in this scenario we did have a fallback position to backup the
site and restore it, so the time invested was as much for research into this
area, which, if I'm honest, was time well spent.<span id="ms-rterangecursor-end"></span></div>Stephen Brownhttp://www.blogger.com/profile/03547644424344780488noreply@blogger.com0tag:blogger.com,1999:blog-3120041574977953573.post-62481580791462514272011-09-12T08:44:00.004+01:002011-09-12T08:46:07.894+01:00Text Links vs Image Links (SEO)<span id="ms-rterangecursor-start"></span><span style="font-family: Arial, Helvetica, sans-serif;">A slight departure from the normal SharePoint articles I normally write, so from a completely HTML design point of view, here's an interesting question that I've asked myself several times and only answered through my own experience and through quite a few assumptions.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">If you have an image displaying text, how does that compare in terms of SEO (and by SEO I'm not referring to SharePoint search ranking here) against using the actual text itself in a link. To give an example, you may display a link using HTML markup like this:</span><br />
<br />
<span style="font-family: Arial, Helvetica, sans-serif;"><a href="/mylink/"><img src="thisisalink.jpg" alt="this is a link"/></a></span><br />
<br />
<span style="font-family: Arial, Helvetica, sans-serif;">or like this:</span><br />
<br />
<div><span style="font-family: Arial, Helvetica, sans-serif;"><a href="/mylink/">this is a link</a></span><br />
<br />
</div><div><span style="font-family: Arial, Helvetica, sans-serif;">Whichever way you decide, which one ranks better? </span><br />
<br />
</div><div><span style="font-family: Arial, Helvetica, sans-serif;">It seems there is no definitive answer, but there are quite a debates about the whole subject. I read an article recently that helps to clarify: <span id="ms-rterangepaste-start"></span></span><a href="http://www.kingrosales.com/2009/04/seo-debate-text-links-vs-image-based-links/"><span style="font-family: Arial, Helvetica, sans-serif;">http://www.kingrosales.com/2009/04/seo-debate-text-links-vs-image-based-links/</span></a><span style="font-family: Arial, Helvetica, sans-serif;"> but even this makes some assumptions. Having said that, in my experience, I have always used text and I think on the logic provided in the article, I feel as though that's probably the right way to go.<span id="ms-rterangecursor-end"></span></span></div>Stephen Brownhttp://www.blogger.com/profile/03547644424344780488noreply@blogger.com0tag:blogger.com,1999:blog-3120041574977953573.post-87863572188652193992011-09-02T15:54:00.004+01:002011-09-02T15:57:54.900+01:00Finding Feature IDs<span id="ms-rterangecursor-start"></span><span style="font-family: Arial, Helvetica, sans-serif;">If you're anything like me, sometimes you need to find out what the ID of a SharePoint feature is and it can be something of a trial to locate the exact ID, especially if there's no handy SharePoint Server to remote onto and then go and search the FEATURES directory. So, a much easier way to get the ID of a feature is to use the Developer Toolbar (if you're using IE). Turn on the developer toolbar and select the Activate button of the feature you're interested in using the element selector. The button is enclosed in a DIV which has an ID attribute as follows:</span><br />
<br />
<img alt="ietoolbar_featuresexample.jpg" setheight="52" setwidth="588" src="http://mysite.silversands.co.uk/my/browns1/Blog/Lists/Photos/ietoolbar_featuresexample.jpg" style="margin: 5px;" /><br />
<span style="font-family: Arial, Helvetica, sans-serif;">As you can see from the image, the ID attribute of the DIV is a GUID, and this GUID is the Feature ID. Simple.</span><br />
<span id="ms-rterangecursor-end"></span>Stephen Brownhttp://www.blogger.com/profile/03547644424344780488noreply@blogger.com0