Jun 13, 2014

How to Clear SharePoint Designer Cache


Hello guys,

This post gives  you the information on how to clear the cache which is created by SharePoint Designer. Generally when you log in to the designer you see the info of already opened sites/pages . This is due to the cache which is created by designer when you login/open the site.

Follow these steps to clear the cache.
 
Close the designer and delete the files from below folders(Open these folders in windows explorer)
 
  • %APPDATA%\Microsoft\Web Server Extensions\Cache
  • %USERPROFILE%\AppData\Local\Microsoft\WebsiteCache
If you want to clear the cache frequently ,write a batch file with these commands to run with single click.

Thanks,
Purna
 

 

Jun 8, 2014

SharePoint List Export to Excel in Java Script Client Object Model using RPC (Owssvr.dll)

Hello guys,

Here I am explaining how to implement the OOB 'Export to Excel' feature of SharePoint list using RPC (Remote Procedure Calls) with Javascript CSOM code.

What is RPC :

This is a protocol from Windows SharePoint Services(WSS) , helps in exchanging the data between client and the server which runs with WSS. As all of you know the foundation for Sharepoint Server is came from WSS.
So for this kind of functionalities we can make use of this RPC. Here more about RPC from msdn.

Here I am using this below rpc url to generate the excel report of a list

 "/_vti_bin/owssvr.dll?CS=109&Using=_layouts/query.iqy&List={" + listId + "}" + "&View={" + viewId + "}&CacheControl=1";           

The parameters are List GUID and the View GUID.

Get List GUID :

Go to your list settings page: List Settingsà in Url you will find

http:// purnaexperiments:1234/_layouts/15/listedit.aspx?List=%7BCEB4F6D3%2D06AC%2D43FF%2DA95E%2DA158144585A3%7D

Replace  %7B with “{“,
             %2D with “–“ and
             %7D with “}”

After this the you get the GUID like ={CEB4F6D3-06AC-43FF-A95E-A158144585A3}.

Get View Guid :

Go to List Viewà Click Modify this ViewàYour url will look like this follow url


Copy the value after the string ‘View’ in above url and

Replace  %7B with “{“,
             %2D with “–“ and
             %7D with “}”

After this the you get the View GUID like ={ E42BBCD5-8A0F-4092-8B3D-52D9EF805AAB}.

In below code I am getting the LIST GUID and View GUID from their names. 

You can use this function directly to generate the report with List Title and View Title

Code :
  1.   <input id="btnGenerate" onclick=" GeneratePCMReport('MyCustomList', 'All Items’);" value="Generate Excel Report" /> 
  2. // Here the list name is 'MyCustomList' and the view name is ‘All Items’ 

  3.     <script type="text/javascript">    
  4.         var exporturl = null;
  5.         var listPages = null;
  6.         var view = null;
  7.         var web = null;
  8.         function GeneratePCMReport(listName, viewTitle)         
  9.         { 
  10.             if (navigator.appName == "Microsoft Internet Explorer") 
  11.                {
  12.                 var context = new SP.ClientContext.get_current();
  13.                 web = context.get_web();
  14.                 context.load(web);
  15.                 listPages = context.get_web().get_lists().getByTitle(listName);
  16.                 context.load(listPages);
  17.                 view = listPages.get_views().getByTitle(viewTitle);
  18.                 context.load(view);
  19.                 context.executeQueryAsync(getlistInfoSuccess, getlistInfoFailed);
  20.                 }
  21.             else {
  22.                 alert("Please use Internet Explorer to generate the Excel Report");
  23.             }
  24.         } 
  25.         function getlistInfoSuccess(sender, args)
  26.         {
  27.             var listId = listPages.get_id();
  28.             var viewId = view.get_id();
  29.             exporturl = web.get_url() + "/_vti_bin/owssvr.dll?CS=109&Using=_layouts/query.iqy&List={" + listId + "}" + "&View={" + viewId + "}&CacheControl=1";          
  30.             window.location.href = exporturl;
  31.         }
  32.         function getlistInfoFailed(sender, args) 
  33.          {
  34.             alert('Issue in getting the Report, Please try later')
  35.          } 
  36.     </script>

Note : As you know the oob  'Export to Excel' works only in IE, the above code also works only in IE.
Since we are calling the same oob function through csom code. That is the reason i have included a condition (navigator.appName == "Microsoft Internet Explorer") in above code to check the browser type.


Thanks,
Purna

How to check the browser is IE or not using javascript

Generally while working with some share point functionalities there will be need of checking the type of broswer.

Especially the functionalities like export to excel. Calling default 'Export Excel' feature in our custom code needs this browser check.

This is the java script code to check this

if (navigator.appName == "Microsoft Internet Explorer")
{
   alert('This is IE');
}
else
{
  alert('This is Not IE');
}

