Saturday, 14 July 2018

Data Refreshing issue Access Denied to Analysis Services Database Contact Administrator in PowerPivot in SharePoint BI services

Issue:
As part of SharePoint 2013 reporting services, I was trying to render SSAS cube data in SharePoint BI (Business Intelligence) site library. But, when click on “Refresh All Connections” to fetch the latest data from SSAS cube I was experiencing below issue:
powerpivot data refresh error
powerpivot data refresh error
Diagnosis this issue:
To know the issue in Excel Services we need to enable “Diagnostic Logging” which will log the connection / authentication as part log file.
 
Steps to enable Diagnostic Logging:
1. Log on to WFE with FARM account
2. Launch Central administration
3. Navigate to Diagnostic Logging 
Central Administration -> Monitoring -> Configure Diagnostic Logging
powerpivot data refresh error access is denied
powerpivot data refresh error access is denied
4. Select “Excel Services Application” as part of Diagnostics Logging page and click “OK” at the end of the page.
sharepoint 2013 powerpivot data refresh error
sharepoint 2013 powerpivot data refresh error
5. By enabling this SharePoint will log the actual error message in log file as part of 15 Hives, the default path for log files is:
%CommonProgramFiles%\Microsoft Shared\Web Server Extensions\15\LOGS\
 
6. Soon you enable diagnostics logging from client/user machine “refresh all connections” in excel (as shown in picture-1)
 
Note: This will give the same error but SharePoint will log the detailed error in log file
 
7. Navigate to log folder and open the latest log file and search for “Excel Services Application External Data” when I do it I found the below error message.
05/14/2018 18:07:55.84    w3wp.exe (0x37BC)    0x552C    Excel Services Application    External Data    ai2vl    Information    The workbook ‘http://SharePoint13:9535/PowerPivot Gallery/SaleOrders.xlsx’ attempted to access external data using the unsupported provider ‘Provider=MSOLAP.7;Integrated Security=SSPI;Persist Security Info=True;Initial Catalog=SaleOrders;Data Source=SharePoint13\tab;MDX Compatibility=1;Safety Options=2;MDX Missing Member Mode=Error;Update Isolation Level=2’. [Session: 1.V23.108d20qHa37P9g/cpouEEz514.5.en-US5.en-US36.94632022-8f93-4af2-9a9a-fd10c6df64721.A1.N User: 0#.w|sharepoint13\spadmin]    f291659e-4995-e0b2-9f14-af19942f9e12
 
Error message clearly says that “attempted to access external data using the unsupported provider ‘Provider=MSOLAP.7”
 
Solution:
As the error message shows that excel services using a unsupported provider we need to ensure that, MSOLAP.7 provider is part of trusted data providers.
 
Follow the below steps to add the new trusted data provider:
1. Log on to WFE with FARM admin account
2. Open “Excel service application” as part of “Manage Service application”.
Central Administration -> Application Management -> Service Applications -> Manage Service Applications
powerpivot pivot table not refreshing
powerpivot pivot table not refreshing



manage powerpivot data refresh sharepoint 2013 error
manage powerpivot data refresh sharepoint 2013 error
3. Select “Trusted Data Provider” to add the new provider
sharepoint 2016 powerpivot data refresh error
sharepoint 2016 powerpivot data refresh error
4. Validate the list of trusted providers for “MSOLAP.7” and then click on “Add Trusted Data Provider”
manage powerpivot data refresh sharepoint 2013 error Tutorial
manage powerpivot data refresh sharepoint 2013 error Tutorial
5. Enter the provider details as shown below and click on “OK” button
sharepoint 2016 powerpivot data refresh error Tutorial
sharepoint 2016 powerpivot data refresh error Tutorial
6. Once the provider is added go back to user / client machine it will work seamlessly.

SharePoint 2013 Report Data Source content type is missing

Scenario:
As part of configuring SSRS in SharePoint 2013 we need to create data source create connection string for SSRS report. In order to do that we need add “Report Data Source Content Type” to a document library in SharePoint 2013. The same way we can resolve the report server integration feature missing sharepoint 2016 issue. The solution will work for SharePoint 2016 and SharePoint 2013.
Issue:
When I was trying to attach / associate Report Data Source content type to document library I don’t that as part of list of content types at site collection level.



Report Data Source content type sharepoint 2013
Solution:
Please follow below steps to get Report Data Source content type.
– Navigate to Site Settings
– Click on Site collection Features






sharepoint 2013 report data source content type missing
– Locate “Report Server Integration” feature deactivate and activate the feature



report server integration feature missing sharepoint 2016
– Now if you try to associate the content type you can 3 new content type
1. Report Builder Model
2. Report Data Source
3. Report Builder Report



Report Data Source content type
– Now you can see 3 different option when you click on new item in document library
sharepoint 2010 report data source content type

The SSRS service application proxy is not configured. Use the SSRS service application pages to configure the proxy

