Posted on:
Categories: PowerShell;SharePoint
Description:
There doesn't seem to be a direct way to set the SharePoint 2013 result page settings shown below via PowerShell. I was grateful to find a post, by jshidell, showing how to do this in SharePoint 2010, but the property names for SharePoint 2013 are different. The three settings above are held in the web's Properties collection in a property named SRCH_SB_SET_WEB, where they are described as a JSON object "Inherit"false,"ResultsPageAddress"null,"ShowNavigation"true One other gotcha is that the property key is case sensitive. If you try to add it via the Add method of the properties collection, the key is added but automatically converted to lower case and therefore ignored. The SPWeb AddProperty method succeeds because it does not do the auto convert to lower case. Here is a function that will set that property correctly. function SetSearchSettingsForWeb Param ( [Microsoft.SharePoint.SPWeb]$web=$(Throw "SPWeb parameter missing 'web'"), [bool] $inherit=$(Throw "Boolean parameter missing 'inherit'"), [string]$resultsPageAddress=$(Throw "String parameter missing 'resultsPageAddress'"), [bool]$showNavigation=$(Throw "Boolean parameter missing 'showNavigation'") ) try Write-Host "Assigning search settings for web " -ForegroundColor Yellow -NoNewline $SEARCH_SETTINGS_PROPERTY_NAME = "SRCH_SB_SET_WEB" # Express the settings as a JSON object $settingsObj = @ $settingsObj.Inherit = $inherit $settingsObj.ResultsPageAddress = $resultsPageAddress $settingsObj.ShowNavigation = $showNavigation $settingsObjAsJSON = ConvertTo-Json $settingsObj -Compress # Add or update an entry in the web properties collection if (!$web.AllProperties.ContainsKey($SEARCH_SETTINGS_PROPERTY_NAME)) Write-Host "- adding new entry " -ForegroundColor Yellow -NoNewline $web.AllowUnsafeUpdates = $true $web.AddProperty($SEARCH_SETTINGS_PROPERTY_NAME, $settingsObjAsJSON) $web.Update() else Write-Host "- updating entry " -ForegroundColor Yellow -NoNewline $web.AllowUnsafeUpdates = $true $web.SetProperty($SEARCH_SETTINGS_PROPERTY_NAME, $settingsObjAsJSON); $web.Update() Write-Host $("Done") -ForegroundColor Green catch Write-Host " .. " $_.Exception.Message -BackgroundColor DarkRed -ForeGroundColor White Call the above function as follows SetSearchSettingsForWeb -web $web -inherit $false -resultsPageAddress $null -showNavigation $true