Getting Data from Managed Metadata Column using JavaScript Client Side Object Model

Hello,

In this post I am explaining a small topic, how to get data from managed metadata filed using JavaScript client object model.

The reason to write this post is, generally if it is multi data column we check the count of the items and loop through it to get the values of it. But here with meta data columns the syntax is little different, we need to use child item count and loop through it and get the label property of it.

Generally we contain two types of settings for Manged Metadata column

Single valued Metadata Column (setting: Allow Multiple Values – False) : This contains single value
Multivalued Metadata Column (setting:    Allow Multiple Values – True)  : This contains single/multiple values.

Code to get the data from Singlevalued Metadata Column

Here the column name is 'ProductName'

//Single Valued Metadata column
var resultProductName = "";
        var _ProductName =  listItem.get_item('ProductName')
        if (typeof _ProductName !== 'undefined' && _ProductName !== null) 
        {
            resultProductName = listItem.get_item('ProductName').Label;
        }
  alert("Product Name " + resultProductName);


Code to get the data from Multivalued Metadata Column

  //Multi Valued Metadata column with single/multiple values
Here the column name is 'ProductColors'
 var resultColorString = "";
      
        var _ProdColors = listItem.get_item('ProductColors');    
        if (typeof _ProdColors !== "undefined" && _ProdColors !== null) {
            if (_ProdColors._Child_Items_.length > 0)
            {
                if (_ProdColors._Child_Items_.length == 1)// If single value
                {
                    var color = _ProdColors._Child_Items_[0].Label;
                    resultColorString = color;                  
                }
                else// If multi value
                {
                    for (var i = 0; i < _ProdColors._Child_Items_.length ; i++)
                    {
                        var multicolor = _ProdColors._Child_Items_[i].Label;
                        if (multicolor != null) {
                            resultColorString = resultColorString + "," + multicolor;
                        }
                    }
                    if (resultColorString.length > 0) {
                        resultColorString = resultColorString.substring(1, resultColorString.length);
                    }                   
                }
            }
        }    
       alert('color(s) ' + resultColorString)

Hope it saves some one's time :)

Thanks,
Purna

Apr 19, 2014

Un authorized Response Code with the Call HTTP Webservice Activity with REST call while accessing the Parent web's list contents in SharePoint Designer 2013 Workflow

Hi,

If you are accessing the list from a Parent web(In my case this is root web too) using Call HTTP Web service activity in SharePoint designer 2013 workflow with default headers you will get the Response Code as "Un Authorized".

In this way i am getting the Parent web's list items in the HTTP Call Web Service Activity in my workflow ..

http://workflowcontext:currnetsiteurl/_api/rootweb/lists/getbytitle('listname')/items






       I logged the Response Code to Workflow History to check what the response it is giving.. But after running the workflow on a item,  I found that it is giving the Response Code as "Un Authorized" .


To fix this issue authorization issue, add another header key called Authorization with empty value for the request header along with the accept and content type keys.





After adding this , got the Response Code as OK and im able to retrieve the parent web list items perfectly in  my current web.

Hope this helps in saving some one's time...!

Thanks,
Purna

Apr 3, 2014

AppManagement Shared Service Proxy is not installed : Error in SharePoint 2013 designer workflow when publishing

Hello,

I configured the workflow manager and created a SharePoint designer workflow and tried to publish the workflow and got the following error.

“Errors were found when compiling the workflow. The workflow files were saved but cannot be run. Microsoft.SharePoint.SPException: App Management Shared Service Proxy is not installed”


Causes for this : 

  • App Management service is stopped (or)
  • No App Management service application is exist (or)
  • The App Management service appn is not associated with the default proxy group

Resolution :

AppManagement service is stopped :

Go to Central Administration àManage services on server under system settings section à Start the AppManagement Service if it is in stop mode

No App Management service application is exist (or not created yet) :

Go to Central Administration àManage service applicationsà Create AppManagement Service if already not exist

The App Management service appn is not associated with the default proxy group

Go to Central Administration àApplication Management Tabà  Configure Service Application associations under Service Applications section à Add App management service app proxy to default group if not already added.

Thanks

Mar 18, 2014

There are no addresses available for this application : error in Businsess Data Connectivity Service Application SharePoint 2013

Hi,

The error "There are no addresses available for this application" is appearing when clicking on the Manage button in the Ribbon for the newly created Business Connectivity Service Application in SharePoint 2013 .



The reason for this is, the required services to run this bcs app are not started.These are the two services need to be started before we work with the Bcs Service Application.




Start these services by going to the path  Central Administration-->Manage Services on Server  .

Now you can open the BCS Service Application with out any issue...




Hope this is helpful, 
Thanks.