Issue:
I was getting the below error while rendering SSRS service after installing updates in WFE in SharePoint server.



The SSRS service application proxy is not configured

Solution & Root cause analysis:
When I started doing the root cause analysis I have realized that SSRS service in central admin got stopped. Follow the below steps to see the detailed error message in server logs.
1. Log on to WFE and launch central admin with FARM admin account
2. Navigate to Manage Service Applications under Application management
3. Find your Reporting Services service application and click the name of your service application



Use the SSRS service application pages to configure the proxy
4. Click on System Settings

SSRS service application proxy is not configured
5. Click on Enable remote Errors in Security section

SSRS service application proxy is not configured sharepoint 2013
Once you once enable this in Central admin we need to enable the same setting at Site Collection level.
1. Open the site collection which are experiencing SSRS rendering issue
2. Click on Site Action and click on Site Settings
3. Click Reporting Services Site Settings in the Reporting Services group

SSRS service application proxy is not configured sharepoint 2016
4. Click Enable remote errors in local mode check box




The SSRS service application proxy is not configured sharepoint 2013
Ok with this we have enabled the option of logging detailed error in server logs.
Now if you refresh the page where you are getting the above error it will log a detailed error message in server log file. It will be as follows:

As the error message shows we need to enable the reporting services service in central administration.

The SSRS service application proxy is not configured sharepoint 2016
The SSRS service application proxy is not configured sharepoint 2016
Once I restart the service SSRS service is rendering as expected.

Reporting Server Integration feature missing in SharePoint 2013

Issue:
As part SSRS reporting configuration we need to enable “Reporting Server Integration feature” in SharePoint 2013 at Site collection level. But when I try to enable that feature it is missing from list of features at Site collection features.

Reporting Server Integration feature missing in SharePoint 2013



Solution:
Please follow the below steps to fix this issue and get “Reporting Server Integration feature” available at site collection level.
1. Log on to WFE as FARM administrator
2. Ensure that “Microsoft SQL Server 2012 RS Add-in for SharePoint” is installed in add remove programs.

report server integration feature missing sharepoint 2016

3. If it is not installed download the setup from this link and install
4. If this add-in is installed select the add-in and click on repair to fix the issue.

sql server reporting services content types missing sharepoint 2013

5. As soon as you repair the software restart the WFE
6. Once all the services are up navigate to site collection level feature you will see that “Reporting Server Integration feature” as activated.


report server integration feature missing sharepoint 2013

Source Credit: Enjoysharepoint

SharePoint 2013 App Authentication Using S2S High Trust

WHAT IS A SERVER-To-SERVER (S2S) TRUST:
– A trusted connection between client app and SharePoint Web server
– Eliminates the need of involving ACS when running apps within private networks
– Trust between Servers is configured using one or more SSL certificate
– App Server code requires access to public/private key pair of SSL certificate
– Requires creating S2S Security Token Service on SharePoint Web server(s)

On- premises App Authentication is used for setting up High Trust apps that use the server-to-server (S2S) protocol. This is a Provider Hosted app deployed in a private network which eliminates the need to involve ACS for creating authentication tokens. In essence, an S2S Trust represents a trusted connection between a client app running on a local app server and the web servers in the SharePoint farm.

S2S (High Trust) – App Only Context:
An S2S accesses the token by calling the GetS2SAccessTokenWithWindowsIdentity method of the TokenHelper class. Use the TokenHelper::GetS2SAccessTokenWithWindowsIdentity method, passing a null for the WindowsIdentity parameter.

SharePoint_2013_App_Authentication_Using_S2S_High_Trust.jpg

Let’s see how we can actually utilize the “App Only” policy to elevate user permissions. I have written the following code in the code behind of the TestPage.aspx of S2S Provider Hosted App.

Code:
1. Uri _hostWeb = newUri(Request.QueryString[“SPHostUrl”]);
2. stringappOnlyAccessToken = TokenHelper.GetS2SAccessTokenWithWindowsIdentity(_hostWeb, null);
3. using(ClientContext clientContext = TokenHelper.GetS2SAccessTokenWithWindowsIdentity(_hostWeb.ToString(), appOnlyAccessToken)) {
4. List Testlist = clientContext.Web.Lists.GetByTitle(“TestList”);
5. ListItemCreationInformation info = new ListItemCreationInformation();
6. SharePoint.Client.ListItem item = Testlist.AddItem(info);
7. item[“Title”] = “Created S2SApp”;
8. item[“Body”] = “Created from S2S” + DateTime.Now.ToLongTimeString();
9. Update();
10. Load(item);
11. ExecuteQuery();
12. }


Deploy the app and then log on as a user who only has read permission to the list. Execute the code and a new item is created even though the user does not have permission to create items in the list. The “Created By” and “Modified By” fields in the list will reflect that it was the SHAREPOINT\App account that was used to create the item.

Note:
This capability is only available to provider-hosted apps, not to SharePoint-hosted apps. In a SharePoint-hosted app, there is Full trust code that is not limited by permissions – it can do anything it wants.

