Category Archives: SharePoint Development

SharePoint 2013 Hosting – ASPHostPortal.com :: Binding SAP UI 5 aka Open UI 5 Table with List data from SharePoint 2013 REST API

Binding SAP UI 5 aka Open UI 5 Table with List data from SharePoint 2013 REST API

ahp_freehostSHP(1)

SAP UI 5 aka Open UI 5 is a new development framework available for SAP developers to expose and consume SAP data as JSON objects via REST API calls. Since it is a JavaScript UI library like jQuery UI, this can be used with any client side application that can make use of JSON

To be frank, this is the biggest client side library I have used so far. When extracted, the runtime files alone comes to 55 MB and the total number of files counts to 4K +
This is huge and bit complex and I am using it for quite some time for one of my SharePoint Project as it is heavily dependent on SAP data and UX design.
This article provides details on how to use SAP UI 5 in a SharePoint Application

Pre-requisites

  1. Download Open UI 5 runtime from http://sap.github.io/openui5/
  2. Extract the content and move it to a new folder named sap-ui5 in layouts folder of 15 hive ( In a typical installation the folder path would be C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\TEMPLATE\LAYOUTS)
  3. jQuery library to perform REST calls

For this demo, I have directly placed all the files under layouts folder.
Packaging and deploying it through a WSP solution or uploading it to Style Library or any other doc lib directly are also other alternative approaches.
I have also created a new list named “Employees” with columns Title and Location

Note: This article on developing SAP UI 5 applications in Visual Studio provides more details on how to create a basic Open UI 5 application with Visual Studio

Steps

  1. Create a new SharePoint Page
  2. Add a Script Editor Web part to the page
  3. Copy and paste the below code in Script Editor
<script>
 	$.getJSON("/_vti_bin/listdata.svc/Employees", function (data) {
 
 		var sTable = new sap.ui.table.Table({
 			width: "500px",
 			visibleRowCount: 5
 		});
 		sTable.setTitle("Employee Details");
 
 		sTable.addColumn(new sap.ui.table.Column({
 			label: new sap.ui.commons.Label({ text: "Employee Name" }),
 			template: new sap.ui.commons.TextView().bindProperty("text", "Title"),
 		}));
 
 		sTable.addColumn(new sap.ui.table.Column({
 			label: new sap.ui.commons.Label({ text: "Location" }),
 			template: new sap.ui.commons.TextView().bindProperty("text", "Location"),
 		}));
 
 		var oModel = new sap.ui.model.json.JSONModel();
 		oModel.setData({ modelData: data.d.results });
 		sTable.setModel(oModel);
 		sTable.bindRows("/modelData");
 		sTable.placeAt("Emp");
 
 	}, function () { alert('failed'); })
 </script>
 
 <div id='Emp'></div>

Note : If you have placed the libraries in a different location, change the URL before pasting it in the script editor

image.axdEverything is in place you would be able to view a grid similar to the one displayed above

SharePoint 2013 Hosting with ASPHostPortal.com – How To Migrate Content Database From SharePoint 2010 To SharePoint 2013

Migrate Content Database From SharePoint 2010 To SharePoint 2013

In this article, we will take you through the database migration process from SharePoint 2010 to SharePoint 2013. An overview of the SharePoint database migration process to a new server is available on the ShareGate website.

ahp_freehostSHP

Step-by-step to migrate content database

  • Step 1 : Make two servers available for the process. Both the servers need to run on the same environment. For instance, Server 1 should run on Windows 2008, SQL server 2008 and include SharePoint 2010. Server 2 should run on Windows 2008, SQL server 2008 and include SharePoint 2013.
  • Step 2 : You must begin with backing up the data from Server 1. To do this,

a) While on SharePoint 2010, pick the database of the port you want to back-up. Right click and from the options that appear, click Tasks → Back Up.
b) In the subsequent window that opens, click ‘Add
c) Copy the location available under the ‘Destination’ field and save it a notepad for later use.

  • Step 3 : On server 2, launch SharePoint 2013 and create a new web application under any port. If you are not sure, pick port 88.
  • Step 4 : Once a new application has been created, perform the following steps:

