Monday, July 22, 2013

SharePoint 2013 – Oh wherefore art thou Blank Site Template

Copyright from: itproafrica.com/technology/

Blankman this one’s for you :)
Just because it’s about the Blank site template.
If you upgrading or just looking to create a blank site in SharePoint 2013 you will notice its not there by default.
Have no fear for it still exists in the web template gallery.
To have this activated on you site.
* Browse to : C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\TEMPLATE\1033\XML* Edit file : WEBTEMP.XML
* Locate this line of code :
Not really :P
* You will see the blank site when you create a site collection via CA
* But not when you create a site in that site collection or subsite
* To activate for sites or sub sites
* Browse to your site
* Browse to site settings
* Under look and feel select Page layouts and site templates
* Under the sub site templates select Blank Site all and add it to the window on the right
Now you are done
Happy Blank site creation

Friday, July 19, 2013

Offline install of Office Developer Tools for Visual Studio 2012


*********************************************  Update - 3/12/2013  ******************************************
Microsoft has release RTM versions of some of the items above and the links have been update.
****************************************************************************************************************

If you are getting started with App or Microsoft SharePoint Server 2013 development, you will notice that there is no option in Visual Studio 2012 when you first install it.
clip_image002
In order to get the templates into VS, you need to install Microsoft Office Developer Tools for Visual Studio 2012 which can be found here: http://www.microsoft.com/visualstudio/eng/office-dev-tools-for-visual-studio (direct install : http://aka.ms/OfficeDevToolsForVS2012).
Unfortunately, this leverages the Microsoft Web Platform Installer which does not play well in closed environments. The Microsoft Web Platform Installer will install the following items:
Microsoft Identity Extensions
Workflow Manager Client 1.0
Microsoft Exchange Web Services 2.0
Microsoft Windows Identity Foundation SDK 4.0
Microsoft SharePoint Client Components
Microsoft Workflow Manger Tools
Cumulative Update 1.0 for Microsoft Workflow Manager Tools

Open XML SDK 2.5
Microsoft Visual Studio Tools for Office Runtime
Microsoft LightSwitch HTML Client Preview 2 for Visual Studio 2012
Microsoft Office Developer Tools for Visual Studio 2012 - Preview 2
Microsoft Office Developer Tools for Visual Studio 2012 - RTM

Once these items have been downloaded and installed on your development machine and double-click to install them, you will see that there is the option to create Apps and other items for Office and SharePoint 2013.
clip_image004
Unfortunately, if you try to create a project for any of these new fun items, you will get the following error:
An error occurred whilst trying to load some required components, Please ensure the following prerequisite components are installed.
Microsoft Web Developer Tools
Microsoft Exchange Web Services"
The problem is that the Microsoft Web Platform Installer adds parameters when installing the Microsoft Exchange Web Services that must be used in order to get around the error. If you have already installed the Microsoft Exchange Web Services, uninstall it from Control Panel and then open up a command prompt. Navigate to the location of EwsManagedApi32.msi. In the command prompt, run
EwsManagedApi32.msi addlocal="ExchangeWebServicesApi_Feature,ExchangeWebServicesApi_Gac"
clip_image006
Once that has finished installing, open up Visual Studio 2012 and enjoy creating apps for Microsoft SharePoint Server 2013.

Thursday, July 18, 2013

Easy way to deploy .resx (resource) files under App_GlobalResources folder in SharePoint 2010


copyright from: blogs.msdn.com/b/yojoshi

Resource files in SharePoint 2010

Resource files are mainly used for localization of the custom solution.
While working with SharePoint 2010, many times the customizations need to be localized and hence, it means that developers have to play around the language specific resx files. Deployment of resx files through the SharePoint solution can be achieved using SharePoint mapped folder named "Resources". However the files those goes under this path can be accessed using SPUtility.GetLocalizedString function. Majority of the times, you may have customizations related to the user interface which are declarative. SharePoint 2010 is based on ASP.NET technology so for, any tags related to resources the resx files will be searched in App_GlobalResources folder located under intepub\wwroot\wss\<> folder hierarchy.
This puts additional overhead of deployment to the developer who want to use the traditional ASP.NET way of localizing UI resources. As, we need to ensure that the resx files should be deployed under both 14 hive and App_GlobalResourcesfolders.
There are multiple ways to deploy the resource files. Following are few of them
  • Write an event handler to copy resx files
  • Custom timer job
  • PowerShell Script as a part of deployment
  • Manual copy and so on....
But what about the solution uninstallations, upgrades and moreover if you have multi server environments, manual deplooyment of resx files is more tedious and erroneous.
SharePoint 2010 Projects supports feature called as "Elements". Using Elements we can deploy number of files at specific locations. Following solution makes use of Elements to deploy resx files to App_GlobalResources folder. Few advantages of this are as below
  • No need to write custom code for deployment
  • Resx files are packaged as a part of WSP
  • No need to worry about upgrades and uninistallations its done automatically in SharePoint way
  • Works perfectly on multi server enviornment
  • No manual steps

 How to do it?

  • Create new Empty SharePoint 2010 Project name it as ResxDeployment
  • Choose a local site for debugging and, choose deployment type Deploy as farm solution
 
  • In Solution Explorer, right click on ResxDeployment project and Add SharePoint Mapped Folder
  • In Add SharePoint Mapped Folder dialog box, choose Resources and click OK
     
  • In Solution Explorer, right click on ResxDeployment project and Add New Item
  • Add few sample resx files to the Resources folder
 
  • In Solution Explorer, right click on ResxDeployment project and Add New Item. Add Empty Element and name it as required for e.g. App_GlobalResources
 
  • In Solution Explorer, click on Show All Files icon to view all files. Open SharePointProjectItem.spdata files located under App_GlobalResources node
 
  • Add the relavent information to the xml file which includes Source, and Type of the file. The type should be set toAppGlobalResource and source should be a relative path of resx file. Following is the example
 
 
  
  
  
  
  
  
  
  
   
  • In Solution Explorer, right click on ResxDeployment project and choose Deploy
  • If everything goes well the solution will be deployed on given web application. Also, you can verify that the resx files are deployed under App_GlobalResources and 14\Resources folders

Points to be noted :

  1. Resource files are deployed at two diffrent locations. You can directly add resx files to only elemets folder if needed.
  2. There is no need to copy the files from Resources mapped folder to App_GlobalResources element folder in Visual studio. There is only one copy of resx file hence, no need to worry about multiple location changes
  3. For every additional resx file, SharePointProjectItem.spdata file should be updated otherwise the file will not be copied to App_GlobalResources folder of web application
  4. Please set the Scope of the Feature that includes this module as relavent. It is preferrable to set, Application Level Scoped
In this way, by using OOTB SharePoint features we can deploy resx files to App_GlobalResources folder.