SP.UI.ModalDialog.showModalDialog() do not work in SharePoint 2013

After migrating code from SharePoint 2010 to SharePoint 2013 the calls to showModalDialog failed with message that the method cannot be found (javascript). When checking it in IE Developer Tools this isn’t surprising at all. The required js-file isn’t loaded.

But why? I guess it must be the new SOD-Model (Script on Demand) that was introduced in SharePoint 2013.

function ShowServerInformation() {
var options = {
url: ‘/_layouts/Management/GeneralInformation.aspx’,
tite: ‘Management Information’,
allowMaximize: false,
showClose: true,
width: 430,
height: 230
};
SP.UI.ModalDialog.showModalDialog(options);
return false;
}

It’s very easy to fix this problem.

Follow below steps:
1. Remove the Java Script reference.
2. <script src=”/_layouts/sp.js” type=”text/javascript”></script>
3. <script src=”/_layouts/SP.UI.Dialog.js” type=”text/javascript”></script>
4. Add to the url variable “?IsDlg=1″`
5. Replace the command SP.UI.ModalDialog.showModalDialog() with the new command SP.SOD.execute(‘sp.ui.dialog.js’, ‘SP.UI.ModalDialog.showModalDialog’, options);

After this few changes your solution will work correctly.

SharePoint 2013 Example:
function ShowServerInformation(featureId) {
var options = {
url: ‘/_layouts/Management/GeneralInformation.aspx?IsDlg=1’,
tite: ‘Management Information’,
allowMaximize: false,
showClose: true,
width: 430,
height: 230
}
SP.SOD.execute(‘sp.ui.dialog.js’, ‘SP.UI.ModalDialog.showModalDialog’, options);
return false;
}

Note: I first tried the “executeOrDelayUntilScriptLoaded”-function. But it was not of much help. It just “swallowed” my function call but never executed it because the js-file I specified was never loaded.

Friday, 1 April 2016

Changing Back Color of SP List Column in View


I have implemented in one of my previous project using below script.
Where we want to keep the background color of status field based on the value of Status and DueDate Field.


(function () {
    // Create object that have the context information about the field that we want to change it's output render
    var statusFiledContext = {};
    statusFiledContext.Templates = {};
    statusFiledContext.Templates.Fields = {
        // Apply the new rendering for status field on List View
"Status": { "View": statusFiledTemplate },
"DueDate": { "View": dueDateFiledTemplate }
    };
               

    SPClientTemplates.TemplateManager.RegisterTemplateOverrides(statusFiledContext);
               
})();



// This function provides the rendering logic for list view
function statusFiledTemplate(ctx) {
    var status = ctx.CurrentItem[ctx.CurrentFieldSchema.Name];
    switch (status) {
                case "Not Started":
return "<span style='background-color :rgb(186, 20, 26); color :WhiteSmoke; -moz-border-radius:5px 5px 5px 5px;border-radius:5px 5px 5px 5px; padding-right: 5px;padding-left: 5px' >" + status + "</span>";
                                break;
                 case "In Progress":
return "<span style='background-color :rgb(252, 209, 22);-moz-border-radius:5px 5px 5px 5px;border-radius:5px 5px 5px 5px; padding-right: 5px;padding-left: 5px'>" + status + "</span>";
                                break;
                case "N/A":
return "<span style='background-color :rgb(210, 210, 210);-moz-border-radius:5px 5px 5px 5px;border-radius:5px 5px 5px 5px; padding-right: 5px;padding-left: 5px'>" + status + "</span>";
                case "Completed":
                                 return "<span style='background-color :rgb(85, 212, 85);-moz-border-radius:5px 5px 5px 5px;border-radius:5px 5px 5px 5px; padding-right: 5px;padding-left: 5px'>" + status + "</span>";
    }
}



function dueDateFiledTemplate(ctx) {
                 var duedate = ctx.CurrentItem.DueDate;
                var currentDate = new Date();
                var day = currentDate.getDate();
                var month = currentDate.getMonth() + 1;
                var year = currentDate.getFullYear();
                var today_date = month+"/"+day+"/"+year;
                var firstValue = duedate.split('/');
                var secondValue = today_date.split('/');

                var dueDate = new Date();
                dueDate.setFullYear(firstValue[2],(firstValue[0] - 1 ),firstValue[1]);

                var todayDate = new Date();
                todayDate.setFullYear(secondValue[2],(secondValue[0] - 1 ),secondValue[1]);
               
                 var status = ctx.CurrentItem.Status;
                if (dueDate < todayDate && (status == "Not Started" || status == "In Progress"))
                {
                                return "<span style='background-color :rgb(186, 20, 26); color :WhiteSmoke ; -moz-border-radius:5px 5px 5px 5px;border-radius:5px 5px 5px 5px; padding-right: 5px;padding-left: 5px'>" + duedate + "</span>";
                }
                else
                {
                                return duedate;
                }
}