a) Under Central Administration, select Application Management Manage Content Databases
b) Under the newly created web application, select ‘Remove content database checkbox’. Click OK and SAVE
c) Under the Content Database section, you should now see a message that reads, “There are no items to show in this view’

  • Step 5 : The next step is to restore the database from SharePoint 2010 to the new server. To accomplish this, copy the WSS_Content.bak file from Server 1 on to the desktop or any convenient location on the computer handling Server 2.
  • Step 6 : In SharePoint 2013, launch SQL Server 2008 and right click on the node titled Database and from the options, choose ‘Restore Database’.
  • Step 7 : A new ‘Restore Database’ window now opens. Here, select the ‘From Device’ radio button and browse through your system folders to select the WSS_Content.bak file that we had earlier copied in Step 5. Click OK
  • Step 8 : Next, under the ‘Options’ tab of the Restore Database window, check the box that reads, “Overwrite the existing database (WITH REPLACE)”. Press OK to continue. A message box appears that confirms the operation. Press OK to close this box.
  • Step 9 : Open SharePoint 2013 and navigate to Central Administration → Application Management → Manage Content Databases. You should now see the WSS_Content.bak file displayed here.
  • Step 10 : On the top of the window, you will see a message. Click on the ‘Start Now‘ link to continue.
  • Step 11 : In the subsequent window, click on the ‘Upgrade the site collection’ option. You will be shown a message box. Click ‘I’m Ready‘ to continue.
  • Step 12 : The upgradation process will now begin. This typically takes a few minutes. Once you are done, you will be shown a message that reads, “Upgrade Completed Successfully”

This completes the process. Your content database migration from SharePoint 2010 to SharePoint 2013 has been completed successfully.

SharePoint 2013 Hosting – ASPHostPortal.com :: Event ID 6398 AppFabric Distributed Cache Error

Sharepoint 2013 Event ID 6398 AppFabric Distributed Cache Error

ahp_freehostSHPBefore, I started seeing repeated errors with Event ID 6398 and description of:

The Execute method of job definition Microsoft.Office.Server.UserProfiles.LMTRepopulationJob (ID 581fc80e-f7fb-4b3b-99cd-7affa208f57b) threw an exception. More information is included below. Unexpected exception in FeedCacheService.BulkLMTUpdate: Unable to create a DataCache. SPDistributedCache is probably down

This error occurs every 5 minutes as the User Profile Service – Feed Cache Repopulation Job ran and it also prevented anything from populating the My Sites Newsfeeds section. The Newsfeeds page would only return “We’re still collection the latest news. You may see more if you try again a little later.” I tried to follow a multitude of blog posts, forum posts and articles on repairing the AppFabric Distributed Cache Service and was unable to correct the error.

My next step was to try to get the AppFabric service back to the initial setup.

  • Remove the AppFabric setup from Add/Remove Programs.
  • More information on this process in this MSDN article and also follow the link from there to Clean up any remaining AppFabric settings either manually or using the Cleanup Tool they provide.
  • After rebooting, I downloaded the AppFabric 1.1 Installer from here.

However, do not install it manually, instead use the SharePoint 2013 setup disc to use the prerequisite installer to install and configure AppFabric using the following command:

prerequisiteinstaller.exe /appFabric:C:\pathto\WindowsServerAppFabricSetup_x64.exe

Now you can continue on with the initial configuration of the AppFabric service. I ran the following command from the SharePoint 2013 PowerShell as Administrator

$instanceName ="SPDistributedCacheService Name=AppFabricCachingService"

$serviceInstance = Get-SPServiceInstance | ? {($_.service.tostring()) -eq $instanceName -and ($_.server.name) -eq $env:computername}

$serviceInstance.Provision()
  • Then run

Add-SPDistributedCacheServiceInstance

You should see the Distributed Cache service running in Manage Services on Server in Central Administration and also see the AppFabric Caching Service running in Services. If you don’t then try Remove-DistributedCacheServiceInstance and Add again. After completing this process, I was able to go back to MySites and see the Newsfeed as it should be and also no more errors in the Event Log.

NewsFeed Working

I would love to know why this occurred since I was not working on anything with the Caching service prior to the errors; however, I hope this helps someone else caught up in this problem.

SharePoint 2013 Hosting – ASPHostPortal.com :: Plan the Deployment of Farm Solutions for SharePoint 2013

How To Plan the Deployment of Farm Solutions for SharePoint 2013 ?

ahp_freehostSHPWhile everyone is talking about Apps, there are still significant investments in Full Trust Solutions and I am sure that many OnPrem deployments will want to carry these forward when upgrading to SharePoint 2013.  The new SharePoint 2013 upgrade model allows Sites to continue to run in 2010 mode after upgrading and each Site Collection explicitly has to be upgraded individually.

Not the way it worked in 2010 with Visual Upgrade, but this time there is actually both a 14 and 15 Root folder deployed and all the Features and Layout files from SharePoint 2010 are deployed as part of the 2013 installation.

For those of you new to SharePoint, the root folder is where SharePoint keeps most of its application files and the default location for this is “C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\[SharePoint Internal Version]”, where the versions for the last releases have been 60 (6.0), 12, 14, and now 15. The location is also known as “The xx hive.”

