Monday, December 21, 2015

Share Point 2013 is really slow in Production Farm after some times

We had a problem in the Share Point farm and It came really slow suddenly. It's just 44KB and it took around 13s to load.


So when dinging the problem it has took quite a time to figure out App Fabric Caching Service is not running which is related to Distributed Cache Service.


When i run the service server performance was make to normal.

Tuesday, December 15, 2015

Reporting server web part not working in SharePoint 2013

These was situation in my server farm , reporting server web part is not worked. Literally I can add the reporting server web part to the server but when I give the report path report is showing but when I click Apply Button nothing is showing in the page.



While playing with the web part I found that If I unchecked the Asynchronous Rendering report will be loaded in the web part. 

But after that none of operations are working (as an example , Expand , Apply new filter) because we disabled the Ajax request from the web part.
By digging through found that we have put “SPWebpartManager” tag in the header section in the master page which actually should be in the body; when the time of custom master page creation.
<WebPartPages:SPWebPartManager runat="Server"/>
We could have found this one more easily if we change the master page to default.
Lesson Learnt
If some web parts are miss behave , change the Master Page to the default and check whether still issue is there.

(We know this but always forgetting to to it at the first place)

Wednesday, December 2, 2015

The XSS Auditor refused to execute a script in http://default.aspx because its source code was found within the request. The auditor was enabled as the server sent neither an 'X-XSS-Protection' nor 'Content-Security-Policy' header in SharePoint 2013

The XSS Auditor refused to execute a script in http://default.aspx because its source code was found within the request. The auditor was enabled as the server sent neither an 'X-XSS-Protection' nor 'Content-Security-Policy' header in SharePoint 2013
Recent google chrome update may breaks the sharepoint layout pages and other custom development pages due to XSS Auditor.


I have added the HTTP Response Header to the SharePoint Web Front End Servers  and then it worked fine.    

Thursday, November 12, 2015

Request failed. The method "GetItems" of the type "List" with id is blocked by the administrator on the server. SharePoint 2013

I have encountered this issue with my SharePoint 2013 server farm. Code was working fine with the development machine but once it deployed to Share Point 2013 production environment; found this error on Chrome console.
function somefunc()

{

    listItems = '' ;

    

   var context = SP.ClientContext.get_current();

   var web = context.get_web(); 

   var currentList = web.get_lists().getById(_spPageContextInfo.pageListId);

   var query = new SP.CamlQuery();

   listItems = currentList.getItems();

   context.load(listItems);

   context.executeQueryAsync(onQuerySucceeded, onQueryFailed);

}

Message was straight forward so I thought it is a permission issue. When I logged using my credentials It was fine and worked but when I logged out and view as a Anonymous user it didn’t work.

Then I tried to give permission to EveryOne to  the list , web even for the site collection and it didn’t work either.

then I found out it’s a property in web application which handles the Anonymous calls to the Web Application and it’s the

Microsoft.SharePoint.Administration.SPClientCallableSettings class.

Using a simple PowerShell you can remove these properties and make it work.


$webappllication = Get-SPWebApplication "http://sp2013"

$webappllication .ClientCallableSettings.AnonymousRestrictedTypes.Remove([microsoft.sharepoint.splist], "GetItems")

$webappllication .Update()
I ran this script in the App server and it worked.

Thursday, August 20, 2015

Microsoft.SharePoint.ApplicationRuntime.SafeControlsList.GetSafeControlsListFromPath

 

I had this error appearing in event viewer when I tried to run a tool which is doing updates on SharePoint pages.

But this was working very fine in my Dev environment and it is not working on my SharePoint production servers.

Surprised isn’t It …

I tried to figure out the error nothing was successful.

But ones I tried to run the same tool of web front end servers it worked.

My server farm contains 2 application servers and 2 web front end servers. And I figured it out this error is not appearing and working fine in WFEs not App servers.

Wednesday, August 5, 2015

SharePoint 2013 List Operations in REST– Retrieve List Fields Basics

You can use the function specified in the first post to call the REST URLs. You can use the appropriate function depending on the App type you are developing.

Get selected fields in SharePoint List using SELECT REST operation.

Getting single value fields

/*
 List Name : listname
 Columns: Title => Text , ID =>  Number
*/
 
var url = "/_api/web/lists/getbytitle('listname')/items?$select=Title,ID";
 
function s(data){
 
    // get the data and convert to JSON Objects
    var d = JSON.parse(data.body).d.results[0]; 
    
    alert(d.ID);
    alert(d.Title);
    
}
 
function f(data){
    alert(data);
}
 
getREST(url,s,f);

Getting Single value Lookup fields