Posted on:
Categories: SharePoint
Description:
​My Add New Item link went missing the other day and I spent hours looking for it. You see, I created a Custom List template using Visual Studio 2012’s new List item element. It added a list template and a list instance to my SharePoint 2013 project. I deployed the project to my publishing site and added this list into a HTML field within a publishing page. Here whether I set the List View Toolbar Type to "Full Toolbar" or "Summary Toolbar", the Add New Item link refused to show. If I create a custom list via the browser UI and add it to a publishing HTML field, I can see the Add New Item link when I set the Toolbar Type to "Summary Toolbar". This pointed me to take a look at the list schema generated by Visual Studio 2012 and I noticed something was missing. List schema generated by Visual Studio 2012 based on a Custom List... <View BaseViewID="0" Type="HTML" MobileView="TRUE" TabularView="FALSE"> ... <Toolbar Type="Standard" /> Out-of-the-box list schema for a Custom List<View BaseViewID="0" Type="HTML" MobileView="TRUE" TabularView="FALSE"> ... <Toolbar Position="After" Type="Freeform"> <IfHasRights> <RightsChoices> <RightsGroup PermAddListItems="required" /> </RightsChoices> <Then> <HTML><![CDATA[<div class="tb"><img src="/_layouts/15/images/caladd.gif?rev=23" alt="" />&#160;<a class="ms-addnew" id="idAddNewItem" href="]]></HTML> <URL Cmd="New" /> <HTML><![CDATA[" onclick="javascriptNewItem(']]></HTML> <ScriptQuote NotAddingQuote="TRUE"> <URL Cmd="New" /> </ScriptQuote> <HTML><![CDATA[', true);javascriptreturn false;" target="_self">]]></HTML> <HTML>$Resourcescore,addnewitem;</HTML> <HTML><![CDATA[</a></div>]]></HTML> </Then> </IfHasRights> </Toolbar> I replaced <Toolbar Type="Standard" /> with the toolbar definition above and got my Add New Item link back. Schemas generated for custom document libraries have similar issue. Fixing it is easier though. You only need to remove <Toolbar Type="Standard" /> as the generated schema already contains the toolbar definition a few lines below it. By the way, this issue seems to happen in publishing pages only. If you are using these custom libraries and lists in web part pages, the Add New Item/Document link shows normally.




Posted on:
Categories: SharePoint
Description:
​SharePoint 2013 introduced Content By Search web part (CSWP) that leverages the power of search and display template to show dynamic content in a formatted fashion. One of the many uses is to roll up list items across your lists and/or sites. For a list or library, there is an option to launch new, edit and display forms in a dialog. The option is available at List/Library Settings > Advanced Settings > Dialog. What if we want to do the same for items returned by CSWP? Within your custom display template, add the following javascript before rendering of item html EnsureScriptFunc("sp.ui.dialog.js", "SP.UI.ModalDialog.showModalDialog", null); In the item html, modify the link as follows <a … onclick="javascriptSP.UI.ModalDialog.showModalDialog( url '_#= linkURL =#_', title '_#= $htmlEncode(line1.defaultValueRenderer(line1)) =#_' ); return false;" … >_#= line1 =#_</a> Now when you click on a result item returned by CSWP, the item form should show up in a modal dialog.




Posted on:
Categories: SharePoint;CodePlex
Description:
​Web Part property attributes allow you to customize the behaviour of web parts in the property pane. There are 3 commonly used attributes that take UI strings and show them in the property pane. They are [Category("Group Title")] - The section title the custom property will be grouped under. Default is Miscellaneous. [WebDisplayName("Property Display Name")] – Display name for the property. If this attribute is not specified, the actual property name will be displayed. [WebDescription("Property Description")] - Tool tip for the custom property. In my last blog, I wrote about using resource files to centralize definitions of UI strings. The Group Title, Property Display Name and Property Description are UI strings. So how do we make use of resource strings in these property attributes? The trick is to create your own classes that inherit these attribute classes and override the corresponding method or property to return resource strings. For Category, create a new class that inherits CategoryAttribute and override the GetLocalizedString method.[AttributeUsage(AttributeTargets.All, AllowMultiple = false, Inherited = true)] public class SLCategoryAttribute CategoryAttribute private readonly string _classKey; public SLCategoryAttribute(string classKey, string resourceKey) base(resourceKey) _classKey = classKey; protected override string GetLocalizedString(string resourceKey) var value = CommonHelper.GetResourceString(_classKey, resourceKey); if (String.IsNullOrEmpty(value)) return base.GetLocalizedString(resourceKey); else return value; Within GetLocalizedString, return value of a resource string from a SharePoint resource of your choice. Here I pick provisioning resource and use SPUtility.GetLocalizedString which I have put in a common helper class.internal class CommonHelper internal static string GetResourceString(string classKey, string resourceKey) try return SPUtility.GetLocalizedString( String.Format("$Resources0", resourceKey), classKey, SPContext.Current.Web.Language); catch return resourceKey; For WebDisplayName, create a new class that inherits from WebDisplayNameAttribute and override the DisplayName property[AttributeUsage(AttributeTargets.All, AllowMultiple = false, Inherited = true)] public class SLWebDisplayNameAttribute WebDisplayNameAttribute private readonly string _classKey; private readonly string _resourceKey; public SLWebDisplayNameAttribute(string classKey, string resourceKey) _classKey = classKey; _resourceKey = resourceKey; public override string DisplayName get var value = CommonHelper.GetResourceString(_classKey, _resourceKey); if (String.IsNullOrEmpty(value)) value = _resourceKey; return this.DisplayNameValue = value; For WebDescription, create a new class that inherits from DescriptionAttribute and override the Description property[AttributeUsage(AttributeTargets.All, AllowMultiple = false, Inherited = true)] public class SLWebDescriptionAttribute DescriptionAttribute private readonly string _classKey; private readonly string _resourceKey; public SLWebDescriptionAttribute(string classKey, string resourceKey) _classKey = classKey; _resourceKey = resourceKey; public override string Description get var value = CommonHelper.GetResourceString(_classKey, _resourceKey); if (String.IsNullOrEmpty(value)) value = _resourceKey; return this.DescriptionValue = value; To use these new attributes, create a SharePoint provisioning resource in your project (see my previous blog). Now comes the final step. In your web part class, add the new attributes and pass in the resource file and resource key as the parameters.[ToolboxItemAttribute(false)] public class HelloUserWebPart WebPart [WebBrowsable(true)] [Personalizable(PersonalizationScope.User)] [SLWebDisplayName("Softlanding.SharePoint", "WPDisplayNameUserName")] [SLWebDescription("Softlanding.SharePoint", "WPDescriptionUserName")] [SLCategory("Softlanding.SharePoint", "WPCategoryConfiguration")] public string UserName get; set; And you are done. Edit the web part in the browser and your resource strings should display in the properties pane. I packaged these custom attribute classes into a separate project so it is ready to be added to any SharePoint solutions. In my SharePoint projects I just start using these attributes right away without defining them every time. To download this project from CodePlex please go here.




Posted on:
Categories: SharePoint
Description:
​I like using resource files. Not only are they essential for multi-lingual web development, it is good code practice to separate UI from business logic and centralize definitions of UI strings. I will not be going into details what resource files are but an excellent introduction can be found here. Instead I will focus on how we use them in SharePoint. There are a few different ways to use resources in SharePoint depending on where they are being used. SharePoint resources are generally separated into 3 categories Embedded, Provisioning and Application (Runtime). Embedded resources As the title suggests, they are resource files that are embedded in an assembly. They can be used in any vanilla ASP.Net sites. To add an embedded resource in Visual Studio, you right click a SharePoint project and add New Item. Under General category, select Resources File. After the file is added, if you select the file, Build Action in the Properties window should say Embedded Resource. Apart from Provisioning resources which I will be describing next, all resource files are added as Embedded Resource by default. To reference a resource string, use the following in your code behinds or classes Resource.MsgEmbeddedResource where Resource is the name of the resource file without the file extension and MsgEmbeddedResource is the resource key I created for this example. Embedded resources are great for development as Visual Studio provides intellisense for path to resource strings. Provisioning resources They include those that are used during provisioning of elements like features, list templates etc. To add a provisioning resource in Visual Studio, you first need to add a SharePoint Mapped Folder to SharePointRoot\Resources. Select the newly added mapped folder and add New Item. Under General category, select Resources File. I usually name my resource file same as my project name. This time you will notice the Build Action is set to Content. As far as I know there is nothing preventing you from changing the Build Action to Embedded Resource to make it both an embedded and provisioning resource. To reference a resource string, use the following in your code behinds or classes SPUtility.GetLocalizedString("$ResourcesMsgSharePointGlobalResource", "Softlanding.SharePoint", SPContext.Current.Web.Language); where Softlanding.SharePoint is the name of the resource file without the file extension and MsgSharePointGlobalResource is the resource key I created. As mentioned earlier, provisioning resources can be used in provisioning elements. For example you can use them in feature titles and description. Select a feature and in Properties specify the Default Resource File, in this case Softlanding.SharePoint. In feature title and description, you can then enter Title $ResourcesFeatureTitleAssets Description $ResourcesFeatureDescriptionAssets where FeatureTitleAssets and FeatureDescriptionAssets are resource keys I created for this example. If you don’t specify the Default Resource File, you need to include it like the following Title $ResourcesSoftlanding.SharePoint,FeatureTitleAssets Description$ResourcesSoftlanding.SharePoint,FeatureDescriptionAssets Visual Studio also has an Add Feature Resource option that adds a resource file to a feature. Resource strings will be read from it if Default Resource File is not specified. Application (Runtime) resources Application (Runtime) resources include those that are used by application pages (aspx) and user controls (ascx). They are stored in the root App_GlobalResources folder C\inetpub\wwwroot\wss\VirtualDirectories\port\App_GlobalResources. Like embedded resources they can be used in any vanilla ASP.NET web sites. Here comes the SharePoint twist. When a SharePoint web application is created, all resource files in the SharePoint Root\Config\Resources folder are copied to the root App_GlobalResources folder. If you would like a custom resource always available to new web applications, you would deploy it to the SharePoint Root\Config\Resources folder. However this custom resource file will not get copied over automatically to the root App_GlobalResources folder of existing web applications. In majority of cases, deploying resource files to the root App_GlobalResources folder is sufficient. To do that, add an Empty Element to your SharePoint project. Delete elements.xml. Select the empty element and add New Item. Under General category, select Resources File. After the file is created, select it and in Properties change Build Action to Content. Expand Deployment Location and clear the value in Path. Change Deployment Type to AppGlobalResource. To reference a resource string, use the following in your code behinds or classes HttpContext.GetGlobalResourceObject("Softlanding.SharePoint.Global", "MsgAppGlobalResource").ToString() where Softlanding.SharePoint.Global is the name of the resource file without the file extension and MsgAppGlobalResource is the resource key I created. To reference a resource string in application pages and user controls, use the following <%$ResourcesSoftlanding.SharePoint.Global,MsgAppGlobalResourceClient%> Normally I would html encode the string as well so it would become something like <SharePointEncodedLiteral runat="server" text="<%$ResourcesSoftlanding.SharePoint.Global,MsgAppGlobalResourceClient%>" EncodeMethod="HtmlEncode"/> Just a point of note. User control in Visual Web Parts are compiled. We can always reference resource strings in the ascx.cs code behind and set values to controls like labels or literals declared in the ascx file. Alternatively we can change the Build Action for Application resources to Embedded Resource. Then in the ascx file, we reference a resource string like <%= Softlanding.SharePoint.AppGlobalResources.Softlanding_SharePoint_Global. MsgAppGlobalResourceClient %> Note the periods in the name of Application resource file are changed to underscores. Closing Here is what the final Visual Studio project looks like with the 3 types of resource files added In my next blog, I will show you how to use resource strings in web part property attributes.




Posted on:
Categories: SharePoint
Description:
You may have come across the spell check feature while authoring content in the page content or content editor web part. The one problem is that the spell check may tell you a word is misspelled just because it is not in the SharePoint dictionary. For example if I type in "Softlanding" in a content editor web part and run the spell check (shown below), it will underline the word with a red line, letting you know it is a misspelled word. So how can we let SharePoint know that this is not a misspelled word, rather it is an actual known term in our organization? This can be done very easily following the steps below At the root level of your site create a document library called "Spelling" (make sure to name the document library exactly as listed here) On your desktop create a new text file called "Custom Dictionary", so that the file name looks like "Custom Dictionary.txt" (make sure to spell the file name exactly as listed here) Open the "Custom Dictionary" text file and in this file type in the words you would like NOT to be considered misspelled words (please note that the words are case sensitive so I would have a separate entry for Softlanding and softlanding, and also please make sure each word is listed on a new line) Upload the "Custom Dictionary.txt" file to the "Spelling" document library (make sure the document is checked in and published And now, when authoring content, the words specified in the "Custom Dictionary" file will not be considered as spelling errors. You can continue to add words to the "Custom Dictionary" file to continuously address words or acronyms that are not recognized by SharePoint. Please note This works for both SharePoint 2010 and 2013




Posted on:
Categories: SharePoint;Business
Description:
​Sometimes when we are immersed in doing what we do day to day, we forget about the bigger picture. And if we do that in the world of information technology, we can potentially lose track of the direction we are headed in. Losing track of the direction your industry is headed can be a dangerous thing all for its own reasons but for our purposes let’s focus on the realm of intranets. The Nielsen Norman Group (www.nngroup.com) are leaders in the user experience field. They conduct research and release reports on user experience. One of their annual reports is the 10 Best Intranets report. Submissions are made to the Nielsen Norman Group and they select the top 10 best intranets of that year based on several criteria. Reviewing reports like these provide great insight into what others out there are doing, especially getting a perspective outside of North America, with winning organizations being from countries like Switzerland, Ireland and Saudi Arabia. I won’t go into the details about each winner and what they specifically did right, you’ll have to read the report for that, but what I will do is share with you what I have taken away from this report. Why do we need to know this? Some of you may be wondering, how does this help me doing my job from day to day or designing an intranet? Well here are some of the reasons I have taken time out to research this Knowledge of upcoming trends for intranets Be able to create solutions that are innovative Provide new suggestions to our clients Better the solution delivery process What do we need to know? After running through the report and the winners, there were some commonalities that presented themselves. These are some of the points that are important for us to know 70% of winners used SharePoint The intranet project team size has doubled! Average team member size is increase up to 18 members (AT&T had 107 Inception to launch average creation time is 3.5 years, this year's average is 2.3 years In 2004 4/10 winners used external consultants, this is up to 8/10 last year External consultants are increasingly being used due to Specific skill Add credibility to employee perspective The best intranets involved people from the organization at the inception stage of the intranet (very beginning) Content Owners and Writers were met with early on in order to cut, edit and/or provide feedback for content This gave adequate time for migrating, testing and optimizing content What’s trending? From taking a look at the winners and what they built we get a sense of where the trends are headed for intranet development. The following list outlines some of these trends Mega menus- Heavily customized menus that provide additional navigation cues for end users and enhanced usability features Video channels- Video capabilities providing end users with things like on demand training Focus on personal profile pages for employee directories Personalized homepages Feeds from organization's Twitter, Facebook, and LinkedIn accounts on home page Using facets/filters for search Actionable links in people search suggestions (that let users email, call, bookmark contact) Only 1 winner had a dedicated mobile version of the intranet (AT&T), this growth has seemed to pause Common Barriers Data security concerns Difficulty choosing a platform Lack of resource to create design Uncertainty whether to implement full feature set or a sub set via an app What lessons can be learned? There are definitely some things that we learned by reviewing the 10 Best Intranets Report. Here are some important points to note in order to have a successful intranet implementation Plan to customize SharePoint to get best benefits (bringing in external consultants necessity) Workers need to be educated around collaboration spaces (how and when to use sites) Branding takes time and most often a SharePoint specialist Keep permissions simple Employees need guidance on how to use new features There are two ways to learn, either by making your own mistakes or learning from others. By studying reports like these we can see what others have done right or wrong and tweak our own methods of doing things. By reviewing and studying these “lessons learned” we have adjusted our project delivery process and methodology to make sure we deliver intranets that are usable, well adopted and innovative.




Posted on:
Categories: Managed Services;Business
Description:
Softlanding is excited to announce a new promotion designed for Metro Vancouver and lower mainland small and medium-sized businesses, offering a free professional 3rd party technical assessment of their IT systems. With there being a flood of security breaches in recent news, we are happy to provide this service to our local business community, leveraging our many years of IT experience and our team of highly trained staff to prevent the continued attack against SMBs and their customers.Business owners, executives, and managers are often given reassurances by their IT staff or tech support providers that all their systems are secure. While it is the intent of most IT departments or IT support providers to maintain secure systems, an extensive workload comprising of support tasks and project deployments can often distract from the simple maintenance tasks that ensure the stability of your IT environment. We often find that regular system updates are not being installed, which are designed to fix vulnerabilities that are being exposed by hackers; antivirus and anti-malware definitions are out of date, and backups are either not occurring or are error-filled, creating disaster recovery nightmares for many businesses.Being buffered from the realities of the IT situation is no excuse for ownership/execs when a security breach occurs exposing their company and customers. This idea was hammered home recently when we took over ongoing IT support and IT management functions for organization based in downtown Vancouver. This organization was being serviced by a reputable local IT services provider for the previous 2 years. What we uncovered was shocking to say the least; as part of our new client onboarding process, we essentially uncovered a ticking time bomb Servers and key Microsoft applications weren't patched for almost 2 years Antivirus software across the entire network hadn’t been updated in months Backups weren't occurring for nearly 90 daysThese are just a few of the things we uncovered with this particular client. Despite the best intentions of the IT departments, and IT Managers we work with, or the IT service providers we take over from, we run into these types of glaring gaps more often than not. The scary thing is that the more systems there are, the more likely there are gaps in the way systems are maintained, and most people don't even realize what's happening in the background.This is why we wanted to offer Metro Vancouver and lower mainland-based SMBs the opportunity to receive a free technical assessment. This involves a 1-hour onsite technical deep dive of your environment and a follow up meeting to present our findings. There are absolutely no obligations here, our only interest is to see that our business community and the people they serve are protected. If you're interested in booking an assessment, please Contact Us to book a time with one of our Senior IT Consultants.




Posted on:
Categories: Managed Services
Description:
It's amazing what some people can (or at least attempt to) accomplish these days with smoke and mirrors. Anyone and their dog can fire up a decent looking website and paint the picture of being a corporate behemoth of a company yet in reality, operate out of their mom's basement suite. This is why they say never judge a book by its cover, whether it be a positive or negative impression. You need to look past the first layer of marketing/branding you encounter and dig deeper. The choice of an IT support partner can have a major impact on your business. A solid IT services partner can help propel your organization to new levels by allowing you to better focus on your core business instead of worrying about business tools like computers and technology. Conversely, partnering with the wrong organization can just as easily set you back. You can miss out on opportunities to maximize your existing investments or effectively map technology to best support your business goals Don't get hypnotized A glitzy website with client reviews that read like a love story can be enticing, but how do you separate fact from fiction? How many of those raving client reviews are from active clients? How many of those are family members or close friends? On the surface, you have the ability to tap into an oasis of amazing services but behind the scenes, it's Armageddon with staff and client casualties everywhere. Ask the right questions, collect evidence Once you've avoided hypnosis, it's time to dig deep! Get to know the people that you would be working with, find out more about the business and its history, and talk to a sampling of clients/staff to truly understand the real business, versus what's presented on the marketing end of the spectrum. Here's a few things you should focus on Do they showcase their key people on the website? Lookup their address on Google or Bing maps and checkout the street view Ask how many clients they have lost in the last 12-months and how many have they added. Client attrition is a sure sign that sales and execution are not in synch Ask the average tenure of their support staff. Staff turnover is disruptive to both the partner and you as their client Digging past the veneer will help you gauge stability, attrition, and integrity on the reality of the business versus what is being portrayed through online marketing initiatives. You need evidence of success and stability, especially when it comes to working with a provider that is going to provide your organization with critical services such as IT support and management. In summary, there are a lot of IT service providers out there that claim to top notch IT services. On the surface they look like reputable, experienced providers but sadly, many are composed of 2-5 people or have employee/client turnover similar to the amount of times it rains in Vancouver. You need to make your way past the fluff and the dog and pony show that some providers walk you through. Unravel that marketing layer and you'll reveal the true integrity of a brand which will allow you to make the right decision when partnering with an IT services partner.




Posted on:
Categories: SharePoint
Description:
Creating custom search display templates in SharePoint sites differs quite a bit depending on whether the publishing feature is enabled or not. In a non-publishing site, the master page gallery's Display Templates folder will contain only .js files. There seems to be very little guidance on how to copy and customize these pure javascript files. If you simply copy a display template to a new item and try to make use of it, you will encounter an error such as the following Template '~sitecollection/_catalogs/masterpage/Display Templates/Search/Custom_Item_Picture.js' not found or has syntax errors. (LoadTemplate ~sitecollection/_catalogs/masterpage/Display Templates/Search/Group_Default.js) Here are some tips on how to work with these files. You can use the tool of your choice. I decided to use nothing but Notepad and a browser. Work with the UNC path to the site collection's master page gallery. Map a drive to it if you prefer. E.g. \\intranet.somewhere.com\sites\abc\_catalogs\masterpage. In Windows Explorer, copy the relevant existing display template (such as Item_Default.js) to an item of your own name. Alternatively work via the browser to download and then upload a copy. Navigate to the master page gallery in the browser and set the new item's properties to be precisely the same as the item you copied from. Open the new display template, from the UNC path or mapped drive, in an editor such as Notepad. Within the file content you will find several references to the file's own name (such as Item_Default). Replace these with references to your new file name. You can do a find-replace but be careful because at least one of the references excludes the '.js' extension - make sure you catch all of these occurrences. At this point you should save and test that everything is working by referencing your new template from an appropriate search artifact, such as a result type. If all is well, you can then start altering the details to display things differently.