This is great in an upgrade scenario, where you may want to do a platform upgrade first or only want to share the new features of 2013 with a few users while maintaining an unchanged experience for the rest of the organization.  This also gives us the opportunity to have different functionality and features for sites running in 2010 and 2013 mode.  However, this requires some extra thought in the development and deployment process that I will give an introduction to here. Because you can now have Sites running in both 2010 and 2013 mode, SharePoint 2013 introduces a new concept of a Compatibility Level.  Right now it can only be 14 or 15, but you can imagine that there is room for growth.  This Compatibility Level is available at Site Collection and Site (web) level and can be used in code constructs and PowerShell commands.

I will start by explaining how you use it while building and deploying wsp-files for SharePoint 2013 and then finish off with a few things to watch out for and some code tips.

Deployment Considerations

If you take your wsp-files from SharePoint 2010 and just deploy these with Add-SPSolution -> Install-SPSolution as you did in 2010, then SharePoint will assume it is a 2010 solution or a “14” mode solution. If the level is not specified in the PowerShell command, it determines the level based on the value of the SharePointProductVersion attribute in the Solution manifest file of the wsp-package.  The value can currently be 15.0 or 14.0. If this attribute is missing, it will assume 14.0 (SharePoint 2010) and since this attribute did not exist in 2010, only very well informed people will have this included in existing packages.

For PowerShell cmdlets related to installing solutions and features, there is a new parameter called CompatibilityLevel. This can override the settings of the package itself and can assume the following values: 14, 15, New, Old, All and “14,15” (the latter currently also means All).

The parameter is available for Install-SPSolution, Uninstall-SPSolution, Install-SPFeature and Uninstall-SPFeature.  There is no way to specify “All” versions in the package itself – only the intended target – and therefore these parameters need to be specified if you want to deploy to both targets.

It is important to note that Compatibility Level impacts only files deployed to the Templates folder in the 14/15 Root folder.

That is:  Features, Layouts-files, Images, ControlTemplates, etc.

This means that files outside of this folder (e.g. a WCF Service deployed to the ISAPI folder) will be deployed to the 15/ISAPI no matter what level is set in the manifest or PowerShell.  Files such as Assemblies in GAC/Bin and certain resource files will also be deployed to the same location regardless of the Compatibility Level.

It is possible to install the same solution in both 14 and 15 mode, but only if it is done in the same command – specifying Compatibility Level as either “All” or “14,15”.  If it is first deployed with 14 and then with 15, it will throw an exception.  It can be installed with the –Force parameter, but this is not recommended as it could hide other errors and lead to an unknown state for the system.

The following three diagrams illustrate where files go depending on parameters and attributes set (click on the individual images for a larger view). Thanks to the Ignite Team for creating these. I did some small changes from the originals to emphasize a few points.

6786.CompatibilityLevelOld_5F00_thumb_5F00_6A8D17FE

6114.CompatibilityLevelNew_5F00_thumb_5F00_4E7EE9C41401.CompatibilityLevelAll_5F00_thumb_5F00_1974EB45When retracting the solutions, there is also an option to specify Compatibility Level.  If you do not specify this, it will retract all – both 14 and 15 files if installed.  When deployed to both levels, you can retract one, but the really important thing to understand here is that it will not only retract the files from the version folder, but also all version neutral files – such as Assemblies, ISAPI deployed files, etc. – leaving only the files from the Root folder you did not retract.

To plan for this, my suggestion would be the following during development/deployment:

  • If you want to only run sites in 2013 mode, then deploy the Solutions with CompatibilityLevel 15 or SharePointProductVersion 15.0.
  • If you want to run with both 2010 and 2013 mode, and want to share features and layout files, then deploy to both (All or “14,15”).
  • If you want to differentiate the files and features that are used in 2010 and 2013 mode, then the solutions should be split into two or three solutions:
  1. One solution (“Xxx – SP2010”), which contains the files and features to be deployed to the 14 folder for 2010 mode.  including code-behind (for things like feature activation and Application pages), but excluding shared assemblies and files.
  2. One solution (“Xxx – SP2013”), which contains the files and features to be deployed to the 15 folder for 2013 mode, including code-behind (for things like feature activation and Application pages), but excluding shared assemblies and files.
  3. One solution (“Xxx – Common”), which contains shared files (e.g. common assemblies or web services). This solution would also include all WebApplication scoped features such as bin-deployed assemblies and assemblies with SafeControl entries.
  • If you only want to have two solutions for various reasons, the Common solution can be joined with the SP2013 solution as this is likely to be the one you will keep the longest.

The assemblies being used as code-files for the artifacts in SP2010 and SP2013 need to have different names or at least different versions to differentiate them. Web Parts need to go in the Common package and should be shared across the versions, however the installed Web Part templates can be unique to the version mode.

Things to watch out for…

There are a few issues that are worth being aware of that may be fixed in future updates, but you’ll need to watch out for these currently.  I’ve come across an issue where installing the same solution in both levels can go wrong.  If you install it with level All and then uninstall it with level 14 two times, the deployment logic will think that it completely removed the solution, but the files in the 15/Templates folder will still be there.