/*
 List Name : listname
 Columns: ID =>  Number , CountryLookup => List LooukUp 
*/
 
var url = "/_api/web/lists/getbytitle('listname')/items?$select=ID,CountryLookupId";
 
function s(data){
 
    // get the data and convert to JSON Objects
    var d = JSON.parse(data.body).d.results[0]; 
    
    alert(d.ID);
    
    // 3 , will return the ID 
    alert(d.CountryLookupId);
}
 
function f(data){
    alert(data);
}
 
getREST(url,s,f);

Getting Multiple value Lookup fields



/*
 List Name : listname
 Columns: ID =>  Number , CountryLookup => List LooukUp multiple
*/
 
var url = "/_api/web/lists/getbytitle('listname')/items?$select=ID,CountryMultiLookupId";
 
function s(data){
 
    // get the data and convert to JSON Objects
    var d = JSON.parse(data.body).d.results[0]; 
    
    alert(d.ID);
    
    // [3,5]
    var mul = data.CountryMultiLookupId.results; 
    // iterate and show the results , $.each is a jQuery function
    $.each(mul,function(i,ele){ alert(ele) });    
}
 
function f(data){
    alert(data);
}
 
getREST(url,s,f);

Wednesday, July 29, 2015

[Microsoft][ODBC Driver 11 for SQL Server]Named Pipes Provider: Could not open a connection to SQL Server [53].

SQLState = 08001, NativeError = 53

Error = [Microsoft][ODBC Driver 11 for SQL Server]Named Pipes Provider: Could not open a connection to SQL Server [53].

SQLState = 08001, NativeError = 53

Error = [Microsoft][ODBC Driver 11 for SQL Server]A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online.

SQLState = S1T00, NativeError = 0

Error = [Microsoft][ODBC Driver 11 for SQL Server]Login timeout expired

This is a error i have got when my program is trying to connect to a SQL Server 2012 using named pipe.

I did a little google and found below article and followed it very carefully and still i got the error.

https://www.mssqltips.com/sqlservertip/2340/resolving-could-not-open-a-connection-to-sql-server-errors/

Futhur digging my syl server is in different active directory.

Ex. SQLS.domain1.com (IP: 10.8.2.204)

and my client is in onother active directory.

Ex. client.domain2.com (10.100.2.35)

When I add the host entry i did it in a write way with fully qualified name.

image

But it didnt work , because named pipe are using with in the same subnet

so i did a litle trick i have added the following host entry also.

image

So it will see the machine using machine name though it is in a different domain.

But this worked.

Tuesday, July 14, 2015

SQL Quick Tip

Concatenating Text and INT

SELECT 'text' + CAST(ID AS VARCHAR(20)) 

Monday, May 18, 2015

REST operations in SharePoint 2013

REST operations are essential in any SharePoint development. This series explain available REST endpoints in SharePoint 2013. First article shows how we can made a REST call in both SharePoint Hosted and Provider Hosted app.

Executing a REST GET call from SharePoint Provider Hosted App

First you need to refer related JavaScript related.

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script type="text/javascript" src="#SPWeb/_layouts/15/MicrosoftAjax.js"></script>
<script type="text/javascript" src="#SPWeb/_layouts/1033/init.js"></script>
<script type="text/javascript" src="#SPWeb/_layouts/15/sp.core.js"></script>
<script type="text/javascript" src="#SPHost/_layouts/15/SP.RequestExecutor.js"></script>
<script type="text/javascript" src="#SPWeb/_layouts/15/sp.js"></script>


You need to replace the #SPWeb from Appweb Url and #SPHost from Host web Url. App Web Url and Host Web Url is available in Url.



You can find these parameters as QueryString and available in SPAppWebUrl, SPHostUrl.



You need to specify the AppWebUrlUrl in the method below. If you are good at jQuery you can change the method by introducing Deferred Object.




 

function getREST(url,success,fail){
 
  // specify your web app url here
  // EX- https://oapp.sharepoint.com/sites/AWM/ArtWorkManagement
  var AppWebUrlUrl = "";  
  var executor = new SP.RequestExecutor(AppWebUrlUrl);
 
  executor.executeAsync(
       {
           url: AppWebUrlUrl + url,
           method: "GET", 
           contentType: "application/json;odata=verbose",
           headers: { "Accept": "application/json; odata=verbose" },
           success: function (data) {
               if(success){success(data);} // call the function if done
           },
           error: function (data, errorCode, errorMessage) {
               if(fail){fail(data);} // call the function if done
           }
       }
);
}


Executing a REST GET call from SharePoint Hosted App



You need to specify the AppWebUrlUrl in the method below.




 

function getREST(url,success,fail){
 
  // specify your web app url here
  // EX- https://oapp.sharepoint.com/sites/AWM/ArtWorkManagement
  var AppWebUrlUrl = "";  
 
    $.ajax({
            method: "GET",
            url: AppWebUrlUrl + url,
            success: function (data) {
                if(success){success(data);} // call the function if done
 
            },
            error: function (data) {
                if(fail){fail(data);} // call the function if done
            }
        });
 }


Calling the Function




 

function done(data){
  // success
}
 
function error(){
    // Error
}
 
var restUrl = "" // Your URL goes here
getREST(restUrl,done,error);
 
 

Friday, April 24, 2015

Configure outgoing e-mail settings with Office 365 SMTP server in SharePoint Server 2013 – Part 4

First check the SMTP server is installed in the server. You can check that on Server Manger and Features section.

image_thumb9_thumb_thumb

If it is not installed first you need to install the SMTP in the server. SMTP server needs port 25 opens in the firewall in default.

After setting up the SMTP server you need to open the IIS Manger.

image_thumb12_thumb_thumb

before stating the SMTP Virtual server need to configure some properties. Right click the SMTP virtual Server and click on the Access Tab. Click on Relay.. button on the Relay restrictions.

image_thumb15_thumb_thumb

This section specified which server can use the SMTP for mail relay. So either you need to select Only the list below and add IP Addresses of all server which used to send the emails (ex:-WFE, APP) or let all servers to send emails by All except the list below and putting nothing on the list.

image_thumb19_thumb_thumb

Then Click on Authentication.. button on Access Control section and make the checkbox for Anonymous access.

image_thumb22_thumb_thumb

Then click ok and go to the Delivery Tab.

image_thumb[2]_thumb

Outbound Security section allows you to provide credential for receiving server. Since we are using local SMTP server you can make this as a Basic authentication and type your User name and Password and click the TLS encryption.

image_thumb[3]

Outbound Connection section you can change the default port using.

image_thumb[6]

Advanced.. section you need specify the Smart host for forwarding the email for Gmail SMTP server (smtp.gmail.com).

You can route all outgoing messages for remote domains through a smart host instead of sending them directly to the domain. This permits you to route messages over a connection that may be more direct or less costly than other routes. The smart host is similar to the route domain option for remote domains. The difference is that after a smart host is designated, all outgoing messages are routed to that server. With a route domain, only messages for the remote domain are routed to a specific server.

image_thumb[9]

You can find the Gmail SMTP server settings here.

Then start the SMTP virtual server.

image_thumb[19]_thumb

After that you can find the fully qualified name in General Tab and proceed with the Outbound SMTP settings as Part 1.

image_thumb[16]_thumb

Friday, April 17, 2015

Configure outgoing e-mail settings with Gmail/Google SMTP server in SharePoint Server 2013 – Part 3

First check the SMTP server is installed in the server. You can check that on Server Manger and Features section.

image_thumb9_thumb

If it is not installed first you need to install the SMTP in the server. SMTP server needs port 25 opens in the firewall in default.

After setting up the SMTP server you need to open the IIS Manger.

image_thumb12_thumb

before stating the SMTP Virtual server need to configure some properties. Right click the SMTP virtual Server and click on the Access Tab. Click on Relay.. button on the Relay restrictions.

image_thumb15_thumb

This section specified which server can use the SMTP for mail relay. So either you need to select Only the list below and add IP Addresses of all server which used to send the emails (ex:-WFE, APP) or let all servers to send emails by All except the list below and putting nothing on the list.

image_thumb19_thumb

Then Click on Authentication.. button on Access Control section and make the checkbox for Anonymous access.

image_thumb22_thumb

Then click ok and go to the Delivery Tab.

image_thumb[2]

Outbound Security section allows you to provide credential for receiving server. Since we are using local SMTP server you can make this as a Basic authentication and type your User name and Password and click the TLS encryption.

image

Outbound Connection section you can change the default port using.

image

Advanced.. section you need specify the Smart host for forwarding the email for Gmail SMTP server (smtp.gmail.com).

You can route all outgoing messages for remote domains through a smart host instead of sending them directly to the domain. This permits you to route messages over a connection that may be more direct or less costly than other routes. The smart host is similar to the route domain option for remote domains. The difference is that after a smart host is designated, all outgoing messages are routed to that server. With a route domain, only messages for the remote domain are routed to a specific server.

image

You can find the Gmail SMTP server settings here.

Then start the SMTP virtual server.

image_thumb[19]

After that you can find the fully qualified name in General Tab and proceed with the Outbound SMTP settings as Part 1.

image_thumb[16]