To recover from this, you can install it with –Force in the orphan level and then uninstall it.  Again, it is better to not get in this situation.

Another scenario that can get you in trouble is if you install a solution in one Compatibility Level (either through PowerShell Parameter or manifest file attribute) and then uninstall with the other level.  It will then remove the common files but leave the specific 14 or 15 folder files and display the solution as fully retracted.

Unfortunately there is no public API to query which Compatibility Levels a package is deployed to.  So you need to get it right the first time or as quickly as possible move to native 2013 mode and packages (this is where we all want to be anyway).

Code patterns

An additional tip is to look for hard coded paths in you custom code such as _layouts and _controltemplates.  The SPUtility class has been updated with static methods to help you parse the current location based on the upgrade status of the Site.   For example, SPUtility.ContextLayoutsFolder will give you the path to the correct layouts folder.  See the reference article on SPUtility properties for more examples.

Round up

I hope this gave you an insight into some of the things you need to consider when deploying Farm Solutions for SharePoint 2013. There are lots of scenarios that are not covered here. If you find some, please share these or share your concerns and I will try to add it as comments or an additional post..

SharePoint 2013 Hosting – ASPHostPortal.com :: How to Use Metadata Navigation Filtering in SharePoint 2013

On this post I will show how you can setup Metadata Navigation Filtering in SharePoint 2013. This can be a single of the strongest functions obtainable in helping consumers swiftly find the things they require without having writing any code, it really just has to be turned on and configured.

ahp_freehostSHP

I begin on the Home Page in the Website that is at the leading level website from the website collection developed and configured within the prior posts. Metadata Navigation and Filtering is a Website Characteristic that has to be activated for this to work.

1sdgvsa

On the right side I click on the site Actions Gear and go to Site Settings where I will activate the Site Feature, Metadata Navigation and Filtering.

2sdbgd

3sdgbvs

This site feature is not activated on the Team Site Template so I click Activate.

4zsdg

When I see the blue icon that says Active, I know I’m good to go.

5dfab

I click the link in the Quick Launch bar to get to the gdpByStateReports Library I configured in previous posts.

6dgb

I click the Library Tab.

7 gswer

I click the Library Settings Icon.

8fhbde

We are going to use th Metadata navigation settings that is now available on the Library to pivot on these two Metadata columns.

9dfgn

This will allow users to find reports immediately based on Metadata regardless of which older they are in.

10tnfrdn

I click the Metadata navigation settings link. This link was not available on the Library Settings page until the Metadata Navigation and Filtering Site Feature was activated.

11fbhdb

This can be the Metadata navigation settings page.

Right here we see two primary locations: Configure Navigation Hierarchies and Configure Key Filters. Both of these work hand-in-hand to basically give users multiple amounts of filtering within an incredible UI that will get added just under Quick Launch Bar. (I highlighted some areas of certain value).

The Navigation Hierarchies and only use: Content type, Single-value Choice fields, or Managed Metadata Fields and the Key Filters can only use Content Kind, Option Field, Managed Metadata Area, Particular person or Team Field, Date and Time Field, or Number Field. Between the 2 if you carry out some preparing using this in your mind you’ll be able to develop really effective User Interfaces out of the box.

We’re going to make use of the StateOfOrigin and YearOfReport choice fields in Both locations and we’re going to go away the Folders within the Navigation Hierarchy Fields.

12rfbed

To configure the controls, you select the columns within the still left aspect and click on the Add button which moves them above for the right side. When you are completed your web page must seem like the figure previously mentioned. When it’s all set you’ll be able to click OK on the bottom from the page. Clicking Okay Not Demonstrated.

13dfbd

Now that its all configured we can click the gdpByStateReports link in the breadcrumb where we will see our amazing U.I.

14fdbdsb

Just below the Quick Launch, Share Point has added the Navigation Hierarchy and Key Filter Controls. I will start by clicking the State Of Origin in the top control.

15dfg

This expands to show the available fields (the options in choice column) I click on AR (Arkansas)

16dfgds

Immediately the content area of the web page shows all the reports that have the value AR in the StateOfOrigin column, REGARDLESS of which folder they reside in!

17dgdsb

With the state of Arkansas Selected in the Hierarchy control (AR) I go to the key Filters click the drop down menu for YearOfReport, You may have noticed that the StateOfOrigin Drop down disappeared because I already filtered on that column.

18fxndfh

I select 2010 and click Apply. My results are immediately apparent. I now see all reports for the State of Arkansas from the year 2010, regardless of which Folder the result set resides in.

19gfndfn

If I click the link to go back to the Document Library I can see that it resets my controls to their original state an returns the YearOfReport drop down to the U.I.

That’s it! Users can now quickly and efficiently parse through folders with out of the box functionality.